SparkFun Forums 

Where electronics enthusiasts find answers.

Your source for all things Atmel.
By gfb
#72662
I have a small program that outputs digits to my 2x16 LCD (SerLCD backed) and updates the numbers as time goes by. Unfortunately I cant seem to figure out how to make it clear the previous digits in between writes...

e.g.

lcd.at(1,1,"123");
OUTPUT:"123 "

lcd.at(1,1,"1");
OUTPUT:"123 "

The I was hoping that the second output would be "1" and the old "23" would have gone away...

If I add a clear or output spaces in there then my lcd flickers quite a bit as it is only effectively on for half the time.

Help? :)
By golden_powder
#73048
hi, I'm trying to get sparkfun's serLCD to work with my ATmega8. I'm using AVR studio and PonyProg to write and upload code. So far all that's been displayed are these weird characters (kinda hard to describe, like a cross between a lower case i and l, wish I could upload a picture). Anyway, what code are you using to get it to write properly? I'll post my code, maybe someone can see what's wrong?
Code: Select all
#include <avr/io.h>

#define FOSC 8000000// Clock Speed
#define BAUD 9600
#define MYUBRR FOSC/16/BAUD-1

void USART_Init( unsigned int ubrr)
{
/* Set baud rate */
UBRRH = (unsigned char)(ubrr>>8);
UBRRL = (unsigned char)ubrr;
/* Enable receiver and transmitter */
UCSRB = (1<<RXEN)|(1<<TXEN);
/* Set frame format: 8data, 2stop bit */
UCSRC = (1<<URSEL)|(1<<USBS)|(3<<UCSZ0);
}

void USART_Transmit( unsigned char data )
{
/* Wait for empty transmit buffer */
while ( !( UCSRA & (1<<UDRE)) )
;
/* Put data into buffer, sends the data */
UDR = data;
}

int main(void)
{
unsigned char sndchr,cmd;
cmd = 0x7c;
sndchr = 0x01;
USART_Init(MYUBRR);
USART_Transmit(cmd);
USART_Transmit(sndchr);
USART_Transmit('h');
USART_Transmit('e');
USART_Transmit('l');
USART_Transmit('l');
USART_Transmit('o');

	return 0;
}