#ifndef __FX2_USART_H__ #define __FX2_USART_H__ typedef enum _usart_cfg { // ----------------------------------------------------- // 11 bit total length configuraations // ----------------------------------------------------- uc8n2, // 8 data bit no parity 2 stop bit uc8e1, // 8 data bit even parity 1 stop bit uc8o1, // 8 data bit odd parity 1 stop bit // ----------------------------------------------------- // 10 bit total length configuraations // ----------------------------------------------------- uc8n1, // 8 data bit no parity 1 stop } usart_cfg; // USART error codes // ----------------------------------------------------------------------------- #define USART_OK 0x00 #define USART_ERROR 0x80 #define USART_ABORT 0xFF // I2C state machine states // ----------------------------------------------------------------------------- #define USART_IDLE 0x00 #define USART_SENDING 0x01 #define USART_RECEIVING 0x02 //#define I2C_PRIME 0x03 //#define I2C_BERROR 0x04 //#define I2C_NACK 0x05 //#define I2C_STOP 0x06 //#define I2C_WAITSTOP 0x07 void fx2_usart_init( unsigned int baud, usart_cfg cfg); BYTE fx2_usart_send( BYTE length, BYTE xdata *dat, BYTE xdata *pause); #endif