|
|
View previous topic :: View next topic |
Author |
Message |
agompert
Joined: 14 Jan 2008 Posts: 5
|
Unwanted scrolling on a 1X16LCD |
Posted: Tue Jan 22, 2008 3:14 pm |
|
|
I was wondering if someone can tell me how to stop scrolling on a LCD display. I've tried different format strings. but I must not be getting the right format. If a person can tie the string to the beginning 1 pos. it might work like a carriage return or something.
Code: | #include "C:\counter\main.h"
#include <LCD.C>
#include <float.h>
#include <math.h>
void main()
{
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_OFF);
setup_spi(SPI_SS_DISABLED);
setup_timer_0(RTCC_EXT_L_TO_H|RTCC_DIV_1);
setup_timer_1(T1_EXTERNAL|T1_DIV_BY_1);
setup_timer_2(T2_DISABLED,0,1);
lcd_init();
// TODO: USER CODE!!
set_timer0(0);
set_timer1(0);
while (1)
{
int16 count;
count=get_timer1();
printf(lcd_putc, "Count=%Lu", count);
delay_ms(50);
}
} |
|
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Jan 22, 2008 3:32 pm |
|
|
You don't mean vertical scrolling. You mean that the cursor is placed
at the end of a string after you display it on the LCD. You want a way
to put the cursor back to the first column in the LCD. There are two
ways to do this:
You can clear the screen by putting a \f in front of the text:
Quote: | printf(lcd_putc, "\fCount=%Lu", count); |
However, this may cause flicker if you update the screen too rapidly.
You can also do it by resetting the cursor to 1,1 after each line is written.
Code: |
lcd_gotoxy(1, 1);
printf(lcd_putc, "Count=%Lu ", count);
|
However, the %Lu will display only the required number of digits,
such as 1, 12, 345, 6789, or 15000, for example. Therefore, you
should put 4 blank spaces after the %Lu, to overwrite any remaining
digits. For example, if you displayed 15000 and then next number
to be displayed is "2", then you must erase the "5000" digits.
You can do this by adding four blank spaces after the "%Lu", as
shown in the code above. |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|