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:
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.
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:
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?
PSoC5 LP MCU
Here are schematic snips of two circuits that builds without the error/warning.
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.
"Engineering is an Art. The Art of Compromise."
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.