Stop runtime error crashes caused by pwm duty set negative.

Moderator: Benj

Post Reply
medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Stop runtime error crashes caused by pwm duty set negative.

Post by medelec35 »

If I use a look up table in C, and from that calculate a pwm duty value. If this calculated duty value is negative (because C is not simulated, the look up table result in simulation will always be 0.) Then Flowcode crashes.
My suggestion would be to have a pop up box warning of negative duty values, then if click continue, either a zero should be set or this crashing should be fixed.
Martin

Sean
Valued Contributor
Valued Contributor
Posts: 548
Joined: Tue Jun 26, 2007 11:23 am
Has thanked: 6 times
Been thanked: 44 times
Contact:

Re: Stop runtime error crashes caused by pwm duty set negative.

Post by Sean »

Thanks for reporting this bug. It was in the code used to simulate the SetDutyCycle10bit macro and has now been fixed. The bug would have also affected positive numbers requiring more than 10-bits.

Simulation will now produce the same response as the hardware:
  • Negative numbers and large numbers will be accepted without any error.
    The lower 10 bits of the duty cycle will be extracted as a bit-pattern and used as an unsigned value.
This means that negative number, and numbers requiring more than 10-bits, can be used by the component and will be converted to the required format.

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Stop runtime error crashes caused by pwm duty set negative.

Post by medelec35 »

I’m assuming it is in the PWM component code.Is it possable for a updated file to be posted please?
I have another suggestion. Create a New sticky for all updated files. E.g. all updated component .C and Chip .fcd.

I noticed on V3 section that if any file was updated and posted in a thread after the problem has been posted, then in another thread the same file has been posted. If all files are posted in just one thread only, then if there is a problem, we wont' need to search though loads of threads to find updated file.
Martin

Sean
Valued Contributor
Valued Contributor
Posts: 548
Joined: Tue Jun 26, 2007 11:23 am
Has thanked: 6 times
Been thanked: 44 times
Contact:

Re: Stop runtime error crashes caused by pwm duty set negative.

Post by Sean »

The problem was in to .ocx file for the component. An update is now available from the Flowcode V4 section of our support centre.

Here is the link:

http://www.matrixmultimedia.com/support ... =1183#1183

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Stop runtime error crashes caused by pwm duty set negative.

Post by medelec35 »

Thank you Sean for your quick response and solving crashing issue.
Martin

User avatar
Steve
Matrix Staff
Posts: 3422
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Re: Stop runtime error crashes caused by pwm duty set negative.

Post by Steve »

Good point about the location of updates. We will try to make sure all updates have their own place in the FAQ site, and we do not post fixes directly to the forum. Also, we'll make sure the FAQ post defines the version of Flowcode that the fix applies to, so that users of a later version of Flowcode will know it's not applicable to them.

saschech@gmx.de
Posts: 714
Joined: Wed Jan 31, 2007 12:41 pm
Has thanked: 1 time
Been thanked: 26 times
Contact:

Re: Stop runtime error crashes caused by pwm duty set negative.

Post by saschech@gmx.de »

Hallo Steve

"We will try to make sure all updates have their own place in the FAQ site"

What name and where are the place of this site?

Regards Wolfgang

User avatar
Steve
Matrix Staff
Posts: 3422
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Re: Stop runtime error crashes caused by pwm duty set negative.

Post by Steve »

Updates for Flowcode V4 will be available here:
http://www.matrixmultimedia.com/support ... m.php?f=22

Post Reply