1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//Headers needed for USART
//#RESERVE  0x051:0x05D // don't use this RAM. See Microchip errata 80161 rev F. --dgi 28jan2005

#byte TXSTA=0xFAC
#bit TXSTAbits_TRMT=0xFAC.1
#bit TXSTAbits_BRGH=0xFAC.2
#bit TXSTAbits_TXEN=0xFAC.5

#byte RCSTA=0xFAB
#bit RCSTAbits_CREN = 0xFAB.4
#bit RCSTAbits_SPEN = 0xFAB.7
#bit RCSTAbits_OERR = 0xFAB.1

#byte PIR1=0xF9E
#bit PIR1bits_RCIF=0xF9E.5
#bit PIR1bits_TXIF=0xF9E.4

#byte RCREG = 0xFAE
#byte TXREG = 0xFAD

#byte SPBRG=0xFAF

#byte PIE1=0xF9D
#bit PIE1bits_TXIE=0xF9D.4
#bit PIE1bits_RCIE=0xF9D.5

#byte TRISC=0xF94
#byte TRISB=0xF93
#byte TRISA=0xF92

#byte PORTC=0xF82
#byte PORTB=0xF81
#byte PORTA=0xF80

#byte INTCON=0xFF2
#bit INTCONbits_GIE=0xFF2.7
#bit INTCONbits_PIE=0xFF2.6

#byte ADCON0 = 0xFC2
#byte ADCON1 = 0xFC1
#bit RCON_IPEN = 0xFD0.7

void initUSART(void);
void txInitiate(uint8 sendByte);
void rxSearch(void);
void txInitiateRec(void);
void rxSearchRec(void);
void initiateUSART(uint8 usart_Mode);
void clearUSARTREC(void);
void selectPort(uint8 myPort);
void nextPort();
void listen(int muxPort);