74
SPI_Uart_WriteByte(LCR, 0xBF); // access EFR register
SPI_Uart_WriteByte(EFR, SPI_Uart_config.Flow); // enable
enhanced registers
SPI_Uart_WriteByte(LCR, SPI_Uart_config.DataFormat); // 8
data bit, 1 stop bit, no parity
SPI_Uart_WriteByte(FCR, 0x06); // reset TXFIFO, reset
RXFIFO, non FIFO mode
SPI_Uart_WriteByte(FCR, 0x01); // enable FIFO mode
// Perform read/write test to check if UART is working
SPI_Uart_WriteByte(SPR,'H');
data = SPI_Uart_ReadByte(SPR);
if(data == 'H'){
return 1;
}
else{
return 0;
}
}
void SPI_Uart_WriteByte(char address, char data)
// Write <data> to SC16IS750 register at <address>
{
long int length;
char senddata[2];
senddata[0] = address;
senddata[1] = data;
select();
length = SPI_Write(senddata, 2);
deselect();
Comentarios a estos manuales