Page 1 of 1
problem with avr waituntil
Posted: Sun Jan 03, 2010 4:09 pm
by ikke
Hello,
I am trying to toggle an output with a simple pushbutton. For 1 input/output the switchmacro works, but for the second one it just passes the macro.Or is there a better solution?
Thanks.
Re: problem with avr waituntil
Posted: Sun Jan 03, 2010 6:14 pm
by Sean
Hello Ikke,
The only problem with the program is the parameters being used in the WaitUntil macros.
The WhichSwitch(Byte) parameter refers to the position of the monitored switch within the port byte (0 to 7). This can be a calculated value to provide flexibility, but your program requires the constant values 0 and 1 in branches for the corresponding inputs.
Re: problem with avr waituntil
Posted: Sun Jan 03, 2010 8:08 pm
by medelec35
Don't know if this will help.
This is how I controlled o/p that is toggled each time i/p goes high. It does not wait for a switch to be pressed before carrying on, program is constantly looping so other functions can be performed. While switch is pressed, program doe not continue until switch is released, to avoid rapid nuisance toggling .
Note: Using var = var XOR 0b00000001 will also toggle.