PDA

View Full Version : LCDOUT with a 12F683



AvionicsMaster1
- 19th March 2013, 22:20
Ladies and Gents,

I was wondering if anyone can give me a few clues on how to get an LCD to work when driven by a 12F683 and using LCDOUT. I'd tie the R/W pin to ground like the book says since I won't be using it. Ten I'd tie the RS and E to +5V 'cause as I see it the LCD should always be ready for data.

I know there aren't 4 pins in a row so I'd need to use GPIO.0, GPIO.1, GPIO.2 and GPIO.3. I won't have anything exotic running to it but I think it will be a good lesson is using LCds

For the DEFINEs the manual says
DEFINE LCD_DREG PORTA
DEFINE LCD_DBIT 0
DEFINE LCD_RSREG PORTA
DEFINE LCD_RSBIT 4
DEFINE LCD_EREG PORTB
DEFINE LCD_EBIT 3
DEFINE LCD_BITS 4
DEFINE LCD_LINES 2
DEFINE LCD_COMMANDUS 1500
DEFINE LCD_DATAUS 44

but the 12F683 has PORT0. Can I use:

DEFINE LCD_DREG GPIO
DEFINE LCD_DBIT 0
DEFINE LCD_BITS 4
DEFINE LCD_LINES 2
DEFINE LCD_COMMANDUS 1500
DEFINE LCD_DATAUS 44

And not use these:
DEFINE LCD_RSBIT 4
DEFINE LCD_RSREG PORTA
DEFINE LCD_EREG PORTB
DEFINE LCD_EBIT 3
since their always high with my scheme.

I saw the example of bit banging on the MELabs site but wanted to use LCDOUT for it's ease of use.

Your replies are almost always appreciated especially if they work.

Darrel Taylor
- 19th March 2013, 23:33
You cannot tie the LCD's RS and E to +5V.

RS is the "Register Select", and it needs to select between Command and Data registers for the LCD to work.
E clocks in the data nibbles, without the clock the LCD never receives data. It is not just an "Enable" pin.

GPIO.3/MCLR/Vpp when not used as MCLR, is an Input Only pin. You cannot use it for the data bus output.

There just aren't enough pins on a 12F683 to drive an LCD directly.
You can do it with a shift register, or port expander. But if you are going to have two chips ... you might as well just use a bigger PIC to begin with.

Mike did a strange little circuit here (http://www.picbasic.co.uk/forum/showthread.php?t=15831&p=110091#post110091) that uses the serial data to control the RS bit. Which means you have to send two byes serially for every byte sent to the LCD, and you have to bit-bang the LCD routines since LCDOUT will not work.
But then again ... WHY? When you can just use a bigger PIC.

AvionicsMaster1
- 20th March 2013, 05:26
Thanks for the input and sorry for showing so much ignorance. I didn't even have to be connected to +5 to learn something. Usually it takes 220V or higher to get my attention;-)

Going with a bigger PIC appears to be my only option. I just wondered if it were possible, thought I'd ask and I found a butt load of them in the shop.

Thanks for your time and willingness to impart your knowledge.

nomad
- 6th May 2014, 00:25
That link to Mike's project posted by Darrel Taylor has been updated.
here (http://www.picbasic.co.uk/forum/showthread.php?t=15831&p=110091#post110091)

no longer needs 2 bytes and is serout, debug, etc compatible!.. pretty slick actually (My opinion)


(is there still a "buttload" in a shop? lol)