fvrsetup on 20X2...??

pxgator

Senior Member
Of course the compiler on PE6 will not accept any kind of a fvrsetup
on the 20X2. I'm wondering if there are any 'workarounds' to be able
to use the internal 1.024, 2.048, 4.096 refs for the ADC channels on
the 20X2.

Cheers to All
 

Goeytex

Senior Member
It would probably be easier and less time consuming to get a chip that is supported by FVRSETUP.

That being said, the PICAXE 20X2 is based upon the PIC18F14K22 that does indeed have an internal voltage reference module. You should be able to use POKESFR to enable and set the FVR by writing to FVRCON register. You will then need to connect the ADC VREF+ internally to FVR, This is also done via POKESFR of the approrriate ADC register.

The registers to configure and their memory addresses can be found in the PIC18F14K22 Datasheet. POKESFR is explained in PICAXE Manual 2.

Good Luck
 

pxgator

Senior Member
It would probably be easier and less time consuming to get a chip that is supported by FVRSETUP.

That being said, the PICAXE 20X2 is based upon the PIC18F14K22 that does indeed have an internal voltage reference module. You should be able to use POKESFR to enable and set the FVR by writing to FVRCON register. You will then need to connect the ADC VREF+ internally to FVR, This is also done via POKESFR of the approrriate ADC register.

The registers to configure and their memory addresses can be found in the PIC18F14K22 Datasheet. POKESFR is explained in PICAXE Manual 2.

Good Luck

Well, yes of course, I use the 08M2 and 14M2 on a regular basis but that was not the question. I downloaded the PIC18F14K22
data sheet but can't seem to find the actual addresses of the appropriate registers.

Cheers to All
 

Goeytex

Senior Member
I downloaded the PIC18F14K22
data sheet but can't seem to find the actual addresses of the appropriate registers.
Register Address are typically detailed in the Memory Organization Section of every PIC datasheet. For the 18F14K22 the SFR addresses are in Table 3-1 Page 38

The FVR and its Registers are explained in Section 20
The ADC and its Registers are explained in Section 16
 

pxgator

Senior Member
See posts #7 and #10. I believe that was a definitive conclusion that it cannot be done on a 20X2. Someone may want to re-test, check they get the same results as I did.
I accept your answer as final Sir. Even though I don't post much on this forum I do read many posts/threads and your expertise
has been of enormous help to me. I think that some very smart people write the Picaxe firmware so there must be a very good
reason they don't allow fvrsetup on the 20X2.

Case Closed
Cheers to All

However I am pleased that calibadc10 works just fine on the 20X2
 
Last edited:
Top