A/D Design Question

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

A/D Design Question

1,962 Views
ThomasG
Contributor I
Hello all,
 
I am using an A/D converter for the first time on the MC9S12XDP512.  The hw designer wants to perform more measurements than the 24 allotted inputs on this part (~30).  He plans on putting an external mux to select between 8 different inputs that go to one A/D input on the microcontroller.
 
My question is what is the best way to write software to handle this?  Should I use an interrupt or poll to see when a channel has been converted?  Should I do single-channel conversions and change the channel that is read is each ISR (not even sure if this can be done) or do a sequence and change the mux lines after each sequence is complete?  Finally, is there a better way to do this in hw than the above technique that makes the sw easier that I can tell the hw designer to implement (design is still in the early stages)?
 
Just looking for ideas because I don't want to reinvent the wheel so I appreciate any comments.
 
Thanks,
 
Thomas
Labels (1)
0 Kudos
Reply
2 Replies

885 Views
bigmac
Specialist III
Hello Thomas,
 
You could probably make the external analog MUX expansion work OK.  However, a completely different method might also be given consideration.  This is to use a separate low pin count, low cost, 8-bit MCU to provide the ADC expansion channels.  This would probably utilise the SPI to communicate with the main MCU - you would need to devise a suitable protocol.
 
Whether to use interrupts or polling for the ADC would depend to some extent on other tasks performed by the main MCU, and the sampling frequency of the ADC measurements required for each channel.  If you were to use a secondary MCU, it would probably not require interrupt use since it would be dedicated to ADC operation.
 
Regards,
Mac
 
0 Kudos
Reply

885 Views
imajeff
Contributor III
It depends on whether the external mux has enough channels (I think easier because you only continually scan a single input pin). Then the ISR can simply change the mux channel after each completion.

If not, other ideas depend on your needs:
  1. Sequence through whole range of A/D inputs but only change the mux once per sequence completion. That would scan the externally multiplexed channels less often.
  2. On each round, scan the sequence once and then scan all external mux inputs. That gets them all at same sample rate, but sounds like hardest to code.
0 Kudos
Reply