I use LCD with the 16F88 and the conection is following:
DB7-RB7,
DB6-RB6
DB5-RB5
DB4-RB4
ES-RB1
E-RB0
I use Lcd_Config(PORTB,7,6,5,4,PORTB,1,3,0); Is this correct ? The LCD dont work...
_miroslav
LCD initialization for 16F88
Re: LCD initialization for 16F88
What exactly does not work?terabit wrote:I use LCD with the 16F88 and the conection is following:
DB7-RB7,
DB6-RB6
DB5-RB5
DB4-RB4
ES-RB1
E-RB0
I use Lcd_Config(PORTB,7,6,5,4,PORTB,1,3,0); Is this correct ? The LCD dont work...
_miroslav
Make sure you connect the RW pin of LCD to ground.
Re: LCD initialization for 16F88
zristic wrote:What exactly does not work?terabit wrote:I use LCD with the 16F88 and the conection is following:
DB7-RB7,
DB6-RB6
DB5-RB5
DB4-RB4
ES-RB1
E-RB0
I use Lcd_Config(PORTB,7,6,5,4,PORTB,1,3,0); Is this correct ? The LCD dont work...
_miroslav
Make sure you connect the RW pin of LCD to ground.
Yes the RW is on ground. (I use the connection with assambler and it work OK, the connections are OK) .It make only black boxes in first row.(there are not full black, it is like the LCD is not initialized)
I have begin with the Mikropascal and i am not sure if this is OK Lcd_Config(PORTB,7,6,5,4,PORTB,1,3,0); for me connection.
here is full code
Code: Select all
var ch: byte;
t : word;
Text : array[17] of char;
tlong: longint;
begin
PORTB := 0; // clear PORTB
TRISB := 0; // designate PORTB as output (LCD is connected to PORTB)
INTCON := 0; // disable all interrupts
//Lcd_Init(PORTB); // initialize (4-bit interface connection)
Lcd_Config(PORTB,7,6,5,4,PORTB,1,3,0);
Lcd_Cmd( LCD_CURSOR_OFF); // send command to LCD (cursor off)
Lcd_Cmd(LCD_CLEAR);
Text := 'Inicializacia'; // assign text to string a
Lcd_Out(1,1, Text); // print string a on LCD, 1st row, 1st column
OPTION_REG := $80;
ADCON1 := $82; // configure VDD as Vref, and analog channels
TRISA := $FF; // designate porta as input
Delay_ms(2000);
Text := 'voltage:'; // assign text to string a
Lcd_Out(2, 1, Text); // print string a on LCD, 2nd row, 1st column
Lcd_Chr(2, 14, 'V');
while true do
begin
t := ADC_read(0); // get ADC value from 2nd channel
tlong := t*5000;
t := tlong shr 10;
ch := t div 1000; // prepare value for diplay
Lcd_Chr(2, 9, 48+ch); // write ASCII at 2nd row, 9th column
Lcd_Chr(2, 10, '.');
ch := (t div 100) mod 10;
Lcd_Chr(2, 11, 48+ch);
ch := (t div 10) mod 10;
Lcd_Chr(2, 12, 48+ch);
ch := t mod 10;
Lcd_Chr(2, 13, 48+ch);
delay_ms(1);
end;
end.
Re: LCD initialization for 16F88
You have to set ANSEL to 0, before calling LCD_Config.
Re: LCD initialization for 16F88
Why ANSEL? I use the LCD on RB . Now i have delete the ADC code I need only check the LCD.zristic wrote:You have to set ANSEL to 0, before calling LCD_Config.
Is this lcd config OK? Lcd_Config(PORTB,7,6,5,4,PORTB,1,3,0); for this pins?
DB7-RB7,
DB6-RB6
DB5-RB5
DB4-RB4
ES-RB1
E-RB0
Or not?
Code: Select all
var ch: byte;
t : word;
Text : array[17] of char;
tlong: longint;
begin
PORTB := 0; // clear PORTB
TRISB := 0; // designate PORTB as output (LCD is connected to PORTB)
INTCON := 0; // disable all interrupts
//Lcd_Init(PORTB); // initialize (4-bit interface connection)
Lcd_Config(PORTB,7,6,5,4,PORTB,1,3,0);
Lcd_Cmd( LCD_CURSOR_OFF); // send command to LCD (cursor off)
Lcd_Cmd(LCD_CLEAR);
Text := 'Inicializacia'; // assign text to string a
Lcd_Out(1,1, Text); // print string a on LCD, 1st row, 1st column
OPTION_REG := $80;
ADCON1 := $82; // configure VDD as Vref, and analog channels
TRISA := $FF; // designate porta as input
Delay_ms(2000);
Text := 'voltage:'; // assign text to string a
Lcd_Out(2, 1, Text); // print string a on LCD, 2nd row, 1st column
Lcd_Chr(2, 14, 'V');
end.
Re: LCD initialization for 16F88
Why ANSEL? I use the LCD on RB .
I expect that you listen to the advice if you are already asking for it.
PORTB can be analog too, in order to use LCD, you have to make it digital. Datasheet is your friend.
It really costs you nothing to try it out. Just put ANSEL := 0; then compile+program.
Btw, you can still use ADC, but on other pins, not on those which are reserved for LCD.
-
- Posts: 58
- Joined: 16 Nov 2007 16:57
-
- Posts: 58
- Joined: 16 Nov 2007 16:57
-
- Posts: 58
- Joined: 16 Nov 2007 16:57
Re: LCD initialization for 16F88
This might be old news for you, but I took your advice, and it pulled me through the last step to get my scrolling data to come across my 2x16 display. I didn't do this on the development board I have, I find that it is all is too much to wrap my head around for a beginner, so it was put together on a breadboard with the 16F88, and the same display that the Picpro7 board has, only I paid $2.xx each to get then shipped from China via Ebay. I didn't want to risk ruining the parts on the development board dues to inexperience.
The other advice to read the application notes is exactly how I like to go, but this one step got past me, so I am happy to find it here in your reply. Thanks Joe
The other advice to read the application notes is exactly how I like to go, but this one step got past me, so I am happy to find it here in your reply. Thanks Joe
zristic wrote:Why ANSEL? I use the LCD on RB .
I expect that you listen to the advice if you are already asking for it.
PORTB can be analog too, in order to use LCD, you have to make it digital. Datasheet is your friend.
It really costs you nothing to try it out. Just put ANSEL := 0; then compile+program.
Btw, you can still use ADC, but on other pins, not on those which are reserved for LCD.