Thanks to Rob I got the beginning of my circuit working but now I'm stuck with another problem.
I want to use pin_A2 as analog input and have used the basics below have tried everything. I now get all sorts of errors, both in the 16F15325 lib and also in e adc lib.
Can someone help me with the right setting?
-- Step 1: ADC analog input pin setup
?????const byte ADC_CHANNEL = 2 -- Potentiometer connected to pin_A2
?????ANSELA_ANSA2 = TRUE -- Channel 2 is analog input
-- Step 2: Set VDD and VSS as Vref
?????ADCON1_ADPREF = 0b00
?????ADCON1_ADNREF = FALSE
-- Step 3: Use Frc as ADC clock
ADCON1_ADCS = 0b111
?????const ADC_RSOURCE = 10_000 -- Input resistance: 10K potentiometer
-- Now we can include the library
????include adc
-- And initialize the whole with our parameters
?????adc_init()
Op donderdag 20 april 2023 om 12:35:15 UTC+2 schreef hans: