PIC Basic Compiler Library Support


The library support is a new way for the basic statements implementation.
This is indeed an advanced feature, however that is a way that can be used by both the author and the users to extend the compiler language from the external library files.
The information is loaded from the external textual .lib files stored in the OshonSoft application data folder.
OshonSoft .lib files are documented enough with comments covering all the currently available features of the library support.
Library files can be edited by Notepad, or any other plain text editor.
 
 

oshonsoftpic-adc.lib file:
 
//the concept is that one library group contains the implementation of one new language element - statement
//library items contain different implementations of the same functionality for different groups of microcontrollers
//#lib_item_begin must be followed by #processor
//#statement_begin, #statement_type, #argument sequence must be fulfilled for proper library load
 
//#processor comma-separated list of processors, x can be used as a wild card character
//#processor can be used in multiple lines to quote all devices if needed
//#parameter is used to implement #define parameters needed for the statement implementation
//#parameter const, parameter_name, allowed_range, default_value
//#parameter symbol, parameter_name, type (pin, bit, byte, address of), system_bit or system_register
//'pin' type is used for the bits in the PORT registers
//'address of' type will implement a constant parameter
//#variable is used to declare global system variables
//#variable variable_name, type (byte, word, long, single, string)
//#statement_begin statement_name [argument1_name[, argument2_name[, ...]]]
//#statement_type type (procedure; inline; function, f_type (byte, word, long, single, string))
//#argument argument_name, type (byte, byte system xx, word, word system xx, long, long system xx, single, string), passing_type
//the default type of the system variables can not be changed with #argument
//passing_type (byval, byval allowed_constant_range, byref, byrefout) for statement_type procedure and inline
//passing_type (byval, byval allowed_constant_range) for statement_type function
 
//used to define parameters and statements that are not available or not applicable for the current item devices
//#parameter n/a, parameter_name
//#statement n/a, statement_name
 
//code section can contain both inline assembler and basic language lines of code
//symbol and const parameters can be used directly in the assembler lines of code
//calculate[] or calc[] macro is available
//calculate[] must be used to enter the parameter value in the basic code, will be replaced with the value of the parameter
//calculate[] can be used to perform one arithmetic operation, will be replaced with the value of the result
//calc[] arithmetic operators: +, -, *, /, % (modulus or remainder operator), \ (division returning integer result)
//calc[] macros can be nested
//reg_addr[] macro will be replaced with the register address; if not found, -1 is returned
//#if [], #endif macro is available
//#if comparison operators: ==,<>,<,>,<=,>=
//Clock_Freq in MHz is available as an argument
 
//be careful that basic statements like WaitUs also make use of the system registers and can alter those values
//when using inline assembler code, be careful that basic statements expect to be called with BANK zero selected
 
//special function registers are declared in basic code as byte variables; if needed, this byte variable type can be changed with #redim directive
//#redim register_name new_type (byte, word, long, single)
 
//#pagesel directive should be used before all the GOTO and CALL instructions in the code
//#pagesel will be used by the compiler to setup the appropriate page bits in the PCLATH register for the next GOTO or CALL instruction
 
//list of available compiler system byte registers (bank 0): R0L, R0H, R1L, R1H, R2L, R2H, R3L, R3H, R4L, R4H, R5L, R5H
//list of available compiler system word registers (bank 0): R0HL, R1HL, R2HL, R3HL, R4HL, R5HL
//list of available compiler system long registers (bank 0): R1HL0HL, R3HL2HL, R5HL4HL
 
 
#lib_name OshonSoft ADC Module Library
 
 
#lib_group_begin //ADC_Read statement
 
