SERIAL RECEPTION OF DATA

i did this code #include <REGX51.H>
#include<stdio.h>
#include<string.h>

#define rs P3_5 //pin4
#define rw P0_6 //pin5
#define en P3_4 //pin6

void delay(int);
void lcd_init();
void printlcd(unsigned char *str); void recieve() ; void lcd_display(char a); void lcd_command(char a);
char a;
unsigned int i;
unsigned char dat[12];
void main()
{ P1=0xFF; lcd_init(); printlcd("EMB LAB"); TMOD =0x20; //Timer1 in Mode2. TCON=0x40; TH1=-3; // 9600 Baud rate at 11.0592MH SCON=0x50; // Asynchronous mode 8-bit data and 1-stop bit //IE=0x90; TR1=1;
while(1)
{

while (RI==0); lcd_command(0xC0); ACC=SBUF; lcd_display(ACC); RI=0; delay(100);
} }

/* /// Not used in this unction//////////////////
void lcd_ready()
{ en=0;
P1=0x80;
rs=0; //Control register
rw=1; //Read
wait:
en=0;
en=1;
if(P1_7==1)goto wait;
P1=0x00;
en=0;
} */
/////////////////////////////////////////////////
void lcd_display(char a)
{ //lcd_ready();
delay(100);
P1=a;
rs=1;
rw=0;
en=1;
en=0;
}

void lcd_command(char a)
{ //lcd_ready();
delay(100);
P1=a;
rs=0;
rw=0;
en=1;
en=0;
}

void delay (int temp)
{ int i;
for(i=0; i<=temp;i++);
}

void lcd_init()
{ lcd_command(0x38);/*8 bit/char,2 row of character*/ lcd_command(0x0C);/*Screen and cursor on, no blink*/ lcd_command(0x06);/*shift cursor right*/ lcd_command(0x01); lcd_command(0x80);
} //////////////////////////////////////////////////////
void printlcd(unsigned char *str)
{ unsigned char len,i;

len=strlen(str);

for(i=0;i<=len-1;i++) { lcd_display(*str); str++; }
}

but when i check the ACC and port it did not change according to SBUF but when we change SBUF the SBUF value changes.

Parents Reply Children
No data
More questions in this forum