AD Converter on ANC2, ANC3 not read well 16(L)F18346 SOLVED

General discussion on mikroC PRO for PIC.
Post Reply
Author
Message
leo73
Posts: 252
Joined: 09 Jan 2014 15:45

AD Converter on ANC2, ANC3 not read well 16(L)F18346 SOLVED

#1 Post by leo73 » 25 Oct 2022 13:04

Hello to every one,
I must acquire two voltage level on ANC2 and other on ANC3, unfortunatelly what it measures on ANC2 is reported onANC3 while in reality they are two different tension readings !!
Lock the debug (restectively ADC2 and ADC3)!!
There's some one who can help me please? :cry:
Attachments
Debug-ANC2-ANC3.jpg
Debug-ANC2-ANC3.jpg (361.3 KiB) Viewed 671 times
ADC_ConverterConfig_1.jpg
ADC_ConverterConfig_1.jpg (224.31 KiB) Viewed 673 times
ADCTest-DebugUART16F18346-V1.0-WORK.zip
WARNING !!!!! CODE NOT WORK
(144.45 KiB) Downloaded 28 times
Last edited by leo73 on 25 Oct 2022 18:45, edited 2 times in total.

leo73
Posts: 252
Joined: 09 Jan 2014 15:45

Re: AD Converter on ANC2, ANC3 not read well 16(L)F18346

#2 Post by leo73 » 25 Oct 2022 16:09

Hello,

I SOLVED
If you are using two or more AD channel, every time you changhe channel to acquire you must select channel like this:

Code: Select all

      // selec chanel  ANC3
      ADCON0.CHS5=0;ADCON0.CHS4=1;ADCON0.CHS3=0;ADCON0.CHS2=0;ADCON0.CHS1=1;
      ADCON0.CHS0=1; //010011
      Delay_ms(50);   // wait stabilistation
      amplitude = Lecture_ADC2(0x13);
      
      // selec chanel  ANC2
      ADCON0.CHS5=0;ADCON0.CHS4=1;ADCON0.CHS3=0;ADCON0.CHS2=0;ADCON0.CHS1=1;
      ADCON0.CHS0=0;  //010010
      Delay_ms(50);   // wait stabilistation
      amplitude = Lecture_ADC2(0x12);  //ANC2=0X12 // ad read on ch:14 (ANC3)
In attachement worked project.
Attachments
ADCTest-DebugUART16F18346-V2.0-WORK.zip
CODE WORK 100%
(50.53 KiB) Downloaded 23 times

Post Reply

Return to “mikroC PRO for PIC General”