Hi,
Only solution : , index on LCD or Bargraph or LED Display of the number !!!
Or use a "Rainbow led" ... and display with resistor's code !!!
Alain
Hi,
Only solution : , index on LCD or Bargraph or LED Display of the number !!!
Or use a "Rainbow led" ... and display with resistor's code !!!
Alain
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
Hi. If I understand correctly, something like this should allow you to push the button numerous times while advancing your mode with each push. Unfortunately, I’m at work now & can’t test it. It looks to me like it should work.
START:
CLEAR 'ALL VARIABLES = 0
IF PORTA.0 = 1 THEN START 'BUTTON NOT PUSHED STAY HERE
MODE:
LET TIMER = 0 ‘RESET TIMER
LET MODENUMBER = (MODENUMBER + 1) 'ADVANCE MODE
WAITFORRELEASE:
PAUSE 25 'DEBOUNCE
IF PORTA.0 = 0 THEN WAITFORRELEASE 'BUTTON STILL PUSHED WAIT HERE
BUTTONTIMER:
IF PORTA.0 = 0 THEN MODE 'ADVANCE MODE IF BUTTON PUSHED AGAIN
LET TIMER = (TIMER + 1)
PAUSE 10
IF TIMER >= 500 THEN SIGNALMODE 'AFTER 5 SECONDS SIGNAL THE MODE NUMBER
GOTO BUTTONTIMER
SIGNALMODE:
HIGH PORTB.0 'LIGHT UP LED OR BEEP PIEZO BUZZER
PAUSE 250
LOW PORTB.0 'OFF LED OR SOUNDER
PAUSE 250
LET SIGNAL = (SIGNAL + 1)
IF SIGNAL < MODENUMBER THEN SIGNALMODE 'KEEP FLASHING OR BEEPING
GOTO (YOUR MAIN PROGRAM)
If you have only 1 push button, you could use an internal timer/counter. This one will increase each time you press on the switch (may need some external debouncing). You could also use an interruptible pin, says INT0, and within your ISR, you increase your counter value and process the Debouncing.
A timer interrupt, or polling a timer overflow to check the Counter value, and you're all set.
Last edited by mister_e; - 4th May 2009 at 15:59.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
I will try the example above. If anyone else has any other suggestions please let me know.
Bookmarks