37 #define CONFIG_STX() CONFIG_RB2_AS_DIG_OUTPUT()
38 #define STX _LATB2 //STX state
39 #define CONFIG_SRX() CONFIG_RB3_AS_DIG_INPUT()
40 #define SRX _RB3 //SRX state
41 #define DEFAULT_SOFT_BAUDRATE 19200
42 uint16_t u16_softBaudRate = DEFAULT_SOFT_BAUDRATE;
44 void doBitDelay (
uint16_t u16_baudRate) {
45 if (u16_baudRate == 9600) {
47 }
else if (u16_baudRate == 19200)
DELAY_US(52);
50 void doBitHalfDelay (
uint16_t u16_baudRate) {
51 if (u16_baudRate == 9600) {
53 }
else if (u16_baudRate == 19200)
DELAY_US(26);
56 void outCharSoft(
uint8_t u8_c) {
59 doBitDelay(u16_softBaudRate);
60 for (u8_i=0; u8_i<8; u8_i++) {
64 doBitDelay(u16_softBaudRate);
68 doBitDelay(u16_softBaudRate);
76 doBitHalfDelay(u16_softBaudRate);
77 for (u8_i=0; u8_i<8; u8_i++) {
78 doBitDelay(u16_softBaudRate);
79 if (SRX) u8_c = u8_c | 0x80;
80 if (u8_i != 7) u8_c = u8_c >> 1;
82 doBitDelay(u16_softBaudRate);