cancel
Showing results for 
Search instead for 
Did you mean: 

Problem xasc

kerzingereric
Associate
Posted on November 07, 2007 at 06:03

Problem xasc

1 REPLY 1
kerzingereric
Associate
Posted on November 07, 2007 at 06:03

Hallo,

I want to use the serial interface and i had used the code below (I use Tasking)but it did not work. can someone please help me.

(XPEN, XASCEN, XMISCEN are set in the startup code)

#include

#include

/*********************************************/

void xasc_init( void)

{

/* xasc interface in 8-bit mode, with no parity, no erroir checking , receiver enable */

XS1CON = 0x0011;

/* XS1BG Fcpu = 40000000, SOBRS = 0*/

XS1BG = 0x81;

/* xasc buffer transmit interrupt configuration */

XIR2SEL =0x2000;

XP2IC = 0x0040 | ( 0x0005 << 2) | (0x0001);

/* set port pins P8.7 -> Tx, P8.6 Rx */

XS1PORT |= 0x0010;

_nop();

XS1PORT |= 0x0008;

/* xasc interface enable */

XS1CONSET = 0x8000;

}

/**************************************/

interrupt( 0x42) void xasc_transmit(void)

{

static unsigned char index=0;

static unsigned char Message[5] = ''Hello'';

XIR2CLR = 0x0020;

XS1TBUF = Message[index];

index++;

if( index == 5 ) index = 0;

}

main()

{

xasc_init();

/* trigger the first transmission by setting the flag XIR1SEL*/

XIR2SET = 0x0020;

XP2IR = 1;

while(1);

}

[ This message was edited by: kerzingereric on 07-11-2007 10:46 ]