Coding error in Training Video & Github code - PSoC6 101 - Lesson 2-2b

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

cross mob
BoBr_4596421
Level 3
Level 3
First like received

Hi All,

Any help with some coding would be greatly appreciated. I am relatively new to this, so the training videos have been a fantastic resource to help get going.

I think there is an error in the above tutorial as it will not compile error-free.

The first point to note is that the code on GitHub differs from the code in the video in some respects - I suppose this is normal catching up on errata.

The main point of this thread is the following suspect line in the code

"Cy_TCPWM_PWM_GetCompare0 (hw, cntrNum, percentToCompare(percentTmp) );"   (my speech marks).

According to the PSoC Creator, this command should only have two arguments.

This is the last line of code in "pwmTask.c"

If I reduce it to two arguments by arbitrarily removing the argument "cntrNum", then the code compiles without error. I'm not convinced it runs correctly though as the motor status does not change when I send keyboard commands - but that's to be expected when you randomly delete code!

GitHub reference is PSoC6-101-Video-Projects/pwmTask.c at master · cypresssemiconductorco/PSoC6-101-Video-Projects · Git...

Video reference is PSoC 6 101: Lesson 2-2b Implementing PWM into BLE Controlled Robotic Arm Project - YouTube

Thanks in advance for any insights

Bob

0 Likes
1 Solution
ShipingW_81
Moderator
Moderator
Moderator
500 replies posted 250 solutions authored 250 replies posted

It looks from the video that the API Cy_TCPWM_PWM_SetCompare0() has 3 arguments, not Cy_TCPWM_PWM_GetCompare0().

Cy_TCPWM_PWM_GetCompare0() has 2 arguments as shown in PSoC Creator.

View solution in original post

0 Likes
2 Replies
ShipingW_81
Moderator
Moderator
Moderator
500 replies posted 250 solutions authored 250 replies posted

It looks from the video that the API Cy_TCPWM_PWM_SetCompare0() has 3 arguments, not Cy_TCPWM_PWM_GetCompare0().

Cy_TCPWM_PWM_GetCompare0() has 2 arguments as shown in PSoC Creator.

0 Likes

WangS_81

Many thanks for spotting my typing error - the function I needed was indeed 'SetCompare0' and not 'GetCompare0'. My motors are now operating correctly.

regards

Bob

0 Likes