#lib_item_begin
//ADCON0, bank0,
//ADCS1 ADCS0 CHS2 CHS1 CHS0 GO/DONE ADON
//ADCON1, bank1,
//ADFM ADCS2 PCFG3 PCFG2 PCFG1 PCFG0
//ADFM ADCS2 VCFG1 VCFG0 //v2
//ADRESL, bank1,
//ADRESH, bank0,
#processor 16f873a, 16f874a, 16f876a, 16f877a
#processor 16f818, 16f819
#processor 16f88 //v2
#parameter const, ADC_Sample_uS, 0-255, 20
#parameter const, ADC_Clk, 0-7, 3
        #statement_begin ADC_Read adc_channel, adc_result
        #statement_type procedure
        #argument adc_channel, byte system R0L, byval 0-7
        #argument adc_result, word system R1HL, byrefout
        #code_begin
        //
        banksel ADCON1
        bsf ADCON1,ADFM
        #if [ADC_Clk > 3] bsf ADCON1,ADCS2
        #if [ADC_Clk <= 3] bcf ADCON1,ADCS2
        banksel 0
        rlf R0L,f
        rlf R0L,f
        rlf R0L,f
        movlw 0x38
        andwf R0L,f
        movlw calc[calc[calc[ADC_Clk * 64] % 256] + 1] //1-ADON
        iorwf R0L,w
        movwf ADCON0
        //
        WaitUs calculate[ADC_Sample_uS]
        //
        bsf ADCON0,GO
        l1:
        #pagesel
        btfsc ADCON0,GO
        goto l1
        bcf ADCON0,ADON
        bcf PIR1,ADIF
        R1L = ADRESL
        R1H = ADRESH
        //
        #code_end
        #statement_end
#lib_item_end
 
#lib_item_begin
//ADCON0, bank0,
//ADCS1 ADCS0 CHS2 CHS1 CHS0 GO/DONE ADON
//ADCON1, bank1,
//ADFM PCFG3 PCFG2 PCFG1 PCFG0
//ADRESL, bank1,
//ADRESH, bank0,
#processor 16f873, 16f874, 16f876, 16f877
#processor 16f870, 16f871
#processor 16f872
#parameter const, ADC_Sample_uS, 0-255, 20
#parameter const, ADC_Clk, 0-3, 3
        #statement_begin ADC_Read adc_channel, adc_result
        #statement_type procedure
        #argument adc_channel, byte system R0L, byval 0-7
        #argument adc_result, word system R1HL, byrefout
        #code_begin
        //
        banksel ADCON1
        bsf ADCON1,ADFM
        banksel 0
        rlf R0L,f
        rlf R0L,f
        rlf R0L,f
        movlw 0x38
        andwf R0L,f
        movlw calc[calc[ADC_Clk * 64] + 1] //1-ADON
        iorwf R0L,w
        movwf ADCON0
        //
        WaitUs calculate[ADC_Sample_uS]
        //
        bsf ADCON0,GO
        l1:
        #pagesel
        btfsc ADCON0,GO
        goto l1
        bcf ADCON0,ADON
        bcf PIR1,ADIF
        R1L = ADRESL
        R1H = ADRESH
        //
        #code_end
        #statement_end
#lib_item_end
 
#lib_item_begin
//ADCON0, bank0,
//ADCS1 ADCS0 CHS2 CHS1 CHS0 GO/DONE ADON
//ADCON1, bank1,
// PCFG2 PCFG1 PCFG0
//ADRES, bank0,
#processor 16f73, 16f74, 16f76, 16f77
#processor 16f72
#processor 16f716
#parameter const, ADC_Sample_uS, 0-255, 20
#parameter const, ADC_Clk, 0-3, 3
        #statement_begin ADC_Read adc_channel, adc_result
        #statement_type procedure
        #argument adc_channel, byte system R0L, byval 0-7
        #argument adc_result, byte system ADRES, byrefout
        #code_begin
        //
        rlf R0L,f
        rlf R0L,f
        rlf R0L,f
        movlw 0x38
        andwf R0L,f
        movlw calc[calc[ADC_Clk * 64] + 1] //1-ADON
        iorwf R0L,w
        movwf ADCON0
        //
        WaitUs calculate[ADC_Sample_uS]
        //
        bsf ADCON0,GO
        l1:
        #pagesel
        btfsc ADCON0,GO
        goto l1
        bcf ADCON0,ADON
        bcf PIR1,ADIF
        //
        #code_end
        #statement_end
#lib_item_end
 
