Dave
Always wear safety glasses while programming.
xobx, Just declare a word size variable and then pass it as the variable to the pause statement, like this:
time var word 'time in milliseconds
HIGH PORTB.1
PAUSE time
LOW PORTB.1
Dave Purola,
N8NTA
maybe something like this? (§ indicates new line) §loop: §button portb.0,1,255,0,but1,0,loop §gettime: §pause 100 §thetime = thetime + 1 §button portb.0,1,255,0,but1,0,gettime §flash: §for blink = 1 to thetime §high portb.1 §pause 100 §next blink §low portb.1 §goto loop
max number of pauses will be 65535. so with pause 100 max time will be 6553.5 seconds or just under 110 mins. for longer times use a longer pause, for better accuracy use a smaller pause. it would also need a line in gettime to make sure it doesn't overflow.
Last edited by nomad; - 3rd December 2007 at 12:43. Reason: oops
This will be more readable:
Code:loop: button portb.0,1,255,0,but1,0,loop gettime: pause 100 thetime = thetime + 1 button portb.0,1,255,0,but1,0,gettime flash: for blink = 1 to thetime high portb.1 pause 100 next blink low portb.1 goto loop
Ok but I doesnt understand this line :/
button portb.0,1,255,0,but1,0,loop
Bookmarks