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!
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.
First,THANKS ALL FOR HELP!!!
THIS IS CODE i WILL TRY TO MODIFIED,
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
This code work good,but,I need just when I press my button,then,
still working on some on this may program,
program1,program2,program3!!!
I do not how I make some changes,that will be working!
Hello.
Can you please give us a bit more detailed description of what are you trying to achieve. In the meantime you could try this:
Code:led_tm var word led var byte indx var byte dbc var byte led_f var bit symbol key=porta.2 poke $1F,7 'turn off comparator poke $9F,0 'turn off voltage reference porta=0: portb=0 trisa=%00010100 trisb=%00000000 pause 500 led_f=0: led_tm=0: indx=3 MAIN: pause 1 if key=0 then dbc=dbc+1 'use this if porta.2 is pulled high 'if key=1 then dbc=dbc+1 'use this if porta.2 is pulled low if dbc=70 then gosub SWITCH_LED if dbc>72 then dbc=72 if key=1 then dbc=0 'use this if porta.2 is pulled high 'if key=0 then dbc=0 'use this if porta.2 is pulled low led_tm=led_tm+led_f if led_tm=500 then toggle led led_tm=0 endif goto MAIN SWITCH_LED: indx=indx+1 if indx>2 then indx=0 lookup indx,[1,2,3],led toggle led led_f=1 return
Thanks so much,Grinder,for your help!!!
I try your code,and working good,just what I wont to do in my project,when I press button in PORTA.2, to change program,and still in same program,
and your code do it that!
But,can,you ex plane me,what I must do, which peace,of your code,I must change,
if I like to change, which port I like to be low,of high,I mean because I like to make some ,to combinations of led,to high,or low,to I do it myself!
To be fair, paste up your complete code as it is and then people can see what you want to do and hopefully post a corrected version for you. To ask for help and only post up cryptic bits of code makes it hard to provide the support you are seeking
Ok,I try modification this code:
and what I need,Code:switch var byte main: if portb.2 = 1 then switch = switch +1 If switch = 1 then goto program1 If switch = 2 then goto program2 If switch = 3 then goto program3 endif goto main program1: HIGH PORTB.1 PAUSE 500 LOW PORTB.1 PAUSE 500 GOTO program1 program2: HIGH PORTB.2 PAUSE 500 LOW PORTB.2 PAUSE 500 GOTO program2 program3: HIGH PORTB.3 PAUSE 500 LOW PORTB.3 PAUSE 500 GOTO program3
when I press button,JUST ONE TIME,TO, PORTB.2,
TO GO TO PROGRAM 1,
AND STILL WORKING IN THE PROGRAM 1.
when I press button,NEXT TIME,TO, PORTB.2,
TO GO TO PROGRAM 2,
AND STILL WORKING IN THE PROGRAM 2.
when I press button,NEXT TIME,TO, PORTB.2,
TO GO TO PROGRAM 3,
AND STILL WORKING IN THE PROGRAM 3,.......
THAT I NEED!!!
Bookmarks