View previous topic :: View next topic |
Author |
Message |
webgiorgio
Joined: 02 Oct 2009 Posts: 123 Location: Denmark
|
lcd flicker |
Posted: Sat Oct 31, 2009 9:55 am |
|
|
hi,
I'm using a 16F88 a 2*16 LCD, and flex_lcd.c routine.
I would like to write two voltages (coming from A/D input) like this:
Code: |
-------------------------
|volt0=0.15 |
|volt1=3.58 |
-------------------------
|
Each second I do the ADC and LCD update with the following code:
printf(lcd_putc, "\fvolt0=%1.2f \nvolt1=%1.2f", volts, volts1);
The problem is that before write the new value the LCD is empty for a very short time, but you can see something like flicker.
This is worst for the 2nd line, because it stay off more time (due write time for the 1st line) than the 1st line.
How can I do? |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Sat Oct 31, 2009 9:59 am |
|
|
Surely not perform a clear command, only overwrite the changed display part. |
|
|
webgiorgio
Joined: 02 Oct 2009 Posts: 123 Location: Denmark
|
|
Posted: Sat Oct 31, 2009 10:23 am |
|
|
yes! thanks, it works!
Here is my code, can be usefull to someone.
Code: | if (clock) {
numero++;
set_adc_channel(0);
delay_us(10);
adc_value0 = read_adc();
set_adc_channel(1);
delay_us(10);
adc_value1 = read_adc();
volts = (float)(adc_value0)*5/1023;
volts1 = (float)(adc_value1)*5/1023;
lcd_gotoxy(7,1);
printf(lcd_putc, "%1.2f", volts);
lcd_gotoxy(7,2);
printf(lcd_putc, "%1.2f", volts1);
lcd_gotoxy(12,1);
printf(lcd_putc, "%lu", numero);
clock=0;
} |
|
|
|
webgiorgio
Joined: 02 Oct 2009 Posts: 123 Location: Denmark
|
|
Posted: Sat Oct 31, 2009 10:38 am |
|
|
Another question:
Suppose to decrease a variable (int16 numero) starting from 110 and write the value on the lcd, overwriting the changed display part, doing
Code: |
lcd_gotoxy(12,1);
printf(lcd_putc, "%lu", numero);
|
I will get:
110
109
108
107
106
105
101
100
990
980
970
960
....
...
...
110
100
900
800
700
.... |
|
|
Ttelmah Guest
|
|
Posted: Sat Oct 31, 2009 11:11 am |
|
|
Put some spaces after the number.
Best Wishes |
|
|
|