This message contains an entire topic ported from a separate forum. The original message and all replies are in this single message. We have seeded this new forum with selected information that we expect will be of value to you as you search for answers to your questions.
Posted: Mon Nov 14, 2005 10:45 am
I need to sample about 3 analog outputs, while I have (as much as I know) only 1 A/D input. What should I do,
Posted: Mon Nov 14, 2005 1:21 pm
You could use 3 transistors & 3 general purpose I/O pins to multiplex the analog input. Make sure you take into account the voltage drop across the transistor.
Posted: Mon Nov 14, 2005 7:34 pm
>or a single chip that can turn on/off switches to channel one of many into the one
> input pin.
You could use the 74HC4051 to multiplex your 3 analogs to a single input pin as long as you have 2 extra port pin to toggle A,B pin of the 4051. Make sure to tie C low of said chip.
Posted: Mon Nov 14, 2005 11:01 pm
Thank you very much for the help you give me,
I would like to make sure I understood the principle correct:
I should connect 3 transistor in parallel,while all their source legs are connected together, and each drain is connected to a different analog output I would like to sample. The gate of each transistor is from a different general purpose I/O pin.
(for nmos types- I hope I wrote it correct).
This configuration should simulate a mux, and should work for multiple analog inputs, and only 1 ATD input?
Thank you again.
Posted: Tue Nov 15, 2005 7:56 am
Most HC12 and HCS12 devices have one A/D converter, but many A/D input pins (8 or more), that can be multiplexed internally in the microcontroller to the A/D. This allows sampling up to 8 different analog signals using the internal A/D (first sampling input 1, then sampling input 2, etc. etc.). To use this method, you will need to read the details of the A/D peripheral on the specific HC12 derivative you are using.
The other suggestions you previously got, relate to the case that for some reason you have used all 7 other HC12 A/D input pins for other purposes, and have only 1 pin left to be used as an actual input to the A/D. In such a case, people suggested you will use an external analog multiplexor.
Hope this helps,