Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Scrolling with Multiple values in 2nd Line of LCD

Status
Not open for further replies.

ananthashayanams

Junior Member level 2
Junior Member level 2
Joined
Jul 21, 2007
Messages
20
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,455
Hi,

I have an issue with displaying multiple values on the 2nd line of 16x2 LCD. There are 4 channels of ADC which I am using to read the values & display it on LCD. The reading from the ADC is fine, but displaying it in a scroll manner only on the 2nd line is an issue. My first Line is also scrolling.



This is the code i wrote to print the ADC value on the LCD, but sometimes values mix up between 1st & 2nd line, 2 values get overwritten on the same location. Can anybody suggest which is the best way to write multiple values only in the 2nd line which is going back to back.

Code:
void main() {
...
pic_init();
lcd_init();
...
lcd_putc(" GUI SYSTEM \n")

while(1) {
  ...
   current = average_ad(AMP_CHAN)/40.885;             		
   printf(lcd_putc," Solar Current=%6.2fA\n\r",current);

   voltage = average_ad(VOLT_CHAN)/18.2887;          	
   lcd_gotoxy(22,2);
   printf(lcd_putc," Solar Voltage=%6.2fV\n\r",voltage);

}
 

Jayanth,

Yes, my compiler is CCS

I am using lcd_gotoxy() for moving between the lines. The first line would always display "GUI SYSTEM", while in the 2nd line I need to display 4 different values in a scrolling manner namely

a. Solar Voltage
b. Solar Current
c. Battery Voltage
d. Battery Current

As the 16x2 JHD controller is only 40 characters wide, how can we over come this situation ? I tried with only 2 values of Solar Voltage & Solar Current with the help of lcd_gotoxy(), it works fine but when the 3rd value needs to be displayed, the display is all wrong,
 

You can't display all 4 values on one line. The width will not be sufficient. I don't use CCS C. You have to use LCD left shift or right shift command to make string scroll. Try to concat all the four values and then display it and shift. If that doesn't work then you have to shift the characters of the string. Actually LCD left/right shift shifts both lines at the same time. So, you need to shift the contents of the string variable or character array.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top