How can I connect an analog pin to an ADC and a comparator?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
HuEl_264296
Level 5
Level 5
First like given 25 sign-ins First solution authored

Hi,

I would like to sample an analog input pin with an ADC, but also generate an interrupt if the pin voltage falls below a certain level. So I wired up my schematic like this:

HuEl_264296_2-1673738135861.png

 

However, it won't build, giving the error message:

"Net_453" is expected to connect to only one GPIO analog pin but instead it connects to "\Comp:ctComp\". Please fix the connection.

When I wire the comparator to a separate pin, it builds fine.

HuEl_264296_1-1673738042845.png

But this isn't want I want.

What I can't understand is why this limitation is there. Looking at the analog layout, I can see that the GPIO pin could be connected to both the comparator and the ADC. The connection is right there, circled in red in this image:

HuEl_264296_0-1673737920601.png

If only that connection could be enabled, the pin would connect to both.

Is there any way to connect the pin to both the comparator and the ADC?

Is there any other way to solve this problem?

0 Likes
1 Solution
odissey1
Level 9
Level 9
First comment on KBA 1000 replies posted 750 replies posted

HuEl,

I believe that ADC_SAR_Seq is using Analog Hardware Mux to switch the channels. The picture of ADC_SAR_Seq is deceiving - there is no any Mux inside! The problem is, this Mux is not a separate piece of hardware, which has input lines to the Pins. Instead it made using actual Pins' hardware and resides inside the Pins. It is not possible to attach to the input lines, as there are no input lines! - The ADC_SAR just switches its single input between the Pins.  

 

However, it is possible to connect Comparator to a separate Pin, and wire it externally to the desired ADC pin. 

View solution in original post

0 Likes
3 Replies
Len_CONSULTRON
Level 9
Level 9
Beta tester 500 solutions authored 1000 replies posted

HuEl,

Here are schematic snips of two circuits that builds without the error/warning.

Len_CONSULTRON_0-1673819229901.png

Len_CONSULTRON_1-1673819346861.png

 

You will notice that I changed the ADC_SAR_Seq to a Amux and ADC_SAR or ADC_DelSig.

The ADC_SAR_Seq component has a test for attachment of only ONE GPIO analog input.  If it has more than one connection to anything else, it will throw an error during the build process.   I don't know the actual reason the author of the component chose to do this since the connections can be made in the PSoC.

However, let me that a guess:   The Input impedance of a ADC_SAR is about 180K ohms.   The AMux will effectively be switching the 180K resistance on the signal line every time it is switched to channel 0.  This might adversely effect the '+' input of the Comparator.  For example, if the source impedance for "Switches" is 180K ohms when the AMux is on channel 0, the voltage on the pin will be 1/2 of what it would be if AMux is on channels 1 or 2.   This could cause the comparator to falsely trigger.

Note:  The ADC_DelSig has an input impedance in the 10's of Megaohms.  Therefore use of the ADC_DelSig should be significantly minimized.

If you chose either of the two circuits above, you have the responsibility of controlling the AMux in your code.

Len
"Engineering is an Art. The Art of Compromise."
odissey1
Level 9
Level 9
First comment on KBA 1000 replies posted 750 replies posted

HuEl,

I believe that ADC_SAR_Seq is using Analog Hardware Mux to switch the channels. The picture of ADC_SAR_Seq is deceiving - there is no any Mux inside! The problem is, this Mux is not a separate piece of hardware, which has input lines to the Pins. Instead it made using actual Pins' hardware and resides inside the Pins. It is not possible to attach to the input lines, as there are no input lines! - The ADC_SAR just switches its single input between the Pins.  

 

However, it is possible to connect Comparator to a separate Pin, and wire it externally to the desired ADC pin. 

0 Likes
HuEl_264296
Level 5
Level 5
First like given 25 sign-ins First solution authored

Hi Len,

Thanks, that's amazing. I'll try that when I get home!

Hugo

0 Likes