several way to do it, use T0CKI pin. Each time you will press on the button, TMR0 register will increment (if properly configured) .
Then you just need to read TMR0 register, XOR it results with your Max value, the read STATUS,Z bit. If zero, you have reached the Max value.
Could still be done using a variable, same concept, every time a button have been pressed, increment the variable etc etc. test it and do your thing.
In your code, you will increment your variable and test it in SEMI routine.
could be something like that...
Now... i have to say that you're on a PICBasic forum, even if there's some tolerance for few assembler line here and there, it's not the main purpose/knowledge of this forum. Here, we use Melabs PicBasic or Melabs PICBasic PRO.Code:SEMI INCF COUNTERVAR,F MOVF COUNTERVAR, W XORLW .10 ; XOR With 10 (max value) BTFSC STATUS,Z ; reach Max Value? GOTO $ ; YES, Spin in round forever MOVLW B'00000001' ; NO, continue MOVWF PORTB CALL DELAY_ROUTINE CALL DELAY_ROUTINE MOVLW B'00000000' ; MOVWF PORTB CALL DELAY_ROUTINE CALL DELAY_ROUTINE S1 BTFSC PORTA,SW1 GOTO S1 GOTO MENU
Microchip have it's forum, and there's a lot of clever assembler programmer over there.
http://forum.microchip.com/
sorry
... don't give up... maybe you'll see me over there as well.


sorry 

Bookmarks