CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Set all PIC output pins high or low in 1 instruction

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Futterama



Joined: 17 Oct 2005
Posts: 98

View user's profile Send private message

Set all PIC output pins high or low in 1 instruction
PostPosted: Tue Nov 01, 2005 5:15 am     Reply with quote

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 Cool

Regards,
Futterama
neil



Joined: 08 Sep 2003
Posts: 128

View user's profile Send private message

LCD driving
PostPosted: Tue Nov 01, 2005 5:40 am     Reply with quote

Don't forget some pics have a built in hardware LCD driver. There is the old 16C925 through to the 18F8490. Here is a chart of LCD driving pics.
http://www.microchip.com/ParamChartSearch/chart.aspx?branchID=107&mid=10&lang=en&pageId=74

Surely this would be easier than pin toggling in software. You will probably end up electroplating your LCD segments if your program pauses/hangs!

Hope this helps!
Futterama



Joined: 17 Oct 2005
Posts: 98

View user's profile Send private message

PostPosted: Tue Nov 01, 2005 7:28 am     Reply with quote

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

View user's profile Send private message Send e-mail

PostPosted: Tue Nov 01, 2005 7:34 am     Reply with quote

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: 1634
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Tue Nov 01, 2005 7:36 am     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Nov 02, 2005 1:24 am     Reply with quote

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 Cool
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Wed Nov 02, 2005 7:02 am     Reply with quote

Quote:
I guess this is only true for non-LCD-compatible PIC devices?
Yes
asmallri



Joined: 12 Aug 2004
Posts: 1634
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Wed Nov 02, 2005 7:46 am     Reply with quote

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!!
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group