/* ****************SCI1.H******** Jonathan W. Valvano April 17, 2000 RS485 half-duplex multiport network Hardware: Adapt812 MC68HC812A4 SCI1 serial port RS-485 half-duplex network to other Adapt812s 6812 PS3/TXD1 connected to SP483 DI data in 6812 PS2/RXD1 connected to SP483 RO receive out 6812 PE6 connected to SP483 DE 1 enables transmission 6812 PE5 connected to SP483 RE 0 enables receiver SP483 A-A, B-B, ground-ground */ // transmission error codes #define OK 0 #define COLLISION 1 #define TIMEOUT 2 #define PARITYERROR 4 // receiver errors #define OR 0x08 #define NF 0x04 #define FE 0x02 #define PF 0x01 //------------Initialization------------------------------------- void SCI1Init(void); // Initialize 38400 bits/sec //--------------Input/Receive from RS485 channel------------------- char SCI1In(int *); // Reads in a character, gadfly wait // returns by value the ASCII character from the RS485 network // returns by reference, 1-15 for errors, 0 for no error // receiver errors are Bit3=OR, Bit2=NF, Bit1=FE, Bit0=PF int SCI1InStatus(void); // Returns TRUE if a call to SCI1In will return right away //--------------Output/Transmit to RS485 channel------------------- int SCI1Out(char); // Output a character, gadfly wait // returns OK(0), COLLISION(1), TIMEOUT(2) or PARITYERROR(4) int SCI1OutString(char *); // Output a string, gadfly wait // returns OK(0), COLLISION(1), TIMEOUT(2) or PARITYERROR(4)