kishore680
Member level 5
- Joined
- Mar 14, 2012
- Messages
- 81
- Helped
- 3
- Reputation
- 6
- Reaction score
- 4
- Trophy points
- 1,298
- Location
- Bangalore
- Activity points
- 1,833
s = serial('COM4','BaudRate',9600);
fopen(s);
fprintf(s,'A');
#include<reg51.h>
void sertex(unsigned char);
void main(void)
{ unsigned char z;
TMOD=0x20;
TH1=0xFD;
SCON=0x50;
TR1=1;
while(1)
{
while(RI==0);
z=SBUF;
P1=z;
RI=0;
}
}
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 void Tx_Char(unsigned char Data) { SBUF=Data; //SEND CHARACTER TO SERIAL BUFFER while(!TI); //WAIT HERE TILL THE TRANSMIT INTERRUPT FLAG GOES TO //HIGH TI=0; //CLEAR TRANSMIT INTERRUPT FLAG } unsigned char Rx_Char() { while(!RI); //WAITING FOR CHARACTER RI=0; //CLEAR RECEIVE INTERRUPT FLAG return SBUF; //RETURN DATA }
#include<reg51.h>
void Tx_Char(unsigned char);
void main(void)
{ unsigned char z;
TMOD=0x20;
TH1=0xFD;
SCON=0x50;
TR1=1;
while(1)
{
while(RI==0)
z=SBUF;
Tx_Char(z);
RI=0;
}
}
void Tx_Char(unsigned char c)
{SBUF=c;
while(TI==0);
TI=0;
}
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?