Hasan Malik
Junior Member level 1
HI
I m having a problem while displaying on 16x2 LCD
the words or digits when displayed on the LCD every time take tab
my pin configrations of LCD are
PIN #
1 >>> VSS
2 >>> VDD
3 >>> V0
4 >>> RB4
5 >>> Ground
6 >>> RB5
7-10 >>> Ground
11 >>> RB0
12 >>> RB1
13 >>> RB2
14 >>> RB3
And my code is
// Lcd pinout settings
sbit LCD_RS at RB4_bit;
sbit LCD_EN at RB5_bit;
sbit LCD_D7 at RB3_bit;
sbit LCD_D6 at RB2_bit;
sbit LCD_D5 at RB1_bit;
sbit LCD_D4 at RB0_bit;
// Pin direction
sbit LCD_RS_Direction at TRISB4_bit;
sbit LCD_EN_Direction at TRISB5_bit;
sbit LCD_D7_Direction at TRISB3_bit;
sbit LCD_D6_Direction at TRISB2_bit;
sbit LCD_D5_Direction at TRISB1_bit;
sbit LCD_D4_Direction at TRISB0_bit;
unsigned long temp_res; int txt[10]; unsigned int a; unsigned int tt[4];
void main() {
Lcd_Init();
Lcd_Cmd(_LCD_CURSOR_OFF); temp_res=0;
do {
temp_res = ADC_Read(2); // Get 10-bit results of AD conversion
delay_ms(50);
a=temp_res;
a=a/2; // Send 2 most significant bits to RC1, RC0
IntToStr(a, tt);
LCD_out(1,1,tt) ;
Lcd_Out_Cp("°C");
LCD_out(2,1,"TEMP SENSOR");
delay_ms(100);
} while(1);
}
I m having a problem while displaying on 16x2 LCD
the words or digits when displayed on the LCD every time take tab
my pin configrations of LCD are
PIN #
1 >>> VSS
2 >>> VDD
3 >>> V0
4 >>> RB4
5 >>> Ground
6 >>> RB5
7-10 >>> Ground
11 >>> RB0
12 >>> RB1
13 >>> RB2
14 >>> RB3
And my code is
// Lcd pinout settings
sbit LCD_RS at RB4_bit;
sbit LCD_EN at RB5_bit;
sbit LCD_D7 at RB3_bit;
sbit LCD_D6 at RB2_bit;
sbit LCD_D5 at RB1_bit;
sbit LCD_D4 at RB0_bit;
// Pin direction
sbit LCD_RS_Direction at TRISB4_bit;
sbit LCD_EN_Direction at TRISB5_bit;
sbit LCD_D7_Direction at TRISB3_bit;
sbit LCD_D6_Direction at TRISB2_bit;
sbit LCD_D5_Direction at TRISB1_bit;
sbit LCD_D4_Direction at TRISB0_bit;
unsigned long temp_res; int txt[10]; unsigned int a; unsigned int tt[4];
void main() {
Lcd_Init();
Lcd_Cmd(_LCD_CURSOR_OFF); temp_res=0;
do {
temp_res = ADC_Read(2); // Get 10-bit results of AD conversion
delay_ms(50);
a=temp_res;
a=a/2; // Send 2 most significant bits to RC1, RC0
IntToStr(a, tt);
LCD_out(1,1,tt) ;
Lcd_Out_Cp("°C");
LCD_out(2,1,"TEMP SENSOR");
delay_ms(100);
} while(1);
}