2004-06-03 07:14 AM
2004-06-01 02:57 AM
Hi,
wanna use XASC. can receive but can't send. any idea ? Problem found, wrong bit in XS1PORT was set, must be = 0x0018 tom. here is my code : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> volatile int test = 0; volatile char c; void main (void) { char u = 0; XS1CON = 0x8011; XS1BG = 0x20; /* 19.2 kbaud @ 20 mhz */ P8 |= 0x0080; // set P8.7 output latch (TXD1) DP8 |= 0x0080; // set P8.7 direction control (TXD1 output) XS1PORT = 0x0014; /* see above */ while (1) { test++; if (test == 0) /* just a small delay */ { c = S1RBUF; XS1TBUF = u++; } } } [ This message was edited by: tktronic on 02-06-2004 09:31 ]2004-06-03 07:14 AM
Hello,
-You should configure Transmit & Receive Interrupts - Check the XS1BG register value because to transmit at 19200 Bauds @ 20 Mhz, you must put 0x1Fh if S1BRS=0 or 0x14h if S1BRS=1 in this register. (Refer to the datasheet formula). - Check also XS1PORT register because, P7.8 must be configured in output but you had configured it in input (XDP8.7 =0) I hope this will help you. [ This message was edited by: Najoua on 04-06-2004 11:53 ]