Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

How to multiplex an LCD with multiple inputs on a PIC?

Status
Not open for further replies.

bigal_scorpio

Active Member
Hi to all,

Firstly glad to see the site is ok! I never realised the complexity and space needed for the sites operation. Good work getting it going so quickly. Praise be to the Master.

Now onto my problem. I am presently trying to figure out how to multiplex a number of inputs to a PIC ic with the connections to an LCD (using 4bit mode).

I can understand how to do the PIC part as in setting the ports to either input to read the buttons or output to drive the LCD but I am confused as to what effect a button press would have on the LCD?

I am using a Gnd signal to the PIC as a signal of button pressed and I cannot really change this as that is how the device I intend to test works.

Any ideas would be welcome on the subject.

Al

PS if I get time tonight I may make a breadboard circuit and try it physically.
 
Assumption. LDC with 4 data lines. 4 switches connected to ground.

Add pull up resistors to the 4 data lines. 10k to 100k.
The PIC to LCD and the LCD to PIC data will not be effected by the pull up resistors.
When the LCD is not being updated, leave it not selected so it is not looking at the bus and it is not sending data.
Also leave the PIC in 'input' mode.

Add a 470 ohm resistor from a data line to the switch. The switch can only pull down 470 ohms.
A PIC can drive a pin high with the switch closed. The LDC might be able to pull a 470 ohm load high. (try 1k, 2.2k??)
The PIC and LCD can talk with a switch closed.
When the LDC is not selected, the PIC can see a high (pull up resistor) or a low (470 ohms to gnd).
 
Hi Ron,

Thanks mate, I was a bit unsure if it would work so you've put my mind at rest.

I will get on with the project now and let you know how it goes, well I will most likely strike trouble before its finished so you may be in demand again. ;)

Al
 
I'd aim for safety and try Ronsimpson's suggestion but with the higher resistances, ie 56k pullups and 1k5 or 2k2 resistors in series with the buttons. Software debouncing will be a must.

Don't forget to turn the PIC PORTB internal pullups OFF if you are using PORTB. :)
 
If the lcd's enable pin is inactive you can do what you like with the other pins, series swamp resistors are a good idea in case the micro is writing the diplay as you push the switch.
Also if you get the software to regularly update the entire screen (instead of just measured variables) then if something does mess up it'll right itself.
The only pin commited to the lcd is the enable.
I've run 2 lcd's in parallel with seperate enables, it worked fine.
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top