Shop OBEX P1 Docs P2 Docs Learn Events
SX28 Port IO — Parallax Forums

SX28 Port IO

lilylily Posts: 2
edited 2008-06-10 18:35 in General Discussion
Hi, I'm trying to write a simple test to verify the IO ports on the SX. I have initialized the rb ports as outputs and the rc ports as inputs. I have a connector that will reroute the rb outputs to rc. I'm getting an error trying to use the WATCH directive for rc. Is there another way I can check if rc is getting what rb is sending out?

Here is the code:
;
INITIALIZATION ROUTINE

Initialize
;Port Direction Configuration
MODE W, #$0F ;Set Mode to allow Direction Configuration
mov M,W
mov !ra,#%0000 ;Set port A low, output
mov !rb,#%00000000 ;Set port B low, output
mov !rc,#%11111111 ;Set port C bit, input


;
MAIN PROGRAM

Main
setb rb.0
WATCH rb.0, 1, UBIN
WATCH rc.0, 1, UBIN

jmp Main

thanks!

Comments

  • BeanBean Posts: 8,129
    edited 2008-06-10 18:22
    lily,
    That is strange...WATCH gives an error if the symbol is not used in the program.
    Just add a line that does something with RC and it will work. Something like "SETB rc.0".

    P.S. "MODE W,#$0F" should be "MOV W,#$0F"

    ;------------------------ INITIALIZATION ROUTINE -----------------------
     
    Initialize
    
     
    ;Port Direction Configuration
    
    mov W,#$0F ;Set Mode to allow Direction Configuration
    mov M,W
    
     
    mov !ra,#%0000 ;Set port A low, output
    mov !rb,#%00000000 ;Set port B low, output
    mov !rc,#%11111111 ;Set port C bit, input
    
    ;---------------------------- MAIN PROGRAM -----------------------------
    
    Main
    
     
    setb rb.0 
     
    jmp Main
     
    setb rc.0 ; This never gets executed, it's just here so WATCH will work
     
    WATCH rb.0, 1, UBIN
    WATCH rc.0, 1, UBIN
    


    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Did you know that 111,111,111 multiplied by 111,111,111 equals 12345678987654321 ?

    www.iElectronicDesigns.com

    ·
  • lilylily Posts: 2
    edited 2008-06-10 18:35
    Hi Bean, works now!

    THANKS!!
    Lily
Sign In or Register to comment.