Intel 386 Manuale Utente Pagina 323

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 691
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 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
Vedere la pagina 322
1 2 ... 318 319 320 321 322 323 324 325 326 327 328 ... 690 691

Commenti su questo manuale

Nessun commento