Microcontroller › 8051 › Problem with serial communication › #include
March 7, 2012 at 4:21 pm
#7277
Julian
Participant
#include <reg51.h>
#include <stdio.h>
#define lcd_port P1
int j;
unsigned char word;
sbit rs = P3^5;
sbit rw = P3^6;
sbit en = P3^7;
sbit BUT_serial = P0^0;
sbit LED_serial = P2^0;
char morning[]={“Gd morning LeeYJ!”};
void delay(unsigned int msec)
{
int i,j ;
for(i=0;i<msec;i++)
for(j=0;j<200;j++);
}
void lcdcmd(unsigned char value)
{
rs = 0;
rw = 0;
lcd_port = value;
en = 1;
delay(1);
en = 0;
}
void lcd_data(unsigned char display)
{
rs = 1;
rw = 0;
lcd_port = display;
en = 1;
delay(1);
en = 0;
}
void shift_left()
{
lcdcmd(0x18);
delay(250);
}
void lcd_mrg()
{
for (j=0; morning[j]!=’