Agent36
- 13th November 2008, 21:14
Hi,
Can some one tell me where I have gone wrong with the code below please.
DEFINE OSC 8
DEFINE ADC_BITS 10 'Defines bit resoloution
DEFINE ADC_CLOCK 2 'Defines adc clock speed
DEFINE ADC_SAMPLEUS 50 'Defines sammple time of 50mS
TRISD = %00000000
TRISA = %11111111
ADCON1 = %00000000 '
ANSEL = %11111111 'All portA pins analog
ADCON0 = %01000001 'configure A2D for Fosc/8, Channel 0 (RA0), and turn on the A2D module
CM1CON0 = %00000000 'comparator 1 off
CM2CON0 = %00000000 'comparator 2 off
bar var word
main:
adcin 0,bar
portd = bar.highbyte
goto main
I am using a PICkit 2 with PBP 4.47 and MPLAB v8.10. All I want to do at the moment is output the a2d0 on portc. I have set the required registers using the data sheet for the 16f887 as far as I can tell.
Thankyou.
Can some one tell me where I have gone wrong with the code below please.
DEFINE OSC 8
DEFINE ADC_BITS 10 'Defines bit resoloution
DEFINE ADC_CLOCK 2 'Defines adc clock speed
DEFINE ADC_SAMPLEUS 50 'Defines sammple time of 50mS
TRISD = %00000000
TRISA = %11111111
ADCON1 = %00000000 '
ANSEL = %11111111 'All portA pins analog
ADCON0 = %01000001 'configure A2D for Fosc/8, Channel 0 (RA0), and turn on the A2D module
CM1CON0 = %00000000 'comparator 1 off
CM2CON0 = %00000000 'comparator 2 off
bar var word
main:
adcin 0,bar
portd = bar.highbyte
goto main
I am using a PICkit 2 with PBP 4.47 and MPLAB v8.10. All I want to do at the moment is output the a2d0 on portc. I have set the required registers using the data sheet for the 16f887 as far as I can tell.
Thankyou.