#lib_item_begin
//ADCON, bank0,
//ADCS2 ADCS1 ADCS0 CHS2 CHS1 CHS0 GO/DONE ADON
//ADRES, bank0,
#processor 10f320, 10f322
#parameter const, ADC_Sample_uS, 0-255, 20
#parameter const, ADC_Clk, 0-7, 3
        #statement_begin ADC_Read adc_channel, adc_result
        #statement_type procedure
        #argument adc_channel, byte system R0L, byval 0-7
        #argument adc_result, byte system ADRES, byrefout
        #code_begin
        //
        rlf R0L,f
        rlf R0L,f
        movlw 0x1c
        andwf R0L,f
        movlw calc[calc[ADC_Clk * 32] + 1] //1-ADON
        iorwf R0L,w
        movwf ADCON
        //
        WaitUs calculate[ADC_Sample_uS]
        //
        bsf ADCON,GO
        l1:
        #pagesel
        btfsc ADCON,GO
        goto l1
        bcf ADCON,ADON
        bcf PIR1,ADIF
        //
        #code_end
        #statement_end
#lib_item_end
 
#lib_item_begin
//ADCON0, bank0,
// CHS3 CHS2 CHS1 CHS0 GO/DONE ADON
//ADCON1, bank1,
// ADCS2 ADCS1 ADCS0 ADREF1 ADREF0
//ADRES, bank0,
#processor 16f722, 16f723, 16f724, 16f726, 16f727
#processor 16f707
#processor 16f722a, 16f723a
#parameter const, ADC_Sample_uS, 0-255, 20
#parameter const, ADC_Clk, 0-7, 3
        #statement_begin ADC_Read adc_channel, adc_result
        #statement_type procedure
        #argument adc_channel, byte system R0L, byval 0-15
        #argument adc_result, byte system ADRES, byrefout
        #code_begin
        //
        banksel ADCON1
        movlw 0x0f
        andwf ADCON1,f
        movlw calc[ADC_Clk * 16]
        iorwf ADCON1,f
        banksel 0
        rlf R0L,f
        rlf R0L,f
        movlw 0x3c
        andwf R0L,w
        movwf ADCON0
        bsf ADCON0,ADON
        //
        WaitUs calculate[ADC_Sample_uS]
        //
        bsf ADCON0,GO
        l1:
        #pagesel
        btfsc ADCON0,GO
        goto l1
        bcf ADCON0,ADON
        bcf PIR1,ADIF
        //
        #code_end
        #statement_end
#lib_item_end
 
#lib_item_begin
//ADCON0, bank0,
// CHS3 CHS2 CHS1 CHS0 GO/DONE ADON
//ADCON1, bank1,
// ADCS2 ADCS1 ADCS0
//ADRES, bank0,
#processor 16f720, 16f721
#parameter const, ADC_Sample_uS, 0-255, 20
#parameter const, ADC_Clk, 0-7, 3
        #statement_begin ADC_Read adc_channel, adc_result
        #statement_type procedure
        #argument adc_channel, byte system R0L, byval 0-15
        #argument adc_result, byte system ADRES, byrefout
        #code_begin
        //
        banksel ADCON1
        movlw calc[ADC_Clk * 16]
        movwf ADCON1
        banksel 0
        rlf R0L,f
        rlf R0L,f
        movlw 0x3c
        andwf R0L,w
        movwf ADCON0
        bsf ADCON0,ADON
        //
        WaitUs calculate[ADC_Sample_uS]
        //
        bsf ADCON0,GO
        l1:
        #pagesel
        btfsc ADCON0,GO
        goto l1
        bcf ADCON0,ADON
        bcf PIR1,ADIF
        //
        #code_end
        #statement_end
#lib_item_end
 
