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;
}
}