FOR sequence is skipped


Results 1 to 5 of 5

Threaded View

  1. #1
    Join Date
    Aug 2006
    Location
    In a world of german electrons
    Posts
    102

    Angry FOR sequence is skipped

    Hello. I wrote this piece of code to test PBP:

    Code:
    Start:
    	YellowLED VAR PORTB.0
    	RedLED VAR PORTB.1
            t VAR BYTE
    	WH VAR BYTE
    
    	High  CMCON.0
    	High  CMCON.1
    	High  CMCON.2
    
    	HIGH  STATUS.0
    	TRISB = %00000000
    	TRISA = %00000000
    	Low  STATUS.0
    	High  YellowLED 	;LED Starting sequence
    	High  RedLED
    	PAUSE  2000
    	Low  YellowLED
    	Low  RedLED
    	PAUSE  2000
    	
    	
    	FOR	t=20000 TO 250 STEP - 1
     		High 	RedLED
    		PAUSE 	100
     			FOR	WH=0 TO 2000 STEP 1
    		 	PAUSE  20
    		 	High 	YellowLED
    			PAUSE	100
    			Low 	YellowLED
    		NEXT WH
    		Low 	RedLED
    	NEXT t
    
    GO:
    	High  RedLED
    	High  YellowLED
    	PAUSE  500
    	Low  RedLED
    	Low  YellowLED
    	PAUSE  500
    	GOTO  GO
    Unfortunately it acts as if there is no "FOR" present. So what it does is the following:

    Code:
    Start:
    	YellowLED VAR PORTB.0
    	RedLED VAR PORTB.1
            t VAR BYTE
    	WH VAR BYTE
    
    	High  CMCON.0
    	High  CMCON.1
    	High  CMCON.2
    
    	HIGH  STATUS.0
    	TRISB = %00000000
    	TRISA = %00000000
    	Low  STATUS.0
    	High  YellowLED 	;LED Starting sequence
    	High  RedLED
    	PAUSE  2000
    	Low  YellowLED
    	Low  RedLED
    	PAUSE  2000
    
    GO:
    	High  RedLED
    	High  YellowLED
    	PAUSE  500
    	Low  RedLED
    	Low  YellowLED
    	PAUSE  500
    	GOTO  GO

    How to solve this ?
    Last edited by selbstdual; - 8th August 2006 at 21:25.

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts