
Originally Posted by
Kalind
gee, that example is confusing. all i want to use is 5 buttons on port c of my 16f873.
button A = High Setpoint
buttonB = Low Setpoint
buttonC= Increment
buttonD= Decrement
buttonE= Return to main display
At power up of my device, I want my program to prompt the user to enter a high and low setpoint then continue to display the main program afterwards. If the user decides to change setpoint, then the buttons above can be used.
Yes, it can be so why bother with all that keypad code then?
Code:
'simple if then loop
BUTTONA VAR PORTC.0
BUTTONB VAR PORTC.1
BUTTONC VAR PORTC.2 ' and so on . . .
MAIN:
IF BUTTONA = 0 THEN gosub High_Setpoint
IF BUTTONB = 0 THEN GOSUB Low_Setpoint
IF BUTTONC = 0 THEN GOSUB Increment
' More code goes in here
GOTO MAIN
high_setpoint:
'do something in here
return
Low_Setpoint:
'do something in here
return
Increment:
'do something in here
return
'more sub directories here
end
To address your original question, you may wish to store the value in the eeprom of your chip. Use WRITE command to store and READ to retrieve the values.
Last edited by Archangel; - 9th October 2008 at 10:08.
If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
.
Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
.
There simply is no "Happy Spam" If you do it you will disappear from this forum.
Bookmarks