#lib_item_begin
//ADCON0, bank0,
//ADFM VCFG CHS3 CHS2 CHS1 CHS0 GO/DONE ADON
//ADCON1, bank1,
// ADCS2 ADCS1 ADCS0
//ADRESL, bank1,
//ADRESH, bank0,
#processor 16f677, 16f685, 16f687, 16f689, 16f690
#processor 16f785
#processor 16f616
#parameter const, ADC_Sample_uS, 0-255, 20
#parameter const, ADC_Clk, 0-7, 3
        #statement_begin ADC_Read adc_channel, adc_result
        #statement_type procedure
        #argument adc_channel, byte system R0L, byval 0-15
        #argument adc_result, word system R1HL, byrefout
        #code_begin
        //
        banksel ADCON1
        movlw calc[ADC_Clk * 16]
        movwf ADCON1
        banksel 0
        bsf ADCON0,ADFM
        movlw 0xc0
        andwf ADCON0,f
        rlf R0L,f
        rlf R0L,f
        movlw 0x3c
        andwf R0L,w
        iorwf ADCON0,f
        bsf ADCON0,ADON
        //
        WaitUs calculate[ADC_Sample_uS]
        //
        bsf ADCON0,GO
        l1:
        #pagesel
        btfsc ADCON0,GO
        goto l1
        bcf ADCON0,ADON
        bcf PIR1,ADIF
        R1L = ADRESL
        R1H = ADRESH
        //
        #code_end
        #statement_end
#lib_item_end
 
#lib_item_begin
//ADCON0, bank0,
//ADFM VCFG CHS2 CHS1 CHS0 GO/DONE ADON
//ADCON1, bank1,
// ADCS2 ADCS1 ADCS0
//ADRESL, bank1,
//ADRESH, bank0,
#processor 16f684
#processor 16f688
#processor 16f676
#parameter const, ADC_Sample_uS, 0-255, 20
#parameter const, ADC_Clk, 0-7, 3
        #statement_begin ADC_Read adc_channel, adc_result
        #statement_type procedure
        #argument adc_channel, byte system R0L, byval 0-7
        #argument adc_result, word system R1HL, byrefout
        #code_begin
        //
        banksel ADCON1
        movlw calc[ADC_Clk * 16]
        movwf ADCON1
        banksel 0
        bsf ADCON0,ADFM
        movlw 0xc0
        andwf ADCON0,f
        rlf R0L,f
        rlf R0L,f
        movlw 0x1c
        andwf R0L,w
        iorwf ADCON0,f
        bsf ADCON0,ADON
        //
        WaitUs calculate[ADC_Sample_uS]
        //
        bsf ADCON0,GO
        l1:
        #pagesel
        btfsc ADCON0,GO
        goto l1
        bcf ADCON0,ADON
        bcf PIR1,ADIF
        R1L = ADRESL
        R1H = ADRESH
        //
        #code_end
        #statement_end
#lib_item_end
 
#lib_item_begin
//ADCON0, bank0,
//ADFM VCFG1 VCFG0 CHS2 CHS1 CHS0 GO/DONE ADON
//ADCON1, bank1,
// ADCS2 ADCS1 ADCS0
//ADRESL, bank1,
//ADRESH, bank0,
#processor 16f913, 16f914, 16f916, 16f917, 16f946
#parameter const, ADC_Sample_uS, 0-255, 20
#parameter const, ADC_Clk, 0-7, 3
        #statement_begin ADC_Read adc_channel, adc_result
        #statement_type procedure
        #argument adc_channel, byte system R0L, byval 0-7
        #argument adc_result, word system R1HL, byrefout
        #code_begin
        //
        banksel ADCON1
        movlw calc[ADC_Clk * 16]
        movwf ADCON1
        banksel 0
        bsf ADCON0,ADFM
        movlw 0xe0
        andwf ADCON0,f
        rlf R0L,f
        rlf R0L,f
        movlw 0x1c
        andwf R0L,w
        iorwf ADCON0,f
        bsf ADCON0,ADON
        //
        WaitUs calculate[ADC_Sample_uS]
        //
        bsf ADCON0,GO
        l1:
        #pagesel
        btfsc ADCON0,GO
        goto l1
        bcf ADCON0,ADON
        bcf PIR1,ADIF
        R1L = ADRESL
        R1H = ADRESH
        //
        #code_end
        #statement_end
#lib_item_end
 
