lindodv
Junior Member level 1
- Joined
- Jul 4, 2014
- Messages
- 16
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 121
Hi, I wanted to write "Hello" on the LCD, so I used PIC18Fxx8 (like pic18f248) and this code:
(5V regulated supply for PIC and LCD on the hardware)
it also worked on the real hardware, but I wanted to change PIC with PIC18F26K20, I used 3.3 for programming and I used 5V supply for LCD and 3V for PIC with command ground(I also used this voltage for PIC18Fxx8 and it worked), and I used PICkit2, and I just change(ADCON1 with ANSEL,H, in the code). but on the real hardware, LCD is Blank and Nothing was shown(only black squares in the first row). It is possible to program 18FxxKxx with PICkit2, isn't it? I don't know what to do for solving this issue. I also replaced the PIC with a newer one,but The problem is not resolved.
(5V regulated supply for PIC and LCD on the hardware)
Code:
sbit LCD_RS at LATB2_bit;
sbit LCD_EN at LATB3_bit;
sbit LCD_D4 at LATB4_bit;
sbit LCD_D5 at LATB5_bit;
sbit LCD_D6 at LATB6_bit;
sbit LCD_D7 at LATB7_bit;
sbit LCD_RS_Direction at TRISB2_bit;
sbit LCD_EN_Direction at TRISB3_bit;
sbit LCD_D4_Direction at TRISB4_bit;
sbit LCD_D5_Direction at TRISB5_bit;
sbit LCD_D6_Direction at TRISB6_bit;
sbit LCD_D7_Direction at TRISB7_bit;
// End LCD module connections
char i;
void main() {
TRISB = 0;
ADCON1 = 0x07;
Lcd_Init(); // LCD display initialization
Lcd_Cmd(_LCD_CURSOR_OFF); // LCD command (cursor off)
Lcd_Cmd(_LCD_CLEAR); // LCD command (clear LCD)
LCD_OUT(1 ,1 ,"HELLO");
}
it also worked on the real hardware, but I wanted to change PIC with PIC18F26K20, I used 3.3 for programming and I used 5V supply for LCD and 3V for PIC with command ground(I also used this voltage for PIC18Fxx8 and it worked), and I used PICkit2, and I just change(ADCON1 with ANSEL,H, in the code). but on the real hardware, LCD is Blank and Nothing was shown(only black squares in the first row). It is possible to program 18FxxKxx with PICkit2, isn't it? I don't know what to do for solving this issue. I also replaced the PIC with a newer one,but The problem is not resolved.