chipKIT WifFire external ADC referance

Post Reply
User avatar
Jacob Christ
Posts: 723
Joined: Sat May 28, 2011 6:34 am
Location: Southern California
Contact:

chipKIT WifFire external ADC referance

Post by Jacob Christ » Thu Oct 20, 2016 2:05 am

Some magic tricks had to be performed when Digilent make the chipKIT WiFire due to building the boards with different revisions of uC Silicone. Because of this the ADC code is not quite up to snuff at this time. Today we had to use and external reference and we ended up adding the following code to setup() to get this to work. This was tested on both a Rev B and Rev C WiFire boards. This code will use +VREF and AVss as your referances. If you need a different configuration refer the the ADC datasheet for the MZ parts to determine how these bits need to be set.

#if defined(__32MZ2048ECG100__)
AD1CON3bits.VREFSEL = 0b001;
// no need for EF code on an EF processor, just use the compiler supplied headers
#elif defined(__32MZ2048EFG100__)
ADCCON3bits.VREFSEL = 0x001;
#endif

Jacob
PONTECH Quick240 an industrial form factor platform for chipKIT and Arduino users.

jmlynesjr
Posts: 149
Joined: Sun May 27, 2012 5:49 pm
Location: Lakeland, Florida USA

Re: chipKIT WifFire external ADC referance

Post by jmlynesjr » Thu Oct 20, 2016 7:42 pm

Jacob:

Is there a typo in your code example?

0b001 vs 0x001

James

User avatar
majenko
Site Admin
Posts: 2164
Joined: Wed Nov 09, 2011 7:51 pm
Location: UK
Contact:

Re: chipKIT WifFire external ADC referance

Post by majenko » Thu Oct 20, 2016 8:24 pm

Probably, however 1 in binary is the same as 1 in hexadecimal...
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".

User avatar
Jacob Christ
Posts: 723
Joined: Sat May 28, 2011 6:34 am
Location: Southern California
Contact:

Re: chipKIT WifFire external ADC referance

Post by Jacob Christ » Thu Oct 20, 2016 8:41 pm

I was testing you. You passed.

Jacob
PONTECH Quick240 an industrial form factor platform for chipKIT and Arduino users.

Post Reply