declaring variables pic 16f84a

Thread Starter

skuzzie

Joined Feb 11, 2009
10
Im supposed to fill in the comments for the code.

*declare variables*
Name Address
PORTB EQU 6 ;
TRISB EQU 86H ;
OPTREG EQU 81H ;
STATUS EQU ;
CARRY EQU 0 ;
RP0 EQU 5 ;
MSB EQU 3 ;

Im pretty sure im just over thinking.

 

SgtWookie

Joined Jul 17, 2007
22,230
Rich (BB code):
*declare variables*

Name           Address
PORTB    EQU   6   ;
TRISB    EQU   86H ;
OPTREG   EQU   81H ;
STATUS   EQU       ; 
CARRY    EQU   0   ;
RP0      EQU   5   ;
MSB      EQU   3   ;
(added CODE blocks to maintain alignment)
Well, for one thing - those aren't variables, they're EQUates.
Variables can be changed at run-time.
Equates are resolved at compile time.
You don't have STATUS set to anything; that may or may not flag as an error (it should flag as an error, but that'll depend upon your compiler.)
Put your comments to the right of the semicolons, and indicate what the function of each equate is.
 

Thread Starter

skuzzie

Joined Feb 11, 2009
10


Thats what I was handed, and told to fill in the comments.

I guess what I am asking is, where can I find out what the function actually does/is.
 
Last edited:

jut

Joined Aug 25, 2007
224
Maybe if you spent more time studying PIC code and not watching youtube or checking Facebook you might know the answer.


Are you asking what the entire program does?

Or what is the purpose of using equates?
 

Thread Starter

skuzzie

Joined Feb 11, 2009
10
Maybe if you spent more time studying PIC code and not watching youtube or checking Facebook you might know the answer.


Are you asking what the entire program does?

Or what is the purpose of using equates?
You use equates to access immediate data??
COUNT EQU 0x30
MOVLW COUNT; wreg = 30h

What I dont know is what RP0 and MSB are. They are not on my instruction set. So I mainly just want to know what they and where I can find what the rest of them mean.

The actual program, 2+ pages of code, are what I am to believe is a timer of some sort. If you want to have a look and give your thoughts PM me, id appreciate it.
 

Thread Starter

skuzzie

Joined Feb 11, 2009
10
*sigh* I loaded a .lst file into mplab and it has all the info in it. If someone could look at it though I would appreciate it. I ran the program in micro sim and it just quits a certaint location (no code at target address 30H)
 
Top