View previous topic :: View next topic |
Author |
Message |
Futterama
Joined: 17 Oct 2005 Posts: 98
|
Set all PIC output pins high or low in 1 instruction |
Posted: Tue Nov 01, 2005 5:15 am |
|
|
Hello forum,
I'm building a LCD display driver with a 40pin PIC.
For that, I need to be able to change state (high or low) on all the outputs at the exact same time. Even if I run the PIC at 8MHz internal OSC, the small delay on the output waveforms to the LCD segments will perhaps damage the LCD over time.
So, how can I set the output state on several pins at the same time? This involves 4 ports right now, RA, RC, RD and RE.
Some pins will go from high to low, while others will go from low to high, all should be done in 1 instruction.
I hope you can help me out
Regards,
Futterama |
|
|
neil
Joined: 08 Sep 2003 Posts: 128
|
|
|
Futterama
Joined: 17 Oct 2005 Posts: 98
|
|
Posted: Tue Nov 01, 2005 7:28 am |
|
|
Thanks for the hint, neil.
There is just two problems:
1. The PIC has to be either DIP or SOIC package. These are the only ones I can solder.
2. The PIC have to be supported by my programmer. And unfortunately neither of the LCD-PICs is supported at the moment.
I can see that the PIC16F913 would be a good choice. My LCD has 2 commons and 15/14 segments.
Perhaps I can do some tricks to make my programmer support the PIC16F913.
I'll look into it. Thanks. |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Tue Nov 01, 2005 7:34 am |
|
|
The pic can't do it alone. You will need to use some sort of buffer where you can latch the signals at once. |
|
|
asmallri
Joined: 12 Aug 2004 Posts: 1635 Location: Perth, Australia
|
|
Posted: Tue Nov 01, 2005 7:36 am |
|
|
Instead of driving the LCD directly from the PIC, use four serial-to-parallel shift registers with the output enables commoned. This means you only need a small footprint PIC and can talk to the LCD via the SPI interface (or bit bang). From memory the 74hc595 is the right type of device. _________________ Regards, Andrew
http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!! |
|
|
Futterama
Joined: 17 Oct 2005 Posts: 98
|
|
Posted: Wed Nov 02, 2005 1:24 am |
|
|
Mark wrote: | The pic can't do it alone. You will need to use some sort of buffer where you can latch the signals at once. |
I guess this is only true for non-LCD-compatible PIC devices?
My PIC programmer software has recently been updated to support the PIC16F913 which have LCD support. I'll try to use this one.
Otherwise, I can use XOR gates for the drive.
asmallri, I'm not sure how that thing works, and it seems to me that the PIC16F913 will do the job (1 PIC compared to 1 PIC + 4 74HC595's).
But thank you all for your suggestions, I'll try the PIC16F913 first |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Wed Nov 02, 2005 7:02 am |
|
|
Quote: | I guess this is only true for non-LCD-compatible PIC devices? | Yes |
|
|
asmallri
Joined: 12 Aug 2004 Posts: 1635 Location: Perth, Australia
|
|
Posted: Wed Nov 02, 2005 7:46 am |
|
|
Futterama wrote: | thing works, and it seems to me that the PIC16F913 will do the job (1 PIC compared to 1 PIC + 4 74HC595's).
|
The beauty of the serial to parallel shift registers is that are located next to the pins to be driven and you only require two or three pins to go to the PIC. Makes it very easy to layout boards. Hard to believe I am saying this but.. sometimes a little external logic can greatly simplify a job. _________________ Regards, Andrew
http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!! |
|
|
|