Here it is:
Code:
' PIC 16F690 Fuses
@ DEVICE FCMEN_OFF
@ DEVICE IESO_OFF
@ DEVICE BOD_ON
@ DEVICE CPD_OFF
@ DEVICE PROTECT_OFF
@ DEVICE MCLR_OFF
@ DEVICE PWRT_OFF
@ DEVICE WDT_OFF
@ DEVICE HS_OSC
'-------------------------------------------------------------------------------
' Registers 76543210
OPTION_REG = %10000101 'PORT A&B Pull-Ups disabled (look WPUA & WPUB)
ANSEL = %00000001 'Select analog inputs Channels 0 to 7
ANSELH = %00000000 'Select analog inputs Channels 8 to 11
ADCON0 = %10000010 'A/D Module is ON (Bit5:2 select channels 0:11)
ADCON1 = %00010000 'A/D control register
CM1CON0 = %00000000 'Comparator1 Module is OFF
CM2CON0 = %00000000 'Comparator2 Module is OFF
INTCON = %00000000 'INTerrupts CONtrol (TMR0 ON)
TRISA = %00000001 'Set Input/Output (0 to 5)
PORTA = %00000000 'Ports High/Low (0 to 5)
TRISB = %00000000 'Set Input/Output (4 to 7)
PORTB = %00000000 'Ports High/Low (4 to 7)
TRISC = %00000000 'Set Input/Output (0 to 7)
PORTC = %00000000 'Ports High/Low (0 to 7)
'-------------------------------------------------------------------------------
' Defines
DEFINE ADC_BITS 10 'Number of bits in ADCIN result
'-------------------------------------------------------------------------------
' Variables
Volt var word
Check var PORTB.6 'I use this one to measure the ADC start/end
'-------------------------------------------------------------------------------
' Program
MAIN:
check = 1
adcin 0, volt
check = 0
goto MAIN
end
NB: is there a way to make the code appear with the same text formatting as I have in MCS?
Bookmarks