PDA

View Full Version : PIC14000 adc



Doug
- 15th November 2004, 21:49
Does anyone have any code for reading the adc in a pic14000. PBP's adcin does not support pic14000.

Thanks in advance.

mister_e
- 15th November 2004, 22:26
I never use PIC1400 but the following work on 16F877 without using ADCIN, maybe you can use a part of it. Compare both datasheet may help if there's any difference between both



A_D_Val VAR BYTE

TRISA = %11111111 ; Set PORTA to all input
ADCON1 = %00000010 ; Set PORTA analog and LEFT justify result
ADCON0 = %11000001 ; Configure and turn on A/D Module
Pause 500

Start:
ADCON0.2 = 1 ;Start Conversion

ConversionNotcomplete:
pause 10
if ADCON0.2 = 1 Then ConversionNotComplete
adval = ADRESH
Lcdout $fe, 1,"Result=",DEC A_D_Val
Pause 200
Goto Start
hope this may help!!!