chipKIT® Development Platform

Inspired by Arduino™

ADC has 2 MUXes

Created Fri, 07 Jun 2013 08:47:46 +0000 by Imolas3


Fri, 07 Jun 2013 08:47:46 +0000

Hi all

I am confused by the PIC32s in the MAX32 and UNO32 board having two MUXes.

Could anyone please explain why?

And how can I ensure I am using the one I think I am (using XC32 compiler)

many thanks


Fri, 07 Jun 2013 09:40:46 +0000

The ADC system in the PIC32 is quite complex. It needs to be to provide the facilities it does.

It has many forms of operation, including:

  1. Single input reading
  2. Scanning input
  3. DMA controlled (ping-pong and straight)
  4. Differential input ... and more ...

Having 2 multiplexers allows you to rapidly switch between two sampling channels. It can be configured so that each subsequent sample automatically switches between MUXA and MUXB. This is great especially if it's configured to be DMA driven. You can sample two channels at high speed directly into DMA memory without the CPU having to do anything.

MUXB is only used if this alternating scheme is configured. Under normal operation it is always MUXA that is in use.

It is possible to combine both the scanning and the alternating (MUXA/MUXB) modes into one, so on even numbered samples (counting from 0) it reads from MUXA which is set to scanning, and on odd numbered samples it reads from MUXB which is connected to just one input. So, if MUXA is set to scan inouts 0-6, and MUXB is set to read from input 7, it would read for a sequence of 16 samples the inputs 0, 7, 1, 7, 2, 7, 3, 7, 4, 7, 5, 7, 6, 7 - and all that can be DMA driven.

Also the different multiplexes can be configured for different "negative" modes of operation - say MUXA is set to "normal" single-ended operation, with IN- connected to VREF-, and MUXB set to "differential" operation, with IN- set to AN1 - two completely different arrangements which could not normally be switched between "on the fly" by the DMA controller.

It makes for an incredibly flexible system.


Fri, 07 Jun 2013 20:38:01 +0000

Many thanks

Makes much more sense now and good to know that default is MUX A