PDA

View Full Version : Problem with 2x16 LCD on 16F630



Falcon
- 9th June 2005, 23:17
Hello !

I have been trying to get a 2x16 LCD to work with the 16F630, I have tried everything but I always get a blank display !

Here is the code:

*****************************

Device = 16F630

' PIC Defines
' -----------

CONFIG INTRC_OSC_NOCLKOUT,WDT_OFF,PWRTE_OFF,MCLRE_OFF,BOD EN_OFF,CPD_OFF,CP_OFF

'DB0 to DB3 (Pins 7, 8 ,9 & 10) no connection, grounded
'DB4 (pin 11) to RC2 (pin 8)
'DB5 (pin 12) to RC3 (pin 7)
'DB6 (pin 13) to RC4 (pin 6)
'DB7 (pin 14) to RC5 (pin 5)
'RS (pin 4) to RC1 (pin 9)
'E (pin 6) to RC0 (pin 10)
'R/W (pin 5) to VSS

Delayms 1000

ALL_DIGITAL = TRUE

CMCON = 7
TRISA = %000000
TRISC = %000000
OPTION_REG.7 = 1 ' 0=Enable 1=Disable PORTB pull-ups

DECLARE LCD_TYPE 0
DECLARE LCD_DTPIN PORTC.4
DECLARE LCD_RSPIN PORTC.1
DECLARE LCD_ENPIN PORTC.0
DECLARE LCD_INTERFACE 4
DECLARE LCD_LINES 2



' Mainloop:

print "Hello Peter"

' Goto Mainloop

End
**************************************

I usually dont give up but I find no answer.

Any help please ?

Thanks, Peter

mister_e
- 10th June 2005, 02:12
Falcon,
we can't help you on that since you're not using Melabs PICBasic... but if you go http://www.picbasic.org/forum/index.php? you'll find the right person to help you.

BUT one thing i see is that you should use the 4 lowest bit of PORTC for data, the other for RS and E. If you use the 4 highest, PORTC should have 8 bits... he don't :)

so modify you connection and use

DECLARE LCD_DTPIN PORTC.0
DECLARE LCD_RSPIN PORTC.4
DECLARE LCD_ENPIN PORTC.5

Falcon
- 10th June 2005, 03:25
Hello Steve,

Thanks a lot for the info, I changed it to DECLARE LCD_DTPIN PORTC.0 and it worked immediately.

Noted that I have to change forum, thankyou once again for your help !

Peter