MCB251 Evaluation Board User’s Guide
47
/*-----------------------------------------------
This function performs a general initialization of
the external UART on the MCB251.
-----------------------------------------------*/
void extsio_setup (
unsigned long baudrate)
{
unsigned char dummy;
extsio_baudrate (baudrate);
*EXTSIO_LCR = 0x03;
/* 8-bit, 1 stop, no parity */
*EXTSIO_IER = 0x00;
/* disable all interrupts */
*EXTSIO_MCR = 0x00;
dummy = *EXTSIO_LSR;
dummy = *EXTSIO_MSR;
dummy = *EXTSIO_RBR;
}
/*-----------------------------------------------
Send a character out the external UART.
-----------------------------------------------*/
void extsio_putchar (
unsigned char c)
{
while ((*EXTSIO_LSR & 0x20) == 0);
*EXTSIO_THR = c;
}
/*-----------------------------------------------
Receive a character from the external UART. If
no characters have been received, -1 is returned.
-----------------------------------------------*/
int extsio_getchar (void)
{
if (*EXTSIO_LSR & 0x01)
return ((unsigned) *EXTSIO_RBR);
return (-1);
}
/*-----------------------------------------------
_getkey replacement for external UART.
-----------------------------------------------*/
char _getkey (void)
{
int c;
while ((c = extsio_getchar ()) == -1);
return (c);
}
Содержание MCB251
Страница 6: ...vi Contents...
Страница 18: ...12 Chapter 2 Setup...
Страница 24: ...18 Chapter 3 Hardware Schematics...
Страница 25: ...MCB251 Evaluation Board User s Guide 19...
Страница 26: ...20 Chapter 3 Hardware...
Страница 27: ...MCB251 Evaluation Board User s Guide 21...
Страница 28: ...22 Chapter 3 Hardware Printed Board Assembly...