Is that the whole code?
Is the line
in there someplace?Code:ButtonPressCounter VAR BYTE
Is that the whole code?
Is the line
in there someplace?Code:ButtonPressCounter VAR BYTE
Dave
Always wear safety glasses while programming.
Thanks,for help,but can you give me one more answer!
I write this code:
ButtonPressCounter var byte
SWITCHLOOP:
IF PORTA.2 = 0 THEN
IF ButtonPressCounter = 3 THEN ButtonPressCounter = 0
ButtonPressCounter = ButtonPressCounter + 1
IF ButtonPressCounter = 1 THEN GOSUB Program1
IF ButtonPressCounter = 2 THEN GOSUB Program2
IF ButtonPressCounter = 3 THEN GOSUB Program3
ENDIF
GOTO SWITCHLOOP:
Program1:
high portb.1
PAUSE 500
LOW PORTB.1
PAUSE 500
RETURN
Program2:
high portb.2
PAUSE 500
LOW PORTB.2
PAUSE 500
RETURN
Program3:
high portb.3
PAUSE 500
LOW PORTB.3
PAUSE 500
RETURN
is Ok,code working,
but how I do it,when I switch button,to change program,and stay work in this some of this program?
Sorry, but I do not understand the question.but how I do it,when I switch button,to change program,and stay work in this some of this program?
Dave
Always wear safety glasses while programming.
I try ex plane,my question!
I mean!
I need when I press button one time,
then in my case go to program1,
and still working in program1!
When I press button second time then
go to program2,
and still working in program2,
When I press button 3.rd time then
go to program3,
and still working in program3,......
Maybe...
maybe not... See what happens.Code:SWITCHLOOP: IF PORTA.2 = 0 THEN ButtonPressCounter = ButtonPressCounter + 1 IF ButtonPressCounter = 1 THEN GOSUB Program1 IF ButtonPressCounter = 2 THEN GOSUB Program2 IF ButtonPressCounter = 3 THEN GOSUB Program3 IF ButtonPressCounter = 4 THEN ButtonPressCounter = 0 ENDIF GOTO SWITCHLOOP:
Dave
Always wear safety glasses while programming.
Thanks,for your help,
but not working!
I need this program, because I try make program for some light show,when I press button,to change program,and still working,in some of this my program!
Last edited by dragan77; - 18th May 2010 at 01:35.
Are we seeing the whole code?
Have you turned any ANALOG off?
http://www.picbasic.co.uk/forum/showthread.php?t=561
And if that does not work tell what is happening.
Dave
Always wear safety glasses while programming.
Bookmarks