Intel 386 Manual do Utilizador Página 323

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 691
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 322
Intel386™ EX EMBEDDED MICROPROCESSOR USERS MANUAL
11-36
#define SIO_0 0
#define LENGTH 32
char String_Read[LENGTH];
int error;
error = SerialReadStr (SIO_0,
String_Read,
LENGTH);
Real/Protected Mode
No changes required.
*****************************************************************************/
int SerialReadStr(int Unit, char far *str, int count)
{
WORD ReceivePortAddr;
WORD StatusPortAddr;
BYTE Status;
int i;
/* Set Port base, based on serial port used */
ReceivePortAddr = (Unit ? RBR1 : RBR0);
StatusPortAddr = (Unit ? LSR1 : LSR0);
for(i=0; i < count-1; i++)
{
// Status register is cleared after read, so we must save
// it’s value when read
while(!((Status=_GetEXRegByte(StatusPortAddr)) & SIO_RX_BUF_FULL))
if( Status & SIO_ERROR_BITS ) /* Error Bit set then return NULL */
{
str[i+1] = ‘\0’;
return Status & SIO_ERROR_BITS;
}
str[i] = _GetEXRegByte(ReceivePortAddr);
}
str[i] = ‘\0’;
return E_OK;
}/* SerialReadStr */
/*****************************************************************************
SerialReadChar:
Description:
Is a Polled serial port read function that waits forever or
Vista de página 322
1 2 ... 318 319 320 321 322 323 324 325 326 327 328 ... 690 691

Comentários a estes Manuais

Sem comentários