Can not get my ADC mVolts readings to work with my If statement

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

cross mob
lock attach
Attachments are accessible only for community members.
Doorknob
Level 4
Level 4
First solution authored 50 replies posted 25 replies posted

I am running to actuators in two directions using 4  digitally controlled 1/2 bridge that have a current sense I read into my PSoC4.

In my code, I read the values in debug and they do match actual values from my scope. Yet when I do this simple if statement it does not compute properly.  When the code is ran it see's the if statement as true, what am I missing?  My  C coding skills are not first class for sure!!

Can some one tell what i am doing wrong.

Thanks

Doorknob_0-1673924485366.png

 

 

 

0 Likes
1 Solution
Alice_Wang
Moderator
Moderator
Moderator
First like received 50 sign-ins 5 solutions authored

Hi,

As my understanding, please change the "if statement" to below:

if((Motor1_Fwr_mVolts>=Current_Limit_mV)||(Motor1_Rev_mVolts>=Current_Limit_mV))

 

Best Regards,

Alice

 

 

 

View solution in original post

0 Likes
1 Reply
Alice_Wang
Moderator
Moderator
Moderator
First like received 50 sign-ins 5 solutions authored

Hi,

As my understanding, please change the "if statement" to below:

if((Motor1_Fwr_mVolts>=Current_Limit_mV)||(Motor1_Rev_mVolts>=Current_Limit_mV))

 

Best Regards,

Alice

 

 

 

0 Likes