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.

20Mhz PIC & HD44780-clone

Status
Not open for further replies.
Okay, I'm just checking this so I don't run into a whole bunch of pain later. I'm using a PIC16F876A at 20Mhz on a protoboard, with a bunch of I/O hooked into a breadboard, and then a 2x40 LCD based on the KS0066UP (Which looks to have an identical command set to the HD44780) hooked into that.

My main concern is this: At 20 Mhz, an instruction is 50 ns, and the LCD datasheet says that the minimum E pulse width is 230 ns.

So, does this mean that my code will have to use a lot of delay loops in order to go slow enough for the LCD controller?

Also, the Read Data Output Delay is 120ns (max), so this means it'll take at most 120ns for the data output (in Read mode) to become valid?

Just trying to make sure I'm reading this datasheet correctly, so I won't be running around like a chicken with it's head cut off if I mess something up something minor in my code.

For those interested, my LCD is the Tianma TM402CBFW6.

Thanks in advance.
 
My main concern is this: At 20 Mhz, an instruction is 50 ns,
If I'm not mistaken, it's actually 200nS, as the effective clock rate is Fosc/4.

So, does this mean that my code will have to use a lot of delay loops in order to go slow enough for the LCD controller?
YES. Or hook up the RW line and check the busy bit (MUCH faster).

Quote from Myke Predko's LCD page:
I usually tie "R/W" to ground and just wait the maximum amount of time for each instruction (4.1 msecs for clearing the display or moving the cursor/display to the "home position", 160 usecs for all other commands).

Initializing the LCD needs some slightly different delays than those. And you'll need a fairly long settling time delay before initializing. You'll find details on Myke's page or on my site.
 
Last edited:
The clock on a Pic is divided by 4 and so your instruction time is actually 200nS.

To comply with the 500nS requirement you could do,
Code:
	bsf	PORT,EN
	goto	$+1
	bcf	PORT,EN
This would keep the enable line high for 600nS.

Edit, I just checked the datasheet and the E width only needs to be 220nS and so a single NOP would be enough.

Mike.
 
Last edited:
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top