starday
Junior Member level 1
Hi paulfjujo
Pardon me for my ignorance on the ADC.
i have the following code for writing to the LCD as below:
I understand it has to be sent in a byte to the LCD for display and my ADC values has to be in ASCII code.
Hence my coding below to send out the ASCII code for display
Unfortunately, my LCD is not displaying anything so i suspect my coding somewhere is wrong but i cant pinpoint where is the mistake.
I understand it is tedious but are you able to help me look through for errors ?
Thank you very much.
Pardon me for my ignorance on the ADC.
i have the following code for writing to the LCD as below:
Code:
/* Write text data in term of 4-bit at a time to LCD */
void W_data_4bit (char x)
{
LCD_RW = 0; // Logic ‘0’
LCD_RS = 1; // Logic ‘1’
LCD_TEMP = x; // Store text data
LCD_TEMP >>= 4; // Send upper nibble of text data
LCD_E = 1; // Logic ‘1’
LCD_DATA = LCD_TEMP;
Delay1KTCYx(1); // 1ms delay
LCD_E = 0; // Logic ‘0’
Delay1KTCYx(1); // 1ms delay
LCD_TEMP = x; // Store text data
LCD_TEMP &= 0x0f; // Send lower nibble of text data
LCD_E = 1; // Logic ‘1’
LCD_DATA = LCD_TEMP;
Delay1KTCYx(1); // 1ms delay
LCD_E = 0; // Logic ‘0’
Delay1KTCYx(1); // 1ms delay
}
I understand it has to be sent in a byte to the LCD for display and my ADC values has to be in ASCII code.
Hence my coding below to send out the ASCII code for display
Code:
itoa(t,Buffer); // Convert number in variable t to a string and store in variable Buffer
for (i = 0; i < 4; i++)
{
W_data_4bit(Buffer[i]);
}
Unfortunately, my LCD is not displaying anything so i suspect my coding somewhere is wrong but i cant pinpoint where is the mistake.
I understand it is tedious but are you able to help me look through for errors ?
Thank you very much.
Last edited: