1、#include#include#define uint unsigned int #define uchar unsigned char/显示的数组 table的内容const uchar table=“I LIKE AVR“;const uchar table1=“I LOVE.“;void delay(uint ms)uint i,j;for(i=0;ims;i+)for(j=0;j1000;j+);void write_com(uchar com)PORTD PORTD PORTB = com;PORTD |= BIT(6);delay(1);PORTD void write_data
2、(uchar data)PORTD |= BIT(4);PORTD PORTB = data;PORTD |= BIT(6);delay(1);PORTD void main()uint i;DDRB = 0XFF;DDRD |= BIT(4)|BIT(5)|BIT(6);PORTD write_com(0X38);delay(5);write_com(0X01);delay(5);write_com(0X0C);delay(5);write_com(0X06);delay(5);write_com(0X80+0);delay(5);for(i=0;i10;i+)write_data(tabl
3、ei);delay(5);write_com(0X80+0X40);delay(5);for(i=0;i9;i+)write_data(table1i);delay(5);/光标闪烁/*void write_com(uchar com)PORTD PORTD PORTB = com;PORTD |= BIT(6);delay(1);PORTD void write_data(uchar data)PORTD |= BIT(4);PORTD PORTB = data;PORTD |= BIT(6);delay(1);PORTD void main()DDRB = 0XFF;DDRD |= BIT(4)|BIT(5)|BIT(6);PORTD write_com(0X38);delay(5);write_com(0X01);delay(5);write_com(0X0F);delay(5);*/