#lib_item_begin
//ADCON0, bank0,
//ADFM VCFG CHS1 CHS0 GO/DONE ADON
//ANSEL, bank1,
// ADCS2 ADCS1 ADCS0 ANS3 ANS2 ANS1 ANS0
//ADRESL, bank1,
//ADRESH, bank0,
#processor 12f675
#processor 12f683
#parameter const, ADC_Sample_uS, 0-255, 20
#parameter const, ADC_Clk, 0-7, 3
        #statement_begin ADC_Read adc_channel, adc_result
        #statement_type procedure
        #argument adc_channel, byte system R0L, byval 0-3
        #argument adc_result, word system R1HL, byrefout
        #code_begin
        //
        banksel ANSEL
        movlw 0x0f
        andwf ANSEL,f
        movlw calc[ADC_Clk * 16]
        iorwf ANSEL,f
        banksel 0
        bsf ADCON0,ADFM
        movlw 0xc0
        andwf ADCON0,f
        rlf R0L,f
        rlf R0L,f
        movlw 0x0c
        andwf R0L,w
        iorwf ADCON0,f
        bsf ADCON0,ADON
        //
        WaitUs calculate[ADC_Sample_uS]
        //
        bsf ADCON0,GO
        l1:
        #pagesel
        btfsc ADCON0,GO
        goto l1
        bcf ADCON0,ADON
        bcf PIR1,ADIF
        R1L = ADRESL
        R1H = ADRESH
        //
        #code_end
        #statement_end
#lib_item_end
 
#lib_item_begin
//ADCON0, bank0,
//ADFM VCFG CHS2 CHS1 CHS0 GO/DONE ADON
//ANSEL, bank1,
// ADCS2 ADCS1 ADCS0 ANS3 ANS2 ANS1 ANS0
//ADRESL, bank1,
//ADRESH, bank0,
#processor 12f615, 12f617
#parameter const, ADC_Sample_uS, 0-255, 20
#parameter const, ADC_Clk, 0-7, 3
        #statement_begin ADC_Read adc_channel, adc_result
        #statement_type procedure
        #argument adc_channel, byte system R0L, byval 0-7
        #argument adc_result, word system R1HL, byrefout
        #code_begin
        //
        banksel ANSEL
        movlw 0x0f
        andwf ANSEL,f
        movlw calc[ADC_Clk * 16]
        iorwf ANSEL,f
        banksel 0
        bsf ADCON0,ADFM
        movlw 0xc0
        andwf ADCON0,f
        rlf R0L,f
        rlf R0L,f
        movlw 0x1c
        andwf R0L,w
        iorwf ADCON0,f
        bsf ADCON0,ADON
        //
        WaitUs calculate[ADC_Sample_uS]
        //
        bsf ADCON0,GO
        l1:
        #pagesel
        btfsc ADCON0,GO
        goto l1
        bcf ADCON0,ADON
        bcf PIR1,ADIF
        R1L = ADRESL
        R1H = ADRESH
        //
        #code_end
        #statement_end
#lib_item_end
 
#lib_item_begin
//ADCON0, bank0,
//ADFM CHS3 CHS2 CHS1 CHS0 GO/DONE ADON
//ADFM VCFG CHS3 CHS2 CHS1 CHS0 GO/DONE ADON //v2
//ADCON1, bank0,
// ADCS2 ADCS1 ADCS0 ADPREF1
// ADCS2 ADCS1 ADCS0 //v2
//ADRESL, bank0,
//ADRESH, bank0,
#processor 16f753
#processor 12f752 //v2
#parameter const, ADC_Sample_uS, 0-255, 20
#parameter const, ADC_Clk, 0-7, 3
        #statement_begin ADC_Read adc_channel, adc_result
        #statement_type procedure
        #argument adc_channel, byte system R0L, byval 0-15
        #argument adc_result, word system ADRESL, byrefout
        #code_begin
        //
        #redim ADRESL word
        movlw 0x0f
        andwf ADCON1,f
        movlw calc[ADC_Clk * 16]
        iorwf ADCON1,f
        bsf ADCON0,ADFM
        movlw 0xc0
        andwf ADCON0,f
        rlf R0L,f
        rlf R0L,f
        movlw 0x3c
        andwf R0L,w
        iorwf ADCON0,f
        bsf ADCON0,ADON
        //
        WaitUs calculate[ADC_Sample_uS]
        //
        bsf ADCON0,GO
        l1:
        #pagesel
        btfsc ADCON0,GO
        goto l1
        bcf ADCON0,ADON
        bcf PIR1,ADIF
        //
        #code_end
        #statement_end
#lib_item_end
 
