You sure can. Prior to writing to the LCD each time, you set the (particular) pin ports to OUTPUT. After you're done writing to the LCD switch them to INPUT before checking the pushbutton's status. It's just about as simple as that. Just make sure you've set them properly (the direction) before each use.
The pushuttons should be normally open, so they have no impact on the LCD when they're not in use.
Regards,
Bruce Bates
Post Edited (Bruce Bates) : 8/7/2006 6:31:18 AM GMT
I think each of those datapins require a 4k7 or 10k pullup resistor.
Also, between a datapin and its pushbutton, there should be a 1k resistor.
If the BS happens to be writing to the LCD, this 1k resistor prevents
a possible short between BS pin and GND. It also prevents that
the button corrupts the dataline level when the BS is writing.
But what would happen if a push button was being pressed at the time data was being written to the LCD.· Wouldn't it mess it up?
Jim
Bruce Bates said...
Jim -
You sure can. Prior to writing to the LCD each time, you set the (particular) pin ports to OUTPUT. After you're done writing to the LCD switch them to INPUT before checking the pushbutton's status. It's just about as simple as that. Just make sure you've set them properly (the direction) before each use.
The pushuttons should be normally open, so they have no impact on the LCD when they're not in use.
Jim,
Parallax just put its little LCD with 4 buttons on sale for $15. You can download the documentation for that and have both the code and the explanation of how it works.
Personally, I have be thinking of adding a 5th command [noparse][[/noparse]all four buttons down] as you can squeeze more functions out of using more that one button.
Another alternative documented by Jon Williams in a Nuts and Volts article on menus is to use a SHIFTout IC to drive the LCD and a SHIFTin IC to drive up to 8 buttons. It seems to me that this really gives you the most free pins and the most buttons.
If code space is running low, a serial LCD may allow you to have more EEPROM as it takes over the management of LCD initialization and housekeeping. AND, you might run SERIALOUT on a PIN 16 configuration that will use your PIN1
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"If you want more fiber, eat the package.· Not enough?· Eat the manual."········
···················· Tropical regards,····· G. Herzog [noparse][[/noparse]·黃鶴 ]·in Taiwan
Comments
You sure can. Prior to writing to the LCD each time, you set the (particular) pin ports to OUTPUT. After you're done writing to the LCD switch them to INPUT before checking the pushbutton's status. It's just about as simple as that. Just make sure you've set them properly (the direction) before each use.
The pushuttons should be normally open, so they have no impact on the LCD when they're not in use.
Regards,
Bruce Bates
Post Edited (Bruce Bates) : 8/7/2006 6:31:18 AM GMT
Also, between a datapin and its pushbutton, there should be a 1k resistor.
If the BS happens to be writing to the LCD, this 1k resistor prevents
a possible short between BS pin and GND. It also prevents that
the button corrupts the dataline level when the BS is writing.
regards peter
Jim
regards peter
Peter's answer is exactly correct, and I always BOW to all the hardware guys around here. I'm just a software guy.
OTOH, I just can't resist the following, in answer to you question:
Do you have any of those tiny marshmallows around and some small toothpicks
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
<!--StartFragment -->
Parallax just put its little LCD with 4 buttons on sale for $15. You can download the documentation for that and have both the code and the explanation of how it works.
Personally, I have be thinking of adding a 5th command [noparse][[/noparse]all four buttons down] as you can squeeze more functions out of using more that one button.
Another alternative documented by Jon Williams in a Nuts and Volts article on menus is to use a SHIFTout IC to drive the LCD and a SHIFTin IC to drive up to 8 buttons. It seems to me that this really gives you the most free pins and the most buttons.
If code space is running low, a serial LCD may allow you to have more EEPROM as it takes over the management of LCD initialization and housekeeping. AND, you might run SERIALOUT on a PIN 16 configuration that will use your PIN1
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"If you want more fiber, eat the package.· Not enough?· Eat the manual."········