Ruben, A way around the unsynchronized LCD and key switch read, would be to read the keys every time in the LCD routine and save the value along with a flag to show new key data. Then in another part of the program, evaluate the new key data. And if you don't already debounce the key switch input, it may be a good idea to do so. Bill ----- Original Message ----- From: "Ruben Jvnsson" To: Sent: Thursday, July 04, 2002 1:03 PM Subject: Re: [PIC]:pins share, a good practice? I am sharing LCD I/O pins with inputs from key switches on an SX chip. The keys can only pull down an input through diodes when it's common connection is set low by an output (key enable) and the internal clamping resistors are used to pull the line high when the switch is open. One problem I had with this was that it sems that the LCD I/O pins has a pretty high capacitance. If I read the keys right after I had written a zero to the LCD input and the key switch on the same line is open, the clamping resistors was sometimes too weak to pull the (now input) line high quick enough. This resulted in that the switch would sometimes be read as closed even though it was open. The solution was simple though - write a one to the I/O line for a short time, just before the keys are read. It took a while to debug since LCD updates (writes) is not synchronized with key switch reads. Ruben > I think about sharing PORTB RB4:7 for hd44780 lcd, 4 DAC's > data/clk, not enable and not load pin. > > I think it should fine. But if it is normally people doing and any > disadvantages? > > BR, > ============================== Ruben Jvnsson AB Liros Elektronik Box 9124, 200 39 Malmv, Sweden TEL INT +46 40142078 FAX INT +46 40947388 ruben@pp.sbbs.se ============================== -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body