void Comm_SendByte(uint8 port, uint8 dat) { if (port==0) { while(U0LSR & 0x40==0); U0THR=dat; }
}
void Comm_SendBuf(uint8 port,uint8 *psbuf,uint8 lenth) { uint8 i; if (port==0) { for(i=0;i<lenth;i++) Comm_SendByte(0, *psbuf++); } } int main (void) { COMMMODE set; uint8 rbuf[25]={00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00} set.baud=com0baud; set.len = com0len; set.stopb = com0stopb; set.pari = com0pari; InitCycQueue(&sq); PINSEL0=0x00005505; PINSEL1=0x00000000;
Comm_Init(0,set); VIC_Init(); SPIini(); psbuf=sbuf; rcv=1; IO0DIR=LEDS|SPICS; IO0SET=LEDS; while(1) { if (rcv==1) { Comm_SendBuf(0,rbuf,24); rcv=0 } } return 0; } |