How about something like a 'for next' loop:-
For wipp_time = 1 to 10 ;adjust for your required timing delay
Next wipp_time
How about something like a 'for next' loop:-
For wipp_time = 1 to 10 ;adjust for your required timing delay
Next wipp_time
Last edited by tasmod; - 3rd September 2012 at 19:06.
Thanks for reply...but wipp_time dont have just 1 to n value ...It's "seconds elapsed between two pushing of button @gpio.5" !
I dont understand why in "while...wend" command, the failure of condition " gpio.5 = 0" dont stop the "pause (wipp_time * 1000)" command and dont return to master (loop)...
You have to write:
Delay VAR word
Wipper:
Delay = wipp_time * 1000
While gpio.5 = 0
Pause 1000
Led = !Led
If Delay= 0 then Skip_0
Pause 1
Delay = Delay - 1
Skip_0:
Wend
Return
Cheers
Al.
All progress began with an idea
Thank You !
...but the schematic dont work if I wish...
Code:@ Device PIC12F675,INTRC_OSC_NOCLKOUT, WDT_OFF,PWRT_ON,PROTECT_OFF,MCLR_OFF,BOD_OFF Include "C:\WIPPER\Elapsed.bas" ' just wsave(s) removed CLEAR DEFINE OSC 4 ANSEL=0 CMCON=7 TRISIO=%00100000 maneta var gpio.5 LED var GPIO.2 ' set GPIO.0 port as OUTPUT (LED) wipp_time var byte ' number of seconds while LED=off nr var bit delay var word nr = 0 low LED Gosub ResetTime ' reset Time to 0d-00:00:00.00 Main: IF GPIO.5 = 1 then nr=nr+1 if nr=1 then gosub memo ' set wipe_time else gosub wipper ' use seconds elapsed as wipe_time nr = 0 ' ready for another setting of wipe_time endif if nr > 2 then nr = 0 ENDIF Goto Main memo: gosub StartTimer while maneta = 1 wipp_time = seconds ' seconds counts from the beginning of gpio.5 = 0 wend Gosub StopTimer Gosub ResetTime return Wipper: Delay = wipp_time * 1000 While gpio.5 = 1 Pause 1000 Led = !Led If Delay= 0 then Skip_0 Pause 1 Delay = Delay - 1 Skip_0: Wend Return
There are other advices ?! Please !
I think it's a problem with the title of my topic ... since me I am not intelligent enough to solve this !
I try another way :
Without results ! Variable "nr" seems to NOT increase ...I push "maneta", then go to memo, I push again, then go to wipper, I push again, then go to wipper again ?!?Code:@ Device PIC12F675,INTRC_OSC_NOCLKOUT, WDT_OFF,PWRT_ON,PROTECT_OFF,MCLR_OFF,BOD_OFF CLEAR DEFINE OSC 4 ANSEL=0 CMCON=7 TRISIO=%00100000 maneta var GPIO.5 LED var GPIO.2 ' set GPIO.0 port as OUTPUT (LED) wipp_time var word ' number of seconds while LED=off nr var word nr = 0 Main: IF maneta = 1 then nr = nr + 1 if nr= 1 then gosub memo else gosub wipper endif ENDIF Goto Main memo: while maneta = 1 low led wipp_time = wipp_time + 1 ' counting in 100 ms steps pause 100 wend nr = 1 return Wipper: while maneta = 1 high led pause 1000 low led pause wipp_time * 100 wend nr = 0 wipp_time = 0 Return
Sorry Fratello, but your thread title excludes me from this discussion.
I wish I could help you but this is over my head. I have enough problem keeping concentrated on my own little project.
Robert
Bookmarks