#define F_CPU 16000000UL
#include <avr/io.h>
#include <util/delay.h>
void LCD_wr_string(char *lcd_str)
{
while (*lcd_str != '\0') //해당 문자열의 널을 만날때까지
{
LCD_wr_data(*lcd_str); //해당문자열 찍음
lcd_str++;//다음포인터로 이동
}
UDR0 = 0xd;
UDR0 = 0xa;
}
void LCD_wr_data(char data)
{
UDR0 = data;
_delay_ms(2);
}
int main(void)
{
/* Status Register 0A */
UCSR0A = 0x00;
/* Status Register 0B */
/* RX/TX Enable = 10011000 */
UCSR0B = 0x98;
/* Status Register 0C */
/* No parity, 8bit = 0110 */
UCSR0C = 0x06;
/* 중요 : Baud Rate 설정 */
/* BPS = 9600 */
UBRR0H = 0;
UBRR0L = 103;
while(1)
{
LCD_wr_string("hello world");
_delay_ms(1000);
}
}