.....................
.....................
Last edited by LEDave; - 20th April 2010 at 09:46.
Hi Henrik
Here's what I'd come up with late last night (I wish I'd posted it now before I went to bed as not the far off I don't think).
I set LCD_LINES 4 as the display is a 4*20.Code:DEFINE LCD_DREG PORT.A ' Set LCD Data port DEFINE LCD_DBIT 0 ' Set starting Data bit (0 or 4) if 4-bit bus DEFINE LCD_RSREG PORT.A ' Set LCD Register Select port DEFINE LCD_RSBIT 4 ' Set LCD Register Select bit DEFINE LCD_EREG PORTC ' Set LCD Enable port DEFINE LCD_EBIT 0 ' Set LCD Enable bit DEFINE LCD_BITS 4 ' Set LCD bus size (4 or 8 bits) DEFINE LCD_LINES 4 ' Set number of lines on LCD DEFINE LCD_COMMANDUS 2000 ' Set command delay time in us DEFINE LCD_DATAUS 50
The one I'm missed was LCD_EBIT 0 (it was late).
Also the PIC is a 16F684 PORTA and PORTC
Thank you for taking the time to do go through it all though (really appreciated) I'll load it later today and hopefully have some success (I'm just a little worried I've fried the LCD).
David
Last edited by LEDave; - 20th April 2010 at 10:03.
Hi Dave,
Ah, OK - I never crosschecked with the PIC datasheet, I only referenced your proposed connection scheme and LCD datasheet. So, PORTA and PORTC it is.
One thing though, there's not supposed to be dot in PORT.A it's just PORTA. The thing with DEFINEs is that they won't produce any error messages etc so you have to make sure you write them correctly or it simply won't work properly.
Last edited by HenrikOlsson; - 20th April 2010 at 10:42.
PORTA.3 is input only so you will need to move this over to portC.
Dave
Always wear safety glasses while programming.
How about doing it like this. The whole thing will be on PORTC. That will keep away from the MCLR and programming and POT(if still using the PICKIT1) pins.
LCD pinsCode:DEFINE LCD_DREG PORTC 'PORTC.0 WILL CONNECT TO DB4, PORTC3 TO DB7 DEFINE LCD_DBIT 0 DEFINE LCD_RSREG PORTC DEFINE LCD_RSBIT 4 'PORTC.4 CONNECT TO LCD PIN4 DEFINE LCD_EREG PORTC DEFINE LCD_EBIT 5 'PORTC.5 CONNECT TO LCD PIN6 DEFINE LCD_BITS 4 DEFINE LCD_LINES 4 DEFINE LCD_COMMANDUS 2000 DEFINE LCD_DATAUS 50
1 and 5 to VSS
2 to VDD
3 to wiper on POT
Dave
Always wear safety glasses while programming.
Hi mackrackit,
I've moved the whole thing over to the breadboard and wired it on there.
A couple of quick things:
Yes the manual shows a 10k res on MCLR, I've put one on PORTA.3 which probably isn't a good idea.
I've checked the voltage on the display itself earlier:
Across pin 1-2 = 4v (with pin 1 as GND)
Across pin 1-3 = it goes from 0 - 3.94v
Across pin 2-5 = 3.92v
Also (I've just noticed this) when I turn the POT, the top and third line of the display get darker, so something's going on or trying to.
I would turn MCLR off then you can use that pin as an input.
Display sounds like it is alive![]()
Dave
Always wear safety glasses while programming.
Bookmarks