Is this correct UART.....

New to XMOS and XCore? Get started here.
User avatar
In_Control001
Member++
Posts: 20
Joined: Thu Mar 04, 2010 7:27 pm

Is this correct UART.....

Post by In_Control001 »

Hi guys,

I'm started the UART code, caus soon I want to build me own XMOS devboard.
I see here in the 'xcuser docs' that there is an out port assigned to the RX.
Is this correct?

Code: Select all

#include<xs1.h>
#defineBIT_RATE115200
#defineBIT_TIME100000000/BIT_RATE
outportTXD=XS1_PORT_1A;
outportRXD=XS1_PORT_1B;
voidtransmitter(outportTXD){
unsignedbyte,time;
timert;
while(1){
/*getnextbytetotransmit*/
byte=getByte();
t:>time;
/*outputstartbit*/
TXD<:0;
time+=BIT_TIME;
twhentimerafter(time):>void;
/*outputdatabits*/
for(inti=0;i<8;i++){
TXD<:>>byte;
time+=BIT_TIME;
twhentimerafter(time):>void;
}
/*outputstopbit*/
TXD<:1;
time+=BIT_TIME;
twhentimerafter(time):>void;
}
}


richard
Respected Member
Posts: 318
Joined: Tue Dec 15, 2009 12:46 am

Post by richard »

Good spot, RX should be qualified in (or be unqualified). I've filed a bug so that this can be fixed in the next release of the document.