cancel
Showing results for 
Search instead for 
Did you mean: 

st10f276 Xasc sending prob.

tom7
Associate II
Posted on June 03, 2004 at 16:14

st10f276 Xasc sending prob.

2 REPLIES 2
tom7
Associate II
Posted on June 01, 2004 at 11:57

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 ]
najoua
Associate II
Posted on June 03, 2004 at 16:14

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 ]