Hi Hans,

There are two issues:

  1.  ADCON1_ADNPREF does not exist so should be removed.
  2.  The adc library assumes a register called ADCON0_GO but it is called 
ADCON0_GONDONE for this chip. I added an alias to solve that (will also fix it 
in the adc library.

So this code compiles.

-- Step 1: ADC analog input pin setup
const byte ADC_CHANNEL = 2 -- Potmeter connected to pin_A2
ANSELA_ANSA2 = TRUE -- Channel 2is analog input
-- Step 2: Set VDD and VSS as Vref
ADCON1_ADPREF = 0b00
-- Step 3: Use Frc as ADC clock
ADCON1_ADCS = 0b111
const ADC_RSOURCE = 10_000 -- Input resistance: 10K potmeter
-- Define alias to solve problem with ADC library
alias ADCON0_GO is ADCON0_GONDONE
-- Now we can include the library
include adc
-- And initialize the whole with our parameters
adc_init()


Kind regards,

Rob


________________________________
Van: [email protected] <[email protected]> namens hans 
<[email protected]>
Verzonden: zaterdag 22 april 2023 15:50
Aan: jallib <[email protected]>
Onderwerp: [jallib] Re: 16F15325 blink a led

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:
Sorry, have used a damaged led, now the blink is working. Up to the next step.

Op donderdag 20 april 2023 om 11:05:50 UTC+2 schreef hans:
I am working with the 16F15325 to use for the NRF24101 but it does not work. So 
i have tried the blink a led from the sample and that  works also not. Used 
anaother pic.. same result.
atached the files
The old man's problems???
Hans

--
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
[email protected]<mailto:[email protected]>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jallib/c733f6eb-f4ba-4822-b79f-974ca34dc7f1n%40googlegroups.com<https://groups.google.com/d/msgid/jallib/c733f6eb-f4ba-4822-b79f-974ca34dc7f1n%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jallib/GVXP195MB1637E0104390CA103BEEBB44E6619%40GVXP195MB1637.EURP195.PROD.OUTLOOK.COM.

Reply via email to