[Device] Pins=40 Ports=5 ADCPins=14 ADCBits=10 MaxClock=20000000 PrescalerBits=3 ClockDivider=4 ConfigAddress=0x2007 ConfigCount=2 PortBits=8 PWMCount=2 UARTCount=1 SPICount=1 I2CCount=1 CANCount=0 ComparatorCount=2 TimerCount8=2 TimerCount16=1 EepromSize=256 HasAltPWM=0 FlowcodeProduct=PIC UsesGpio=0 DefaultPackageType=0 FlashSize=14336 RamSize=368 [ICD] ClockPort=1 ClockPin=6 DataPort=1 DataPin=7 [CONFIG] 0=0x23E2 1=0x3EFF [Pins] Pin1 = "MCLR/VPP/RE3" Pin2 = "RA0/AN0" Pin3 = "RA1/AN1" Pin4 = "RA2/AN2/VREF-/CVREF" Pin5 = "RA3/AN3/VREF-" Pin6 = "RA4/T0CKI/C1OUT" Pin7 = "RA5/AN4/LVDIN/SS/C2OUT" Pin8 = "RE0/RD/AN5" Pin9 = "RE1/WR/AN6" Pin10 = "RE2/CS/AN7" Pin11 = "VDD" Pin12 = "VSS" Pin13 = "OSC1/CLKI/RA7" Pin14 = "OSC2/CLKO/RA6" Pin15 = "RC0/T1OSO/T1CKI" Pin16 = "RC1/T1OSI/CCP2" Pin17 = "RC2/CCP1" Pin18 = "RC3/SCK/SCL" Pin19 = "RD0/PSP0" Pin20 = "RD1/PSP1" Pin21 = "RD2/PSP2" Pin22 = "RD3/PSP3" Pin23 = "RC4/SDI/SDA" Pin24 = "RC5/SDO" Pin25 = "RC6/TX/CK" Pin26 = "RC7/RX/DT" Pin27 = "RD4/PSP4" Pin28 = "RD5/PSP5" Pin29 = "RD6/PSP6" Pin30 = "RD7/PSP7" Pin31 = "VSS" Pin32 = "VDD" Pin33 = "RB0/INT/AN12" Pin34 = "RB1/AN10" Pin35 = "RB2/AN8" Pin36 = "RB3/CCP2/AN9" Pin37 = "RB4/AN11" Pin38 = "RB5/AN13/CCP3" Pin39 = "RB6/PGC" Pin40 = "RB7/PGD" [Ports] PortPin1=0x0403 PortPin2=0x0000 PortPin3=0x0001 PortPin4=0x0002 PortPin5=0x0003 PortPin6=0x0004 PortPin7=0x0005 PortPin8=0x0400 PortPin9=0x0401 PortPin10=0x0402 PortPin13=0x0007 PortPin14=0x0006 PortPin15=0x0200 PortPin16=0x0201 PortPin17=0x0202 PortPin18=0x0203 PortPin19=0x0300 PortPin20=0x0301 PortPin21=0x0302 PortPin22=0x0303 PortPin23=0x0204 PortPin24=0x0205 PortPin25=0x0206 PortPin26=0x0207 PortPin27=0x0304 PortPin28=0x0305 PortPin29=0x0306 PortPin30=0x0307 PortPin33=0x0100 PortPin34=0x0101 PortPin35=0x0102 PortPin36=0x0103 PortPin37=0x0104 PortPin38=0x0105 PortPin39=0x0106 PortPin40=0x0107 [PortMasks] ;Bits 0-2 available on port E PortMask0=0xFF PortMask1=0xFF PortMask2=0xFF PortMask3=0xFF PortMask4=0x0F [ADCPins] ADC0=2 ADC1=3 ADC2=4 ADC3=5 ADC4=7 ADC5=8 ADC6=9 ADC7=10 ADC8=35 ADC9=36 ADC10=34 ADC11=37 ADC12=33 ADC13=38 [ADC_ConvSpeed] Count=4 Opt1=Fosc / 2 Opt1_Val=0 Opt2=Fosc / 8 Opt2_Val=1 Opt3=Fosc / 32 Opt3_Val=2 Opt4=FRC Opt4_Val=3 [Code] ;Substitute macros ;%c Clock Speed ;%o Operand ;%s Prescaler ;%p PortID ;%m MaskBits ;%i Inverse Mask ;%a ADC channel ;%a Config Address ;%v Config Value ;%r Interrupt Flag Register ;%b Interrupt Flag Bit ;%n Interrupt Macro Name Directives="#define MX_CLK_SPEED %c\n#ifdef _BOOSTC\n#include \n#endif\n#ifdef HI_TECH_C\n#include \n#endif\n" MainStart="\nvoid main()\n{\n" MainEnd="\tmainendloop: goto mainendloop;\n}\n\n" IntStart="void MX_INTERRUPT_MACRO(void)\n{\n" IntEnd="}\n\n" Initialise="ansel = 0;\nanselh = 0;\n" IntInit="option_reg = 0xC0;\n\n" InputCmdFull="tris%p = tris%p | %m;\n%o = port%p;\n" InputCmdOneBit="tris%p = tris%p | %m;\n%o = ((port%p & %m) == %m);\n" InputCmdMask="tris%p = tris%p | %m;\n%o = port%p & %m;\n" OutputCmdFull="tris%p = 0x00;\nport%p = %o;\n" OutputCmdOneBit="tris%p = tris%p & %i;\nif (%o)\n\tport%p = (port%p & %i) | %m;\nelse\n\tport%p = port%p & %i;\n" OutputCmdMask="tris%p = tris%p & %i;\nport%p = (port%p & %i) | (%o & %m);\n" DelayCmdS="delay_s(%o);\n" DelayCmdMs="delay_ms(%o);\n" DelayCmdUs="delay_us(%o);\n" WdtDelayCmdS="Wdt_Delay_S(%o);\n" WdtDelayCmdMs="Wdt_Delay_Ms(%o);\n" InitialPortLetter="a" ConfigData="#ifdef _BOOSTC\n#pragma DATA %a, %v\n#endif\n#ifdef HI_TECH_C\n__CONFIG(%v);\n#endif\n" IntHandler="#ifndef MX_INTHANDLER_%r_%b\n#define MX_INTHANDLER_%r_%b\nif (ts_bit(%r, %b))\n{\n\tFCM_%n();\n\tcr_bit(%r, %b);\n}\n#else\n#warning "This interrupt has previously been enabled, so the macro <%n> may never get called."\n#endif" [Defines] Define1=#define P16F887 Define2=#define FC_CAL_PIC Define3=#define MX_ADC Define4=#define MX_ADC_TYPE_7 Define5=#define MX_ADC_BITS_10 Define6=#define MX_EE Define7=#define MX_EE_TYPE2 Define8=#define MX_EE_SIZE 256 Define9=#define MX_SPI_1 Define10=#define MX_SPI_1_MISO_PORT portc Define11=#define MX_SPI_1_MISO_TRIS trisc Define12=#define MX_SPI_1_MISO_PIN 4 Define13=#define MX_SPI_1_MOSI_PORT portc Define14=#define MX_SPI_1_MOSI_TRIS trisc Define15=#define MX_SPI_1_MOSI_PIN 5 Define16=#define MX_SPI_1_CLK_PORT portc Define17=#define MX_SPI_1_CLK_TRIS trisc Define18=#define MX_SPI_1_CLK_PIN 3 Define19=#define MX_SPI_1_SS_PORT portc Define20=#define MX_SPI_1_SS_TRIS trisc Define21=#define MX_UART_1 Define22=#define MX_UART_1_TX_PORT portc Define23=#define MX_UART_1_TX_TRIS trisc Define24=#define MX_UART_1_TX_PIN 6 Define25=#define MX_UART_1_RX_PORT portc Define26=#define MX_UART_1_RX_TRIS trisc Define27=#define MX_UART_1_RX_PIN 7 Define28=#define MX_I2C Define29=#define MX_MI2C Define30=#define MX_I2C_1 Define31=#define MX_I2C_1_SDA_PORT portc Define32=#define MX_I2C_1_SDA_TRIS trisc Define33=#define MX_I2C_1_SDA_PIN 4 Define34=#define MX_I2C_1_SCL_PORT portc Define35=#define MX_I2C_1_SCL_TRIS trisc Define36=#define MX_I2C_1_SCL_PIN 3 Define37=#define MX_PWM Define38=#define MX_PWM_CNT 2 Define39=#define MX_PWM_PSCA1 Define40=#define MX_PWM_PSCA4 Define41=#define MX_PWM_PSCA16 Define42=#define MX_PWM_1_PORT portc Define43=#define MX_PWM_1_TRIS trisc Define44=#define MX_PWM_1_PIN 2 Define45=#define MX_PWM_2_PORT portc Define46=#define MX_PWM_2_TRIS trisc Define47=#define MX_PWM_2_PIN 1 [Interrupts] ;first 3 should always be 1=TMR0, 2=RB0INT, 3=PORTB ;any other interrupts need to also have this set: "st_bit(intcon,PEIE);\n" GeneralInit="st_bit(intcon,GIE);\n" Count=6 1=TMR0 2=RB0INT 3=TMR1 4=PORTB 5=RXINT 6=TMR2 [TMR0] Name="TMR0" HandlerCode="#ifndef MX_INTHANDLER_intcon_T0IF\n#define MX_INTHANDLER_intcon_T0IF\nif (ts_bit(intcon, T0IF) && ts_bit(intcon, T0IE))\n{\n\t#ifdef USE_FLOWCODE_ICD\n\t\textern char ICD_Interrupt_Enable = 1;\n\t#endif\t\n\tFCM_%n();\n\tcr_bit(intcon, T0IF);\n\t#ifdef USE_FLOWCODE_ICD\n\t\textern char ICD_Interrupt_Enable = 0;\n\t#endif\t\n}\n#else\n#warning "This interrupt has previously been enabled, so the macro <%n> may never get called."\n#endif\n" EnableCode="st_bit(intcon, T0IE);\n" DisableCode="cr_bit(intcon, T0IE);\n" OptCnt=3 PrescaleOpt=3 MaxTimerOverflow=256 Opt1="Clock Source Select" Opt1Cnt=2 Opt1_1="Transition on T0CKI pin" Opt1_1Val="st_bit(option_reg,T0CS);\n" Opt1_2="Internal clock (CLKO)" Opt1_2Val="cr_bit(option_reg,T0CS);\n" Opt2="Source Edge Select" Opt2Cnt=2 Opt2_1="high-to-low transition on TMR0 Clock" Opt2_1Val="st_bit(option_reg,T0SE);\n" Opt2_2="low-to-high transition on TMR0 Clock" Opt2_2Val="cr_bit(option_reg,T0SE);\n" Opt3="Prescaler Rate" Opt3Cnt=9 Opt3_1="1:1" Opt3_1Val="option_reg = (option_reg & 0xF0) | 0x08;\n" Opt3_2="1:2" Opt3_2Val="option_reg = (option_reg & 0xF0) | 0x00;\n" Opt3_3="1:4" Opt3_3Val="option_reg = (option_reg & 0xF0) | 0x01;\n" Opt3_4="1:8" Opt3_4Val="option_reg = (option_reg & 0xF0) | 0x02;\n" Opt3_5="1:16" Opt3_5Val="option_reg = (option_reg & 0xF0) | 0x03;\n" Opt3_6="1:32" Opt3_6Val="option_reg = (option_reg & 0xF0) | 0x04;\n" Opt3_7="1:64" Opt3_7Val="option_reg = (option_reg & 0xF0) | 0x05;\n" Opt3_8="1:128" Opt3_8Val="option_reg = (option_reg & 0xF0) | 0x06;\n" Opt3_9="1:256" Opt3_9Val="option_reg = (option_reg & 0xF0) | 0x07;\n" [RB0INT] Name="INT" REMask=0x00,0x01 FEMask=0x00,0x01 ConfOpt=0x03 EdgeOpt=0x01 HandlerCode="#ifndef MX_INTHANDLER_intcon_INTF\n#define MX_INTHANDLER_intcon_INTF\nif (ts_bit(intcon, INTF) && ts_bit(intcon, INTE))\n{\n\t#ifdef USE_FLOWCODE_ICD\n\t\textern char ICD_Interrupt_Enable = 1;\n\t#endif\t\n\tFCM_%n();\n\tcr_bit(intcon, INTF);\n\t#ifdef USE_FLOWCODE_ICD\n\t\textern char ICD_Interrupt_Enable = 0;\n\t#endif\t\n}\n#else\n#warning "This interrupt has previously been enabled, so the macro <%n> may never get called."\n#endif\n" EnableCode="st_bit(intcon, INTE);\n" DisableCode="cr_bit(intcon, INTE);\n" OptCnt=1 Opt1="Interrupt Edge Select" Opt1Cnt=2 Opt1_1="rising edge of INT" Opt1_1Val="st_bit(option_reg,INTEDG);\n" Opt1_2="falling edge of INT" Opt1_2Val="cr_bit(option_reg,INTEDG);\n" [TMR1] ;NOTE: this osc is enabled and turned on as part of the Opt1 code Name="TMR1" HandlerCode="#ifndef MX_INTHANDLER_pir1_TMR1IF\n#define MX_INTHANDLER_pir1_TMR1IF\nif (ts_bit(pir1, TMR1IF) && ts_bit(pie1, TMR1IE))\n{\n\t#ifdef USE_FLOWCODE_ICD\n\t\textern char ICD_Interrupt_Enable = 1;\n\t#endif\t\n\tFCM_%n();\n\tcr_bit(pir1, TMR1IF);\n\t#ifdef USE_FLOWCODE_ICD\n\t\textern char ICD_Interrupt_Enable = 0;\n\t#endif\t\n}\n#else\n#warning "This interrupt has previously been enabled, so the macro <%n> may never get called."\n#endif\n" EnableCode="st_bit(pie1, TMR1IE);\n" DisableCode="cr_bit(pie1, TMR1IE);\n" OptCnt=2 PrescaleOpt=2 MaxTimerOverflow=65536 Opt1="Clock Source Select" Opt1Cnt=2 Opt1_1="Transition on T1CKI pin" Opt1_1Val="st_bit(intcon,PEIE);\nst_bit(t1con,T1OSCEN);\nst_bit(t1con,TMR1ON);\nst_bit(t1con,TMR1CS);\n" Opt1_2="Internal clock (Fosc/4)" Opt1_2Val="st_bit(intcon,PEIE);\nst_bit(t1con,T1OSCEN);\nst_bit(t1con,TMR1ON);\ncr_bit(t1con,TMR1CS);\n" Opt2="Prescaler Rate" Opt2Cnt=4 Opt2_1="1:1" Opt2_1Val="t1con = t1con & 0x0F;\n" Opt2_2="1:2" Opt2_2Val="t1con = (t1con & 0x0F) | 0x10;\n" Opt2_3="1:4" Opt2_3Val="t1con = (t1con & 0x0F) | 0x20;\n" Opt2_4="1:8" Opt2_4Val="t1con = (t1con & 0x0F) | 0x30;\n" [PORTB] Name="PORT" REMask=0x00,0xFF FEMask=0x00,0xFF ConfOpt=0x0C HandlerCode="#ifndef MX_INTHANDLER_intcon_RBIF\n#define MX_INTHANDLER_intcon_RBIF\nchar mxtmp;\nif (ts_bit(intcon, RBIF) && ts_bit(intcon, RBIE))\n{\n\t#ifdef USE_FLOWCODE_ICD\n\t\textern char ICD_Interrupt_Enable = 1;\n\t#endif\t\n\tFCM_%n();\n\tmxtmp=portb;\n\tcr_bit(intcon, RBIF);\n\t#ifdef USE_FLOWCODE_ICD\n\t\textern char ICD_Interrupt_Enable = 0;\n\t#endif\t\n}\n#else\n#warning "This interrupt has previously been enabled, so the macro <%n> may never get called."\n#endif\n" EnableCode="iocb=%pB0v;\nst_bit(intcon, RBIE);\n" DisableCode="cr_bit(intcon, RBIE);\n" OptCnt=0 [RXINT] Name="RXINT" HandlerCode="#ifndef MX_INTHANDLER_pir1_RCIF\n#define MX_INTHANDLER_pir1_RCIF\nif (ts_bit(pir1, RCIF) && ts_bit(pie1, RCIE))\n{\n\t#ifdef USE_FLOWCODE_ICD\n\t\textern char ICD_Interrupt_Enable = 1;\n\t#endif\t\n\tFCM_%n();\n\tcr_bit(pir1, RCIF);\n\t#ifdef USE_FLOWCODE_ICD\n\t\textern char ICD_Interrupt_Enable = 0;\n\t#endif\t\n}\n#else\n#warning "This interrupt has previously been enabled, so the macro <%n> may never get called."\n#endif\n" EnableCode="st_bit(pie1, RCIE);\nst_bit(intcon, PEIE);\n" DisableCode="cr_bit(pie1, RCIE);\n" OptCnt=0 [TMR2] Name="TMR2" HandlerCode="#ifndef MX_INTHANDLER_pir1_TMR2IF\n#define MX_INTHANDLER_pir1_TMR2IF\nif (ts_bit(pir1, TMR2IF) && ts_bit(pie1, TMR2IE))\n{\n\t#ifdef USE_FLOWCODE_ICD\n\t\textern char ICD_Interrupt_Enable = 1;\n\t#endif\t\n\tFCM_%n();\n\tcr_bit(pir1, TMR2IF);\n\t#ifdef USE_FLOWCODE_ICD\n\t\textern char ICD_Interrupt_Enable = 0;\n\t#endif\t\n}\n#else\n#warning "This interrupt has previously been enabled, so the macro <%n> may never get called."\n#endif\n" EnableCode="st_bit(pie1, TMR2IE);\n" DisableCode="cr_bit(pie1, TMR2IE);\n" OptCnt=3 PrescaleOpt=1 PostScaleOpt=2 RolloverOpt=3 MaxTimerOverflow=256 Opt1="Prescaler Rate" Opt1Cnt=3 Opt1_1="1:1" Opt1_1Val="st_bit(intcon,PEIE);\ncr_bit(t2con,T2CKPS0);\ncr_bit(t2con,T2CKPS1);\nst_bit(t2con,TMR2ON);\n" Opt1_2="1:4" Opt1_2Val="st_bit(intcon,PEIE);\nst_bit(t2con,T2CKPS0);\ncr_bit(t2con,T2CKPS1);\nst_bit(t2con,TMR2ON);\n" Opt1_3="1:16" Opt1_3Val="st_bit(intcon,PEIE);\ncr_bit(t2con,T2CKPS0);\nst_bit(t2con,T2CKPS1);\nst_bit(t2con,TMR2ON);\n" Opt2="Postscaler Rate" Opt2Cnt=16 Opt2_1="1:1" Opt2_1Val="t2con = t2con & 0x07;\n" Opt2_2="1:2" Opt2_2Val="t2con = (t2con & 0x07) | 0x08;\n" Opt2_3="1:3" Opt2_3Val="t2con = (t2con & 0x07) | 0x10;\n" Opt2_4="1:4" Opt2_4Val="t2con = (t2con & 0x07) | 0x18;\n" Opt2_5="1:5" Opt2_5Val="t2con = (t2con & 0x07) | 0x20;\n" Opt2_6="1:6" Opt2_6Val="t2con = (t2con & 0x07) | 0x28;\n" Opt2_7="1:7" Opt2_7Val="t2con = (t2con & 0x07) | 0x30;\n" Opt2_8="1:8" Opt2_8Val="t2con = (t2con & 0x07) | 0x38;\n" Opt2_9="1:9" Opt2_9Val="t2con = (t2con & 0x07) | 0x40;\n" Opt2_10="1:10" Opt2_10Val="t2con = (t2con & 0x07) | 0x48;\n" Opt2_11="1:11" Opt2_11Val="t2con = (t2con & 0x07) | 0x50;\n" Opt2_12="1:12" Opt2_12Val="t2con = (t2con & 0x07) | 0x58;\n" Opt2_13="1:13" Opt2_13Val="t2con = (t2con & 0x07) | 0x60;\n" Opt2_14="1:14" Opt2_14Val="t2con = (t2con & 0x07) | 0x68;\n" Opt2_15="1:15" Opt2_15Val="t2con = (t2con & 0x07) | 0x70;\n" Opt2_16="1:16" Opt2_16Val="t2con = (t2con & 0x07) | 0x78;\n" Opt3="Rollover Value" Opt3Cnt=5 Opt3_1="256" Opt3_1Val="pr2=%d-1;\n" Opt3_2="128" Opt3_2Val="NOTE: only Opt3_1Val is needed here" Opt3_3="64" Opt3_3Val="NOTE: only Opt3_1Val is needed here" Opt3_4="32" Opt3_4Val="NOTE: only Opt3_1Val is needed here" Opt3_5="16" Opt3_5Val="NOTE: only Opt3_1Val is needed here"