declaring variables pic 16f84a

Discussion in 'Homework Help' started by skuzzie, Feb 25, 2009.

  1. skuzzie

    Thread Starter Member

    Feb 11, 2009
    10
    0
    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.

     
  2. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    (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.
     
  3. skuzzie

    Thread Starter Member

    Feb 11, 2009
    10
    0
    [​IMG]

    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: Feb 25, 2009
  4. jut

    Senior Member

    Aug 25, 2007
    224
    2
    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?
     
  5. skuzzie

    Thread Starter Member

    Feb 11, 2009
    10
    0
    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.
     
  6. skuzzie

    Thread Starter Member

    Feb 11, 2009
    10
    0
    *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)
     
  7. skuzzie

    Thread Starter Member

    Feb 11, 2009
    10
    0
    heres the txt document of the code if someone could have a look at it, the .lst wont attach.
     
Loading...