PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Dec 25, 2016 6:51 am |
|
|
In the set_tris_b() statement below, you have set bit 7 = 1.
This is for the AN7 pin, which is on pin B7. But you're using
AN6 on B6. You set the wrong tris bit.
| Quote: | SETUP_ADC_PORTS(sAN6);
SETUP_ADC(ADC_CLOCK_DIV_32|ADC_TAD_MUL_16);
set_tris_a(0b0);
set_tris_b(0b10000000);
set_tris_d(0b0);
set_tris_e(0b00000000);
set_tris_f(0b000); |
In the code below, you were told to use the channel number (6) earlier
in this thread, and not to use sANx. But you made the same mistake:
| Quote: | set_adc_channel(san6);
delay_us(50);
|
|
|