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
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
//register location // power-up value 

#byte PCL = 0xFF9 
#byte FSR0H = 0xFEA // 0x00 
#byte FSR0L = 0xFE9 // 0x00 

#byte INTCON = 0xFF2 // 0x00 
#byte INTCON2= 0xFF1 // 0xF5 
#byte INTCON3= 0xFF0 // 0xC0 
#byte FSR0H = 0xFEA // 0x00 

#byte STATUS = 0xFD8 // 0x00 

#byte TMR0H = 0xFD7 // 0x00 
#byte TMR0L = 0xFD6 // 0x00 
#byte T0CON = 0xFD5 // 0xFF 

#byte TMR1H = 0xFCF // 0x00 
#byte TMR1L = 0xFCE // 0x00 
#byte T1CON = 0xFCD // 0x00 

#byte TMR2 = 0xFCC // 0x00 
#byte PR2 = 0xFCB // 0xff 
#byte T2CON = 0xFCA // 0x00 

#byte SSPADD = 0xFC8 // 0x00 
#byte SSPSTAT= 0xFC7 // 0x00 

#byte SSPCON1= 0xFC6 // 0x00 
#byte SSPCON2= 0xFC5 // 0x00 

#byte TMR3H = 0xFB3 // 0x00 
#byte TMR3L = 0xFB2 // 0x00 
#byte T3CON = 0xFB1 // 0x00 

#byte SPBRG = 0xFAF // 0x00 
#byte RCREG = 0xFAE // 0x00 
#byte TXREG = 0xFAD // 0x00 
#byte TXSTA = 0xFAC // 0x02 
#byte RCSTA = 0xFAB // 0x00 

#byte PIR2 = 0xFA1 // 0x00 
#byte PIR1 = 0xF9E // 0x00 
#byte PIE1 = 0xF9D // 0x00 

#byte TRISC = 0xF94 // 0xff 
#byte TRISB = 0xF93 // 0xff 
#byte TRISA = 0xF92 // 0x3f 

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

#byte SPBRG2 = 0xF6F 
#byte RCREG2 = 0xF6E 
#byte TXREG2 = 0xF6D 
#byte TXSTA2 = 0xF6C 
#byte RCSTA2 = 0xF6B 

#byte IPR1 = 0xF9F //Interrupt Priority Register 

#byte ADCON0 = 0xFC2
#byte ADCON1 = 0xFC1

#byte BAUDCON = 0xFB8 

//
//Important Register Bits
//

//Interrupt Enable and Priority Bits 
#bit GIE = INTCON.7 // global interrupt enable 
#bit PIE = INTCON.6 // periperial interrupt enable

 
#bit RCIE = PIE1.5 // USART receive interrupt 
#bit TXIE = PIE1.4 // USART transmit interrupt 

 
#bit TXIP = IPR1.4 // Transmit Interrupt Priority Bit 
#bit RCIP = IPR1.5 // Receive Interrupt Priority Bit


// Important USART Bits 
#bit SPEN = RCSTA.7 // serial port enable 
#bit SREN = RCSTA.5 // single receive enable 
#bit CREN = RCSTA.4 // continuous receive enable 
#bit ADDEN = RCSTA.3 // address detection 
#bit OERR = RCSTA.1 //overrun error bit
 
#bit TRMT = TXSTA.1 // Transmit Shift Status Register Bit
#bit BRGH = TXSTA.2 // High Baud Rate Select Bit
#bit TXEN = TXSTA.5 // Transmit Enable Bit

#bit RCIF = PIR1.5 // Receive Interrupt Flag
#bit TXIF = PIR1.4 // Transmit Interrupt Flag

#bit RCIDL = BAUDCON.6 //Receive Idle Status 


#bit RCON_IPEN = 0xFD0.7