Announcements

Equip yourself to optimize PSoc4 MCUs for Evs at the EV Webinar. Click here to register.

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

PSoC™ 4 Forum Discussions

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 Reply
Alice_Wang
Moderator
Moderator
Moderator
First solution authored First reply posted 10 sign-ins

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