cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 6 MCU

BoBr_4596421
New Contributor II

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

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

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
BoBr_4596421
New Contributor II

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
Top labels