Uart general help for lpc 1769

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Uart general help for lpc 1769

634 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by karanmehta93 on Wed Nov 07 12:10:39 MST 2012
I am trying to use my own fifo as the internal fifo is not useful for my application. Can you see the code and tell me when the UART0ExtPrintbin function will be called and it is a THRE interrupt handler.

void ExtPrintbin(unsigned short channel,unsigned short variable,unsigned short value){

switch(channel){
//-----------------------------------
case COM0:
switch(variable){
//--------------------------------
case 1:
if((U0LSR & 0x60) ==0x60){
U0THR=value;
}
else{
uart0tx[0] = value;
uart0txdone[0] = 1;
}
break;
//--------------------------------
case 2:
if((U0LSR & 0x60) ==0x60){
U0THR=value;
}
else{
uart0tx[1] = value;
uart0txdone[1] = 1;
}
break;
//--------------------------------
case 3:
if((U0LSR & 0x60) ==0x60){
U0THR=value;
}
else{
uart0tx[2] = value;
uart0txdone[2] = 1;
}
break;
//--------------------------------
case 4:
if((U0LSR & 0x60) ==0x60){
U0THR=value;
}
else{
uart0tx[3] = value;
uart0txdone[3] = 1;
}
break;
//--------------------------------
}
}
void uart0ExtPrintbin(void){

static short txcount = 0;
unsigned short done = 1,count = 0;
while(done && (count < 4)){

if(txcount == 0){

txcount = 1;
count++;
if(uart0txdone[0] == 1){

if( (U0LSR & 0x60) !=0x60 ){
U0THR = uart0tx[0];
uart0txdone[0] = 0;
}
done = 0;
}
}
else if(txcount == 1){

txcount = 2;
count++;
if(uart0txdone[1] == 1){

if( (U0LSR & 0x60) !=0x60 ){
U0THR = uart0tx[1];
uart0txdone[1] = 0;
}
done = 0;
}
}
else if(txcount == 2){

txcount = 3;
count++;
if(uart0txdone[2] == 1){

if( (U0LSR & 0x60) !=0x60 ){
U0THR = uart0tx[2];
uart0txdone[2] = 0;
}
done = 0;
}
}
else if(txcount == 3){

txcount = 0;
count++;
if(uart0txdone[3] == 1){

if( (U0LSR & 0x60) !=0x60 ){
U0THR = uart0tx[3];
uart0txdone[3] = 0;
}
done = 0;
}
}
}
}
Please reply fast......!!!
标签 (1)
0 项奖励
回复
0 回复数