<?xml version="1.0" encoding="utf-8" standalone="no" ?>
<!DOCTYPE codeDefinitions SYSTEM "../codeDefinitions.dtd">
<codeDefinitions>
	<codeBlock>
		<code name="fuses" caption="fuses (DCR) configuration">
			<line comment="B14=JTSAGEN B13=GCP B12=GWRP B11=DEBUG B10=COE B7=FWDTEN B6=WINDIS B4=FWPSA B3:0=WDTPS3:0"></line>
			<line register="CONFIG1" action="WCFG" mask="0xFFFF" comment=""></line>
			<line comment="B15=IESO B10:8=FNOSC2:0 B7:6=FCKSM1:0 B5=OSCIOFCN B1:0=POSCMOD1:0"></line>
			<line register="CONFIG2" action="WCFG" mask="0xFFFF" comment=""></line>
		</code>
		<code name="Interrupts" caption="Disable Interrupts during configuration">
			<line comment="clear int flags:"></line>
			<line comment="B13=AD B12=U1TX B11=U1RX B10=SPI1 B9=SPF1 B8=T3"></line>
			<line comment="B7=T2 B6=OC2 B5=IC2 B3=T1 B2=OC1 B1=IC1 B0=INT0"></line>
			<line register="IFS0" action="W" value="0x0000" mask="0xFFFF" comment=""></line>
			<line comment="B15=U2TX B14=U2RX B13=INT2 B12=T5 B11=T4 B10=OC4 B9=OC3"></line>
			<line comment="B4=INT1 B3=CN B2=CM B1=MI2C1 B0=SI2C1"></line>
			<line register="IFS1" action="W" value="0x0000" mask="0xFFFF" comment=""></line>
			<line comment="B13=PMP B9=OC5 B7=IC5 B6=IC4 B5=IC3"></line>
			<line comment="B1=SPI2 B0=SPF2"></line>
			<line register="IFS2" action="W" value="0x0000" mask="0xFFFF" comment=""></line>
			<line comment="B14=RTCC B6=INT4 B5=INT3 B1=MI2C2 B2=SI2C2"></line>
			<line register="IFS3" action="W" value="0x0000" mask="0xFFFF" comment=""></line>
			<line comment="B3=CRC B2=U2ER B1=U1ER"></line>
			<line register="IFS4" action="W" value="0x0000" mask="0xFFFF" comment=""></line>
			<line register="IEC0" action="W" value="0x0000" mask="0xFFFF" comment=""></line>
			<line register="IEC1" action="W" value="0x0000" mask="0xFFFF" comment=""></line>
			<line register="IEC2" action="W" value="0x0000" mask="0xFFFF" comment=""></line>
			<line register="IEC3" action="W" value="0x0000" mask="0xFFFF" comment=""></line>
			<line register="IEC4" action="W" value="0x0000" mask="0xFFFF" comment=""></line>
		</code>
		<code name="Reset" caption="Reset configuration">
			<line comment="B15=TRAPR B14=IOPWR"></line>
			<line comment="B7=EXTR B6=SWR B5=SWDTEN B4=WDTO B3=SLEEP B2=IDLE B1=BOR B0=POR"></line>
			<line register="RCON" action="WREG" mask="0xFFFF" comment=""></line>
		</code>
		<code name="Oscillator" caption="Oscillator configuration">
		<!-- Code taken from dsPIC - We are interested in only SOSCEN.-->
			<line comment="method to override OSCCON write protect"></line>
			<line comment="B13:12=COSC1:0 B9:8=NOSC1:0"></line>
			<line register="OSCCON" action="LREG.b_H" value="WREG" mask="0x00FF" comment=""></line>
			<line register="W1" action="W.b_H" value="0x78" mask="0x00FF" comment=""></line>
			<line register="W2" action="W.b_H" value="0x9A" mask="0x00FF" comment=""></line>
			<line code="MOV.W #OSCCON, W3" comment=""></line>
			<line code="MOV.B W1, [W3+1]" comment=""></line>
			<line code="MOV.B W2, [W3+1]" comment=""></line>
			<line code="MOV.B W0, [W3+1]" comment=""></line>
			<line comment="B7:6=POST1:0 B5=LOCK B3=CF B1=SOSCEN B0=OSWEN"></line>
			<line register="OSCCON" action="LREG.b_L" value="WREG" mask="0x00FF" comment=""></line>
			<line register="W1" action="W.b_L" value="0x46" mask="0x00FF" comment=""></line>
			<line register="W2" action="W.b_L" value="0x57" mask="0x00FF" comment=""></line>
			<line code="MOV.B W1, [W3+0]" comment=""></line>
			<line code="MOV.B W2, [W3+0]" comment=""></line>
			<line code="MOV.B W0, [W3+0]" comment=""></line>
		</code>
		<code name="A2D" caption="A2D configuration">
			<line register="AD1PCFG" action="W" value="0xFFFF" mask="0xFFFF" comment="force all A2D ports to digital IO at first"></line>
		</code>
		<code name="IOPortA" caption="IO Ports configuration">
			<line comment="B15:0=A15:0"></line>
			<line register="PORTA" action="WREG" mask="0xFFFF" comment="enable"></line>
			<line register="TRISA" action="WREG" mask="0xFFFF" comment="direction in=1"></line>
			<line register="ODCA" action="WREG" mask="0xFFFF" comment="direction in=1"></line>
		</code>
		<code name="IOPortB" caption="IO Ports configuration">
			<line comment="B15:0=B15:0"></line>
			<line register="PORTB" action="WREG" mask="0xFFFF" comment="enable"></line>
			<line register="TRISB" action="WREG" mask="0xFFFF" comment="direction in=1"></line>
			<line register="ODCB" action="WREG" mask="0xFFFF" comment="direction in=1"></line>
		</code>
		<code name="IOPortC" caption="IO Ports configuration">
			<line comment="B15:0=C15:0"></line>
			<line register="PORTC" action="WREG" mask="0xFFFF" comment="enable"></line>
			<line register="TRISC" action="WREG" mask="0xFFFF" comment="direction in=1"></line>
			<line register="ODCC" action="WREG" mask="0xFFFF" comment="direction in=1"></line>
		</code>
		<code name="IOPortD" caption="IO Ports configuration">
			<line comment="B15:0=D15:0"></line>
			<line register="PORTD" action="WREG" mask="0xFFFF" comment="enable"></line>
			<line register="TRISD" action="WREG" mask="0xFFFF" comment="direction in=1"></line>
			<line register="ODCD" action="WREG" mask="0xFFFF" comment="direction in=1"></line>
		</code>
		<code name="IOPortE" caption="IO Ports configuration">
			<line comment="B15:0=D15:0"></line>
			<line register="PORTE" action="WREG" mask="0xFFFF" comment="enable"></line>
			<line register="TRISE" action="WREG" mask="0xFFFF" comment="direction in=1"></line>
			<line register="ODCE" action="WREG" mask="0xFFFF" comment="direction in=1"></line>
		</code>
		<code name="IOPortF" caption="IO Ports configuration">
			<line comment="B15:0=F15:0"></line>
			<line register="PORTF" action="WREG" mask="0xFFFF" comment="enable"></line>
			<line register="TRISF" action="WREG" mask="0xFFFF" comment="direction in=1"></line>
			<line register="ODCF" action="WREG" mask="0xFFFF" comment="direction in=1"></line>
		</code>
		<code name="IOPortG" caption="IO Ports configuration">
			<line comment="B15:0=G15:0"></line>
			<line register="PORTG" action="WREG" mask="0xFFFF" comment="enable"></line>
			<line register="TRISG" action="WREG" mask="0xFFFF" comment="direction in=1"></line>
			<line register="ODCG" action="WREG" mask="0xFFFF" comment="direction in=1"></line>
		</code>
		<code name="CN1" caption="Input Change Notification configuration">
			<line comment="B15:0=CN15:0"></line>
			<line register="CNEN1" action="WREG" mask="0xFFFF" comment="enable change notification"></line>
			<line register="CNPU1" action="WREG" mask="0xFFFF" comment="enable pullup change notification"></line>
			<line comment="B6:0=CN21:16"></line>
			<line register="CNEN2" action="WREG" mask="0x003F" comment="enable change notification"></line>
			<line register="CNPU2" action="WREG" mask="0x003F" comment="enable pullup change notification"></line>
		</code>
		<code name="Timer1" caption="Timers configuration">
			<line register="T1CON" action="W" value="0x0000" mask="0xFFFF" comment="stop timer"></line>
		</code>
		<code name="Timer2" caption="Timers configuration">
			<line register="T2CON" action="W" value="0x0000" mask="0xFFFF" comment="stop timer"></line>
		</code>
		<code name="Timer3" caption="Timers configuration">
			<line register="T3CON" action="W" value="0x0000" mask="0xFFFF" comment="stop timer"></line>
		</code>
		<code name="Timer4" caption="Timers configuration">
			<line register="T4CON" action="W" value="0x0000" mask="0xFFFF" comment="stop timer"></line>
		</code>
		<code name="Timer5" caption="Timers configuration">
			<line register="T5CON" action="W" value="0x0000" mask="0xFFFF" comment="stop timer"></line>
		</code>
		<code name="Timer1" caption="Timers configuration">
			<line register="TMR1" action="WREG" mask="0xFFFF" comment="timer register"></line>
			<line register="PR1" action="WREG" mask="0xFFFF" comment="period register"></line>
		</code>
		<code name="Timer3" caption="Timers configuration">
			<line register="TMR3" action="WREG" mask="0xFFFF" comment="timer register"></line>
			<line register="TMR3HLD" action="WREG" mask="0xFFFF" comment="timer holding register for 32bit"></line>
			<line register="PR3" action="WREG" mask="0xFFFF" comment="period register"></line>
		</code>
		<code name="Timer2" caption="Timers configuration">
			<line register="TMR2" action="WREG" mask="0xFFFF" comment="timer register"></line>
			<line register="PR2" action="WREG" mask="0xFFFF" comment="period register"></line>
		</code>
		<code name="Timer5" caption="Timers configuration">
			<line register="TMR4" action="WREG" mask="0xFFFF" comment="timer register"></line>
			<line register="PR4" action="WREG" mask="0xFFFF" comment="period register"></line>
		</code>
		<code name="Timer4" caption="Timers configuration">
			<line register="TMR5" action="WREG" mask="0xFFFF" comment="timer register"></line>
			<line register="TMR5HLD" action="WREG" mask="0xFFFF" comment="timer holding register for 32bit"></line>
			<line register="PR5" action="WREG" mask="0xFFFF" comment="period register"></line>
		</code>
		<code name="IC1" caption="Input Capture configuration">
			<line comment="B13=ICSDL B7=ICTMR B6:5=ICI1:0 B4=ICOV B3=ICBNE B2:0=ICM2:0"></line>
			<line register="IC1CON" action="WREG" mask="0xFFFF" comment=""></line>
		</code>
		<code name="IC2" caption="Input Capture configuration">
			<line comment="B13=ICSDL B7=ICTMR B6:5=ICI1:0 B4=ICOV B3=ICBNE B2:0=ICM2:0"></line>
			<line register="IC2CON" action="WREG" mask="0xFFFF" comment=""></line>
		</code>
		<code name="IC3" caption="Input Capture configuration">
			<line comment="B13=ICSDL B7=ICTMR B6:5=ICI1:0 B4=ICOV B3=ICBNE B2:0=ICM2:0"></line>
			<line register="IC3CON" action="WREG" mask="0xFFFF" comment=""></line>
		</code>
		<code name="IC4" caption="Input Capture configuration">
			<line comment="B13=ICSDL B7=ICTMR B6:5=ICI1:0 B4=ICOV B3=ICBNE B2:0=ICM2:0"></line>
			<line register="IC4CON" action="WREG" mask="0xFFFF" comment=""></line>
		</code>
		<code name="IC5" caption="Input Capture configuration">
			<line comment="B13=ICSDL B7=ICTMR B6:5=ICI1:0 B4=ICOV B3=ICBNE B2:0=ICM2:0"></line>
			<line register="IC5CON" action="WREG" mask="0xFFFF" comment=""></line>
		</code>
		<code name="OC1" caption="Turn off OC1 thru OC8">
			<line comment="associated timers need to be turned off first"></line>
			<line register="OC1CON" action="W" value="0x0000" mask="0xFFFF" comment=""></line>
		</code>
		<code name="OC2" caption="Turn off OC1 thru OC8">
			<line comment="associated timers need to be turned off first"></line>
			<line register="OC2CON" action="W" value="0x0000" mask="0xFFFF" comment=""></line>
		</code>
		<code name="OC3" caption="Turn off OC1 thru OC8">
			<line comment="associated timers need to be turned off first"></line>
			<line register="OC3CON" action="W" value="0x0000" mask="0xFFFF" comment=""></line>
		</code>
		<code name="OC4" caption="Turn off OC1 thru OC8">
			<line comment="associated timers need to be turned off first"></line>
			<line register="OC4CON" action="W" value="0x0000" mask="0xFFFF" comment=""></line>
		</code>
		<code name="OC5" caption="Turn off OC1 thru OC8">
			<line comment="associated timers need to be turned off first"></line>
			<line register="OC5CON" action="W" value="0x0000" mask="0xFFFF" comment=""></line>
		</code>
		<code name="OC1" caption="Output Compare configuration">
			<line comment="OCnRS:  output compare n secondary register"></line>
			<line comment="OCnR:   output compare 1 main register"></line>
			<line comment="OCnCON: B13=OCSIDL B4=OCFLT B3=OCTSEL B2:0=OCM2:0"></line>
			<line register="OC1RS" action="WREG" mask="0xFFFF" comment=""></line>
			<line register="OC1R" action="WREG" mask="0xFFFF" comment=""></line>
			<line register="OC1CON" action="WREG" mask="0xFFFF" comment=""></line>
		</code>
		<code name="OC2" caption="Output Compare configuration">
			<line comment="OCnRS:  output compare n secondary register"></line>
			<line comment="OCnR:   output compare 1 main register"></line>
			<line comment="OCnCON: B13=OCSIDL B4=OCFLT B3=OCTSEL B2:0=OCM2:0"></line>
			<line register="OC2RS" action="WREG" mask="0xFFFF" comment=""></line>
			<line register="OC2R" action="WREG" mask="0xFFFF" comment=""></line>
			<line register="OC2CON" action="WREG" mask="0xFFFF" comment=""></line>
		</code>
		<code name="OC3" caption="Output Compare configuration">
			<line comment="OCnRS:  output compare n secondary register"></line>
			<line comment="OCnR:   output compare 1 main register"></line>
			<line comment="OCnCON: B13=OCSIDL B4=OCFLT B3=OCTSEL B2:0=OCM2:0"></line>
			<line register="OC3RS" action="WREG" mask="0xFFFF" comment=""></line>
			<line register="OC3R" action="WREG" mask="0xFFFF" comment=""></line>
			<line register="OC3CON" action="WREG" mask="0xFFFF" comment=""></line>
		</code>
		<code name="OC4" caption="Output Compare configuration">
			<line comment="OCnRS:  output compare n secondary register"></line>
			<line comment="OCnR:   output compare 1 main register"></line>
			<line comment="OCnCON: B13=OCSIDL B4=OCFLT B3=OCTSEL B2:0=OCM2:0"></line>
			<line register="OC4RS" action="WREG" mask="0xFFFF" comment=""></line>
			<line register="OC4R" action="WREG" mask="0xFFFF" comment=""></line>
			<line register="OC4CON" action="WREG" mask="0xFFFF" comment=""></line>
		</code>
		<code name="OC5" caption="Output Compare configuration">
			<line comment="OCnRS:  output compare n secondary register"></line>
			<line comment="OCnR:   output compare 1 main register"></line>
			<line comment="OCnCON: B13=OCSIDL B4=OCFLT B3=OCTSEL B2:0=OCM2:0"></line>
			<line register="OC5RS" action="WREG" mask="0xFFFF" comment=""></line>
			<line register="OC5R" action="WREG" mask="0xFFFF" comment=""></line>
			<line register="OC5CON" action="WREG" mask="0xFFFF" comment=""></line>
		</code>
		<code name="SPI1" caption="SPI configuration">
			<line comment="SPInBUF:    SPI n buffer"></line>
			<line comment="SPInSTAT:   B15=SPIEN B13=SPISIDL B10:8=SPIBEC2:0 B6=SPIROV B5=SPITBF B0=SPIRBF"></line>
			<line comment="SPInCON1(H): B12=DISSCK B11=DISSDO B10=MODE16 B9=SMP B8=CKE"></line>
			<line comment="SPInCON1(L): B7=SSEN B6=CKP B5=MSTEN B4:2=SPRE2:0 B1:0=PPRE1:0"></line>
			<line comment="SPInCON2(H): B15=FRMEN B14=SPIFSD B13=SPIFPOL"></line>
			<line comment="SPInCON2(L): B1=SPIFE B0=SPIBEN"></line>
			<line register="SPI1BUF" action="R" mask="0xFFFF" comment=""></line>
			<line register="SPI1STAT" action="WREG" mask="0xFFFF" comment=""></line>
			<line register="SPI1CON1" action="WREG" mask="0xFFFF" comment=""></line>
			<line register="SPI1CON2" action="WREG" mask="0xFFFF" comment=""></line>
		</code>
		<code name="SPI2" caption="SPI configuration">
			<line comment="SPInBUF:    SPI n buffer"></line>
			<line comment="SPInSTAT:   B15=SPIEN B13=SPISIDL B10:8=SPIBEC2:0 B6=SPIROV B5=SPITBF B0=SPIRBF"></line>
			<line comment="SPInCON1(H): B12=DISSCK B11=DISSDO B10=MODE16 B9=SMP B8=CKE"></line>
			<line comment="SPInCON1(L): B7=SSEN B6=CKP B5=MSTEN B4:2=SPRE2:0 B1:0=PPRE1:0"></line>
			<line comment="SPInCON2(H): B15=FRMEN B14=SPIFSD B13=SPIFPOL"></line>
			<line comment="SPInCON2(L): B1=SPIFE B0=SPIBEN"></line>
			<line register="SPI2BUF" action="R" mask="0xFFFF" comment=""></line>
			<line register="SPI2STAT" action="WREG" mask="0xFFFF" comment=""></line>
			<line register="SPI2CON1" action="WREG" mask="0xFFFF" comment=""></line>
			<line register="SPI2CON2" action="WREG" mask="0xFFFF" comment=""></line>
		</code>
		<code name="I2C1" caption="I2C configuration">
			<line comment="B7:0: receive register bits7:0"></line>
			<line register="I2C1RCV" action="R" mask="0x00FF" comment=""></line>
			<line comment="B9:0: address register bits9:0"></line>
			<line register="I2C1ADD" action="WREG" mask="0x03FF" comment=""></line>
			<line comment="B8:0: baud rate generator bits 8:0"></line>
			<line register="I2C1BRG" action="WREG" mask="0x01FF" comment=""></line>
			<line comment="B15=ACKSTAT B14=TRSTAT B10=BCL B9=GCSTAT B8=ADD10"></line>
			<line comment="B7=IWCOL B6=I2COV B5=D_A B4=P B3=S B2=R_W B1=RBF B0=TBF"></line>
			<line register="I2C1STAT" action="WREG" mask="0x01FF" comment=""></line>
			<line comment="B15=I2CEN B13=I2CSIDL B12=SCLREL B11=IPMIEN B10=A10M B9=DISSLW B8=SMEN"></line>
			<line comment="B7=GCEN B6=STREN B5=ACKDT B4=ACKEN B3=RCEN B2=PEN B1=RSEN B0=SEN"></line>
			<line register="I2C1CON" action="WREG" mask="0x01FF" comment=""></line>
		</code>
		<code name="I2C2" caption="I2C configuration">
			<line comment="B7:0: receive register bits7:0"></line>
			<line register="I2C2RCV" action="R" mask="0x00FF" comment=""></line>
			<line comment="B9:0: address register bits9:0"></line>
			<line register="I2C2ADD" action="WREG" mask="0x03FF" comment=""></line>
			<line comment="B8:0: baud rate generator bits 8:0"></line>
			<line register="I2C2BRG" action="WREG" mask="0x01FF" comment=""></line>
			<line comment="B15=ACKSTAT B14=TRSTAT B10=BCL B9=GCSTAT B8=ADD10"></line>
			<line comment="B7=IWCOL B6=I2COV B5=D_A B4=P B3=S B2=R_W B1=RBF B0=TBF"></line>
			<line register="I2C2STAT" action="WREG" mask="0x01FF" comment=""></line>
			<line comment="B15=I2CEN B13=I2CSIDL B12=SCLREL B11=IPMIEN B10=A10M B9=DISSLW B8=SMEN"></line>
			<line comment="B7=GCEN B6=STREN B5=ACKDT B4=ACKEN B3=RCEN B2=PEN B1=RSEN B0=SEN"></line>
			<line register="I2C2CON" action="WREG" mask="0x01FF" comment=""></line>
		</code>
		<code name="UART1" caption="UART 1 configuration">
			<line register="U1BRG" action="WREG" mask="0xFFFF" comment="UART1 baud rate generator"></line>
			<line register="U1MODE" action="W" value="0x8000" mask="0xFFFF" comment="enabling UART flushes buffers"></line>
			<line comment="B15=UTXISEL1 B14=UTXINV B15=UTXISEL0	 B11=UTXBRK B10=UTXEN B9=UTXBF B8=TRMT"></line>
			<line comment="B7:6=URXISEL1:0 B5=ADDEN B4=RIDLE B3=PERR B2=FERR B1=OERR B0=URXDA"></line>
			<line register="U1STA" action="WREG" mask="0xFFFF" comment=""></line>
			<line comment="B15=UARTEN B13=USIDL B12=IREN B11=RTSMD B9:8=UEN1:0"></line>
			<line comment="B7=WAKE B6=LPBACK B5=ABAUD B4=RXINV B5=BRGH B2:1=PDSEL1:0 B0=STSEL"></line>
			<line register="U1MODE" action="WREG" mask="0xFFFF" comment=""></line>
		</code>
		<code name="UART2" caption="UART 2 configuration">
			<line register="U2BRG" action="WREG" mask="0xFFFF" comment="UART1 baud rate generator"></line>
			<line register="U2MODE" action="W" value="0x8000" mask="0xFFFF" comment="enabling UART flushes buffers"></line>
			<line comment="B15=UTXISEL1 B14=UTXINV B15=UTXISEL0	 B11=UTXBRK B10=UTXEN B9=UTXBF B8=TRMT"></line>
			<line comment="B7:6=URXISEL1:0 B5=ADDEN B4=RIDLE B3=PERR B2=FERR B1=OERR B0=URXDA"></line>
			<line register="U2STA" action="WREG" mask="0xFFFF" comment=""></line>
			<line comment="B15=UARTEN B13=USIDL B12=IREN B11=RTSMD B9:8=UEN1:0"></line>
			<line comment="B7=WAKE B6=LPBACK B5=ABAUD B4=RXINV B5=BRGH B2:1=PDSEL1:0 B0=STSEL"></line>
			<line register="U2MODE" action="WREG" mask="0xFFFF" comment=""></line>
		</code>
		<code name="A2D" caption="A2D configuration">
			<line register="AD1CON1" action="W" value="0x0000" mask="0xFFFF" comment="Turn off A2D before setting registers"></line>
			<line comment="B15:0=CSSL15:0"></line>
			<line register="AD1CSSL" action="WREG" mask="0xFFFF" comment=""></line>
			<line comment="B15:14=CH0NB1:0 B11:8=CH0SB3:0"></line>
			<line comment="B7=CH0NA B3:0=CH0SA3:0"></line>
			<line register="AD1CHS" action="WREG" mask="0xFFFF" comment=""></line>
			<line comment="B15:0=PCFG15:0"></line>
			<line register="AD1PCFG" action="WREG" mask="0xFFFF" comment=""></line>
			<line comment="B15=ADRC B12:8=SAMC4:0 B7:0=ADCS7:0"></line>
			<line register="AD1CON3" action="WREG" mask="0xFFFF" comment=""></line>
			<line comment="B15:13=VCFG2:0 B10=CSCNA"></line>
			<line comment="B7=BUFS B5:2=SMPI B1=BUFM B0=ALTS"></line>
			<line register="AD1CON2" action="WREG" mask="0xFFFF" comment=""></line>
			<line comment="B15=ADON B13=ADSIDL B9:8=FORM"></line>
			<line comment="B7:5=SSRC B2=ASAM B1=SAMP B0=DONE"></line>
			<line register="AD1CON1" action="WREG" mask="0xFFFF" comment=""></line>
		</code>
		<code name="Comparator" caption="Comparator 1, 2 and Comparator Voltage Reference configuration">
			<line comment="B15=CMIDL B13=C2EVT B12=C1EVT B11=C2EN B10=C1EN B9=C2OUTEN B8=C1OUTEN"></line>
			<line comment="B7=C2OUT B6=C1OUT B5=C2INV B4=C1INV B3=C2NEG B2=C2POS B1=C1NEG B0=C1POS"></line>
			<line register="CMCON" action="WREG" mask="0xFFFF" comment=""></line>
			<line comment="B7=CVREN B6=CVROE B5=CVRR B4=CVRSS B3:0=CVR3:0"></line>
			<line register="CVRCON" action="WREG" mask="0x00FF" comment=""></line>
		</code>
		<code name="RTC" caption="RTCC configuration">
		<!-- TODO: How to configure the RTCVAL and ALRMVAL ? -->
			<line comment="B15=ALRMEN B14=CHIME B13:10=AMASK3:0 B9:8=ALRMPTR1:0"></line>
			<line comment="B7:0=ARPT7:0"></line>
			<line register="ALCFGRPT" action="WREG" mask="0xFFFF" comment=""></line>
			<line register="RCFGCAL" action="W" value="0x2000" mask="0xFFFF" comment="Turn on RTC Write before setting registers"></line>
			<line comment="B15=RTCEN B13=RTCWREN B12=RTCSYNC B11=HALFSEC B10=RTCOE B9:8=RTCPTR1:0"></line>
			<line comment="B7:0=CAL7:0"></line>
			<line register="RCFGCAL" action="WREG" mask="0x00FF" comment=""></line>
		</code>
		<code name="PMP" caption="PMP/PSP configuration">
			<line comment="B15=PMPEN B13=PSIDL B12:11=ADRMUX1:0 B10=PTBEEN B9=PTWREN B8=PTRDEN"></line>
			<line comment="B7:6=CSF1:0 B5=ALP B4=CS2P B3=CS1P B2:BEP B1:WRSP B0:RDSP"></line>
			<line register="PMCON" action="WREG" mask="0xFFFF" comment=""></line>
			<line comment="B15=BUSY B14:13=IRQM1:0 B12:11=INCM1:0 B10=MODE16 B9:8=MODE1:0"></line>
			<line comment="B7:6=WAITB1:0 B5:2=WAITM3:0 B1:0=WAITE1:0"></line>
			<line register="PMMODE" action="WREG" mask="0xFFFF" comment=""></line>
			<line comment="B15=CS2 B14=CS1 B13:0= Node Address"></line>
			<line register="PMADDR" action="WREG" mask="0xFFFF" comment=""></line>
			<line comment="B15:0=PTEN15:0"></line>
			<line register="PMPEN" action="WREG" mask="0xFFFF" comment=""></line>
			<line comment="B15=IBF B14=IBOV B11=IB3F B10=IB2F B9=IB1F B8=IB0F"></line>
			<line comment="B7=OBE B6=OBUF B3=OB3E B2=OB2E B1=OB1E B0=OB0E"></line>
			<line register="PMSTAT" action="WREG" mask="0xFFFF" comment=""></line>
			<line comment="B1=RTSECSEL B0=PMPTTL`"></line>
			<line register="PADCFG1" action="WREG" mask="0x0003" comment=""></line>
		</code>
		
		<code name="required" caption="Interrupt flags cleared and interrupt configuration">
			<line comment="interrupt priorities IP"></line>
			<line comment="B14:12=T1 B10:8=OC1 B6:4=IC1 B2:0=INTO"></line>
			<line register="IPC0" action="WREG" mask="0x7777" comment=""></line>
			<line comment="B14:12=T2 B10:8=OC2 B6:4=IC2"></line>
			<line register="IPC1" action="WREG" mask="0x7770" comment=""></line>
			<line comment="B14:12=U1RX B10:8=SPI1 B6:4=SPF1 B2:0=T3"></line>
			<line register="IPC2" action="WREG" mask="0x7777" comment=""></line>
			<line comment="B6:4=AD1 B2:0=U1TX"></line>
			<line register="IPC3" action="WREG" mask="0x0077" comment=""></line>
			<line comment="B14:12=CN B10:8=CM B6:4=MI2C1 B2:0=SI2C1"></line>
			<line register="IPC4" action="WREG" mask="0x7777" comment=""></line>
			<line comment="B2:0=INT1"></line>
			<line register="IPC5" action="WREG" mask="0x0007" comment=""></line>
			<line comment="B14:12=T4 B10:8=OC4 B6:4=OC3"></line>
			<line register="IPC6" action="WREG" mask="0x7770" comment=""></line>
			<line comment="B14:12=U2TX B10:8=U2RX B6:4=INT2 B2:0=T5"></line>
			<line register="IPC7" action="WREG" mask="0x7777" comment=""></line>
			<line comment="B6:4=SPI2 B2:0=SPF2"></line>
			<line register="IPC8" action="WREG" mask="0x0077" comment=""></line>
			<line comment="B14:12=IC5 B10:8=IC4 B6:4=IC3"></line>
			<line register="IPC9" action="WREG" mask="0x7770" comment=""></line>
			<line comment="B6:4=OC5"></line>
			<line register="IPC10" action="WREG" mask="0x0070" comment=""></line>
			<line comment="B6:4=PMP"></line>
			<line register="IPC11" action="WREG" mask="0x0070" comment=""></line>
			<line comment="B10:8=MI2C2 B6:4=SI2C2"></line>
			<line register="IPC12" action="WREG" mask="0x0770" comment=""></line>
			<line comment="B10:8=INT4 B6:4=INT3"></line>
			<line register="IPC13" action="WREG" mask="0x0770" comment=""></line>
			<line comment="B10:8=RTCC"></line>
			<line register="IPC14" action="WREG" mask="0x0700" comment=""></line>
			<line comment="B14:12=CRC B10:8=U2ER B6:4=U1ER"></line>
			<line register="IPC15" action="WREG" mask="0x7770" comment=""></line>
			<line comment="external interrupt enables"></line>
			<line comment="B15=NSTDIS"></line>
			<line comment="B4=MATHERR B3=ADDRERR B2=STKERR B1=OSCFAIL"></line>
			<line register="INTCON1" action="WREG" mask="0x801E" comment=""></line>
			<line comment="B15=ALTIVT B14=DISI B4:0=INTnEP4:0"></line>
			<line register="INTCON2" action="WREG" mask="0xC01F" comment=""></line>
		</code>
		<code name="Timer1" caption="Start timers">
			<line comment="Timers1: B15=TON B13=TSIDL B5=TGATE B5:4=TCKPS1:0 B2=TSYNC B1=TCS"></line>
			<line register="T1CON" action="WREG" mask="0xFFFF" comment=""></line>
		</code>
		<code name="Timer3" caption="Start timers">
			<line comment="Timers3,5:   B15=TON B13=TSIDL B5=TGATE B5:4=TCKPS1:0 B1=TCS"></line>
			<line register="T3CON" action="WREG" mask="0xFFFF" comment=""></line>
		</code>
		<code name="Timer2" caption="Start timers">
			<line comment="Timers2,4:   B15=TON B13=TSIDL B5=TGATE B5:4=TCKPS1:0 B3=T32 B1=TCS"></line>
			<line register="T2CON" action="WREG" mask="0xFFFF" comment=""></line>
		</code>
		<code name="Timer5" caption="Start timers">
			<line comment="Timers3,5:   B15=TON B13=TSIDL B5=TGATE B5:4=TCKPS1:0 B1=TCS"></line>
			<line register="T5CON" action="WREG" mask="0xFFFF" comment=""></line>
		</code>
		<code name="Timer4" caption="Start timers">
			<line comment="Timers2,4:   B15=TON B13=TSIDL B5=TGATE B5:4=TCKPS1:0 B3=T32 B1=TCS"></line>
			<line register="T4CON" action="WREG" mask="0xFFFF" comment=""></line>
		</code>
		<code name="CPU" caption="CPU register configuration">
			<line register="SR" action="WMAN" value="0x0000" mask="0xFFFF" comment=""></line>
			<line register="SR" action="WREGMAN" mask="0xFFFF" comment=""></line>
			<line register="W0" action="WMAN" value="0x0000" mask="0xFFFF" comment=""></line>
			<line register="W1" action="WMAN" value="0x0000" mask="0xFFFF" comment=""></line>
			<line register="W2" action="WMAN" value="0x0000" mask="0xFFFF" comment=""></line>
			<line register="W3" action="WMAN" value="0x0000" mask="0xFFFF" comment=""></line>
		</code>
		<code name="Interrupts" caption="enable interrupts">
			<line comment="feature interrupt enables IE"></line>
			<line comment="B13=AD B12=U1TX B11=U1RX B10=SPI1 B9=SPF1 B8=T3"></line>
			<line comment="B7=T2 B6=OC2 B5=IC2 B3=T1 B2=OC1 B1=IC1 B0=INT0"></line>
			<line register="IEC0" action="WREG" mask="0xFFFF" comment=""></line>
			<line comment="B15=U2TX B14=U2RX B13=INT2 B12=T5 B11=T4 B10=OC4 B9=OC3"></line>
			<line comment="B4=INT1 B3=CN B2=CM B1=MI2C1 B0=SI2C1"></line>
			<line register="IEC1" action="WREG" mask="0xFFFF" comment=""></line>
			<line comment="B13=PMP B9=OC5 B7=IC5 B6=IC4 B5=IC3"></line>
			<line comment="B1=SPI2 B0=SPF2"></line>
			<line register="IEC2" action="WREG" mask="0x1FFF" comment=""></line>
			<line comment="B14=RTCC B6=INT4 B5=INT3 B1=MI2C2 B2=SI2C2"></line>
			<line register="IEC3" action="WREG" mask="0x1FFF" comment=""></line>
			<line comment="B3=CRC B2=U2ER B1=U1ER"></line>
			<line register="IEC4" action="WREG" mask="0x1FFF" comment=""></line>
			<line code="return" comment="end of init"></line>
		</code>
	</codeBlock>
</codeDefinitions>
