hi,
I am trying to implement a second UART on 89C52 by looking at atmel
application note no. ANM 055.
On a simulator I see the P3.4 (corresponding to TxD) changing properly but
nothing gets received by a computer. The connections are fine. I am
appending the code below wherein character 'A' is intended to be transmitted
continuously.. I shall be thankful for any help / insight.
#define TxD1 P3_4
#define RxD1 P3_3
#define ST_SPEED 16
bit sr_ready;
bit sr_error;
bit sr_incom;
unsigned char sr_ch;
unsigned char sr_count;
unsigned char sr_status;
unsigned char sr_char;
unsigned char rotate;
unsigned char st_char;
unsigned char st_count;
unsigned char st_status;
void timer1_isr() interrupt 3
{ unsigned char a;
if(!st_status) {TxD1=1; TxD1=0; st_count= ST_SPEED; st_status++; return;}
//send start bit
st_count--; if(st_count!=0) { return;} // time to change the bit?
if(st_status<=8) { a=st_char>>rotate; B=a;TxD1=b_0; st_count=ST_SPEED;
rotate++;st_status++; return;} //send bit
else if (st_status==9){ st_ready=1; TxD1=1; rotate=0; st_count=
ST_SPEED;st_status++;return;} // send stop bit
else if(st_status>9) { st_status=0;return;}
}
void main()
{ rotate=0;
st_char ='A'; st_count=ST_SPEED; st_status=0; TCON=0x40; TMOD=0x20;
TH1=0xe8; SCON=0x52;
PCON=0; ET1=1; EA=1;
while(1){}
}
--
Ulhas Vaidya
Cell No: 098695 74699
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Sdcc-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sdcc-user