I'm want to use the 12 bit ADC on the PIC16F1786, but the ADC-Templates in Flowcode 7 only support 10 bit!?
I tried to bypass the Flowcharts and ... suprise
ADCON1 = 0b10010000;
// Alle 8 A Ports auf Input stellen
TRISA = 0b11111111;
// A1 für analogen Input aktivieren
ANSELAbits.ANSA1 = 1;
ADCON0 = 0b00000101;
ADCON2 = 0b00001111;
// Starte Signalverarbeitung
ADCON0bits.GO =1;
// Warten bis der Lesezugriff fertig ist
while(ADCON0bits.GO ==1);
//Aufbereitung vom 12bit Ergebnis
//Register ADRESL beinhaltet maximal 255, bei Überlauf wird
//Register ADRESH um eins erhöht
FCV_I_VOLTAGE = ADRESL + (ADRESH*256);
//FCV_R_VOLTAGE beinhaltet die tatsächliche Spannung in V
FCV_R_VOLTAGE = FCV_I_VOLTAGE* 5.04/4095;
The Code above works - but i think this is a difficult solution. Please, can anybody help me?
thx, loop60