Shop OBEX P1 Docs P2 Docs Learn Events
What's wrong with my waitpeq? [ASM] — Parallax Forums

What's wrong with my waitpeq? [ASM]

SteelSteel Posts: 313
edited 2008-01-02 18:59 in Propeller 1




I have been fighting with the waitpeq command, and need some help.
I have an ASM routine.· It *should* wait for a pin (Adams_CS) which is P0 to drop low.· Once the pin drops low, it should send "AA" out of Pin31.

Without the WAITPEQ command, the Prop Sends out the "AA" as desired.· When I put in the WAITPEQ statement, it won't function at all.

The WAITPEQ Statement is this:
······· WAITPEQ 0,ADAMS_CS
······· -ADAMS_CS is defined as $1 (P0 on prop)
······· -"0" because·the·ADAMS_CS line is·active low.··I want the code to execute when P0 is low.

If anybody can help me, I'd really appreciate it.

Thanks.

Shaun


DAT
 
START_COG          
        ORG             0
        MOV             DIRA, PIN_DIRECTIONS
 
WAIT_FOR_INCOMING_SIGNAL
       WAITPEQ 0,ADAMS_CS       
       
'***THE FOLLOWING SECTION SENDS 1 BYTE FROM "UP_DATA" UP TO THE PC @ 1.5MB/SEC***'
        
LOAD_UPSTREAM_DATA
        RDLONG   OUTPUT_DATA, PAR
        ROR   OUTPUT_DATA, #1
     
START_BIT
        MOV   OUTA, #$00       'Drop Level to 0
        CALL #BIT_PAUSE_1000000
              
'DATA_BYTE
        CALL #BIT_LOAD        'BIT 0
        CALL #BIT_PAUSE_1000000  
           
        CALL #BIT_LOAD              'BIT 1
        CALL #BIT_PAUSE_1000000
           
        CALL #BIT_LOAD           'BIT 2
        CALL #BIT_PAUSE_1000000  
        CALL #BIT_LOAD                  'BIT 3
        CALL #BIT_PAUSE_1000000  
        CALL #BIT_LOAD         'BIT 4
        CALL #BIT_PAUSE_1000000  
        CALL #BIT_LOAD          'BIT 5
        CALL #BIT_PAUSE_1000000   
        CALL #BIT_LOAD        'BIT 6
        CALL #BIT_PAUSE_1000000  
        CALL #BIT_LOAD     'BIT 7
        CALL #BIT_PAUSE_1000000   
    
'PARITY_BIT
        MOV OUTA, PIN_MASK
        CALL #BIT_PAUSE_1000000
          
'STOP_BIT
        'Don't need to  Change state because it is correct from Parity_Bit.
        CALL #BIT_PAUSE_1000000
       
'IDLE_LINE    'This returns the line back to Idle.
        MOV   TIME, CNT
        ADD   TIME, PAUSE 
        WAITCNT TIME, PAUSE
        
       JMP WAIT_FOR_INCOMING_SIGNAL  
  ''**********SUB ROUTINES****************************'
 

BIT_PAUSE_1000000
        MOV   TIME, CNT
        ADD   TIME, BIT_TIME_1000000  
        WAITCNT TIME, BIT_TIME_1000000 
BIT_PAUSE_1000000_RET
        RET
      
BIT_LOAD
        ROR   OUTPUT_DATA, #1  
        MOV   MASKED_OUTPUT, OUTPUT_DATA
        AND   MASKED_OUTPUT, PIN_MASK
        MOV   OUTA, MASKED_OUTPUT   
BIT_LOAD_RET
        RET
    
PAUSE                   long            5_000
BIT_TIME_1000000         long            17
PTR                     long             1     
Pin_Directions          long            %01000000_00000000_00000000_00000000
Pin_Mask                long            %01000000_00000000_00000000_00000000
OUTPUT_DATA             Long            $AA_AA_AA_AA
ADAMS_CS                LONG            $1
Time                    RES             1
MASKED_OUTPUT           RES             1


·

Comments

  • deSilvadeSilva Posts: 2,967
    edited 2008-01-02 18:50
    0 means "register with address 0".
    Rather use a register with content 0
      WAITPEQ  ZEROVAL, #1   ' mask P0
    ....
    ZEROVAL LONG 0
    
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2008-01-02 18:50
    In your WAITPEQ, you're asking for INA, ANDed with 1 to equal the contents of location 0. You need to define another LONG that contains a 0 and use that instead.

    -Phil
  • SteelSteel Posts: 313
    edited 2008-01-02 18:59
    A Thousand Thank you's!!!!

    It is working!

    Thank you for your quick responses.
Sign In or Register to comment.