#lib_item_begin
//ADCON0, bank0,
//ADCS1 ADCS0 CHS2 CHS1 CHS0 GO/DONE CHS3 ADON
//ADCON1, bank1,
//ADFM ADCS2 VCFG1 VCFG0 PCFG3 PCFG2 PCFG1 PCFG0
//ADCON2, bank1,
// ACQT2 ACQT1 ACQT0
//ADRESL, bank1,
//ADRESH, bank0,
#processor 16f737, 16f747, 16f767, 16f777
#parameter const, ADC_Sample_uS, 0-255, 20
#parameter const, ADC_Clk, 0-7, 3
        #statement_begin ADC_Read adc_channel, adc_result
        #statement_type procedure
        #argument adc_channel, byte system R0L, byval 0-15
        #argument adc_result, word system R1HL, byrefout
        #code_begin
        //
        banksel ADCON1
        bsf ADCON1,ADFM
        #if [ADC_Clk > 3] bsf ADCON1,ADCS2
        #if [ADC_Clk <= 3] bcf ADCON1,ADCS2
        clrf ADCON2
        banksel 0
        clrf ADCON0
        btfsc R0L,3
        bsf ADCON0,CHS3
        rlf R0L,f
        rlf R0L,f
        rlf R0L,f
        movlw 0x38
        andwf R0L,f
        movlw calc[calc[calc[ADC_Clk * 64] % 256] + 1] //1-ADON
        iorwf R0L,w
        iorwf ADCON0,f
        //
        WaitUs calculate[ADC_Sample_uS]
        //
        bsf ADCON0,GO
        l1:
        #pagesel
        btfsc ADCON0,GO
        goto l1
        bcf ADCON0,ADON
        bcf PIR1,ADIF
        R1L = ADRESL
        R1H = ADRESH
        //
        #code_end
        #statement_end
#lib_item_end
 
#lib_item_begin
//ADCON0, bank0,
//ADCS1 ADCS0 CHS3 CHS2 CHS1 CHS0 GO/DONE ADON
//ADCON1, bank1,
//ADFM VCFG1 VCFG0
//ADRESL, bank1,
//ADRESH, bank0,
#processor 16f882, 16f883, 16f884, 16f886, 16f887
#parameter const, ADC_Sample_uS, 0-255, 20
#parameter const, ADC_Clk, 0-3, 3
        #statement_begin ADC_Read adc_channel, adc_result
        #statement_type procedure
        #argument adc_channel, byte system R0L, byval 0-15
        #argument adc_result, word system R1HL, byrefout
        #code_begin
        //
        banksel ADCON1
        bsf ADCON1,ADFM
        banksel 0
        rlf R0L,f
        rlf R0L,f
        movlw 0x3c
        andwf R0L,f
        movlw calc[calc[ADC_Clk * 64] + 1] //1-ADON
        iorwf R0L,w
        movwf ADCON0
        //
        WaitUs calculate[ADC_Sample_uS]
        //
        bsf ADCON0,GO
        l1:
        #pagesel
        btfsc ADCON0,GO
        goto l1
        bcf ADCON0,ADON
        bcf PIR1,ADIF
        R1L = ADRESL
        R1H = ADRESH
        //
        #code_end
        #statement_end
#lib_item_end
 
#lib_item_begin
#processor 16f87
#processor 16f83, 16f84
#processor 16f84a
#processor 16f627, 16f628
#processor 16f627a, 16f628a, 16f648a
#processor 12f635, 16f636, 16f639
#processor 16f631
#processor 16f630
#processor 12f629
#processor 16f610
#processor 12f609
#parameter n/a, ADC_Sample_uS
#parameter n/a, ADC_Clk
#statement n/a, ADC_Read
#lib_item_end
#lib_group_end
 
 
#lib_group_begin //All_Digital statement
 
