Cy_LPComp_GetCompare() return value when reference voltage and input voltage is same?

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

cross mob
prudhvi1
Employee
Employee
5 sign-ins First reply posted First question asked

I am using Cy_LPComp_GetCompare() API to compare the input volage and reference voltage. As per API description in PDL library it returns non-zero value when the voltage connected to the positive input is greater than the negative input voltage. 
What happens when input voltage and reference voltage is same?
What is the return value of Cy_LPComp_GetCompare() API ?

0 Likes
1 Solution

Hi @prudhvi1 ,

In general, when a comparator's positive and negative inputs have the same voltage, the output of the comparator will be unpredictable and may be either high or low, depending on the specific comparator design and operating conditions.
To ensure predictable behavior in all operating conditions, it is recommended to properly bias or offset the inputs to the comparator to avoid having the same voltage at both inputs.

Best Regards,
Rakesh

View solution in original post

0 Likes
3 Replies
Rakesh_Patrudu
Moderator
Moderator
Moderator
25 solutions authored 5 likes given 50 replies posted

Hi @prudhvi1 ,

Cy_LPComp_GetCompare function returns a nonzero value when the voltage connected to the positive input is greater than the negative input voltage. Could you please explain why you chose both the input and reference voltages same? Please also specify the PSoC device you are using.

Best regards,
Rakesh

 

0 Likes

I am using PSoC4 4100S plus device (CY8CKIT-149). I am making the device go to deepsleep when the +ve input is less than -ve input. If +ve input greater than -ve input the LED will blink continuously. 

So I wanted to know the behavior if both voltages are same. Can you please clarify my doubt, What is the return value of Cy_LPComp_GetCompare function if +ve and -ve voltages are same?

0 Likes

Hi @prudhvi1 ,

In general, when a comparator's positive and negative inputs have the same voltage, the output of the comparator will be unpredictable and may be either high or low, depending on the specific comparator design and operating conditions.
To ensure predictable behavior in all operating conditions, it is recommended to properly bias or offset the inputs to the comparator to avoid having the same voltage at both inputs.

Best Regards,
Rakesh

0 Likes