#lib_item_begin
#processor 16f873, 16f874, 16f876, 16f877
#processor 16f870, 16f871
#processor 16f872
#processor 16f818, 16f819
#processor 16f627, 16f628
#processor 16f627a, 16f628a, 16f648a
#processor 16f87, 16f88
#processor 16f73, 16f74, 16f76, 16f77
#processor 16f72
#processor 16f873a, 16f874a, 16f876a, 16f877a
#processor 16f716
        #statement_begin All_Digital
        #statement_type inline
        #code_begin
        //
        #if [reg_addr[ADCON1] >= 0] ADCON1 = 0x06
        #if [reg_addr[CMCON] >= 0] CMCON = 0x07
        #if [reg_addr[VRCON] >= 0] VRCON.VROE = 0
        #if [reg_addr[CVRCON] >= 0] CVRCON.CVROE = 0
        #if [reg_addr[ANSEL] >= 0] ANSEL = 0x00
        //
        #code_end
        #statement_end
#lib_item_end
 
#lib_item_begin
#processor 12f629, 12f675
#processor 16f630, 16f676
#processor 12f683
#processor 16f684
#processor 16f688
#processor 16f913, 16f914, 16f916, 16f917, 16f946
#processor 12f635, 16f636, 16f639
        #statement_begin All_Digital
        #statement_type inline
        #code_begin
        //
        #if [reg_addr[CMCON] >= 0] CMCON = 0x07
        #if [reg_addr[CMCON0] >= 0] CMCON0 = 0x07
        #if [reg_addr[ANSEL] >= 0] ANSEL = 0x00
        //
        #code_end
        #statement_end
#lib_item_end
 
#lib_item_begin
#processor 16f737, 16f747, 16f767, 16f777
        #statement_begin All_Digital
        #statement_type inline
        #code_begin
        //
        #if [reg_addr[ADCON1] >= 0] ADCON1 = 0x0f
        #if [reg_addr[CMCON] >= 0] CMCON = 0x07
        #if [reg_addr[CVRCON] >= 0] CVRCON.CVROE = 0
        //
        #code_end
        #statement_end
#lib_item_end
 
#lib_item_begin
#processor 16f631, 16f677, 16f685, 16f687, 16f689, 16f690
#processor 16f610, 16f616
#processor 12f609, 12f615, 12f617
        #statement_begin All_Digital
        #statement_type inline
        #code_begin
        //
        #if [reg_addr[ANSEL] >= 0] ANSEL = 0x00
        #if [reg_addr[ANSELH] >= 0] ANSELH = 0x00
        //
        #code_end
        #statement_end
#lib_item_end
 
#lib_item_begin
#processor 16f882, 16f883, 16f884, 16f886, 16f887
        #statement_begin All_Digital
        #statement_type inline
        #code_begin
        //
        #if [reg_addr[ANSEL] >= 0] ANSEL = 0x00
        #if [reg_addr[ANSELH] >= 0] ANSELH = 0x00
        #if [reg_addr[VRCON] >= 0] VRCON.VROE = 0
        //
        #code_end
        #statement_end
#lib_item_end
 
#lib_item_begin
#processor 16f785
        #statement_begin All_Digital
        #statement_type inline
        #code_begin
        //
        #if [reg_addr[ANSEL0] >= 0] ANSEL0 = 0x00
        #if [reg_addr[ANSEL1] >= 0] ANSEL1 = 0x00
        #if [reg_addr[REFCON] >= 0] REFCON.VROE = 0
        #if [reg_addr[REFCON] >= 0] REFCON.CVROE = 0
        //
        #code_end
        #statement_end
#lib_item_end
 
#lib_item_begin
#processor 16f722, 16f723, 16f724, 16f726, 16f727
#processor 16f707
#processor 16f722a, 16f723a
#processor 16f720, 16f721
#processor 10f320, 10f322
#processor 12f752
#processor 16f753
        #statement_begin All_Digital
        #statement_type inline
        #code_begin
        //
        #if [reg_addr[ANSELA] >= 0] ANSELA = 0x00
        #if [reg_addr[ANSELB] >= 0] ANSELB = 0x00
        #if [reg_addr[ANSELC] >= 0] ANSELC = 0x00
        #if [reg_addr[ANSELD] >= 0] ANSELD = 0x00
        #if [reg_addr[ANSELE] >= 0] ANSELE = 0x00
        //
        #code_end
        #statement_end
#lib_item_end
 
#lib_item_begin
#processor 16f83, 16f84
#processor 16f84a
#statement n/a, All_Digital
#lib_item_end
#lib_group_end