PWM ChangePeriod Macro not working PIC18F14K50

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

Post Reply
dproffer
Posts: 5
Joined: Thu May 24, 2012 2:03 am
Has thanked: 2 times
Contact:

PWM ChangePeriod Macro not working PIC18F14K50

Post by dproffer »

Hello,

Can someone advise me as to what I am doing incorrect in the attached Flowcode 5.2 code. The objective is to start the single PWM of the PIC18F14K50 at one PWM period, halt the PWM disable it, change the PWM period to a different value and restart the PWM.

The only PWM period setting that seems to take in Flowcode are those set using the Ext Properties of the PWM Panel, using the ChangePeriod() macro does not seem to work.

Also the displayed values for the PWM Period both in the Component Properties and Simulation display do show the same values and both values shown appear to not match the actual PWM period.

Thanks in advance,

Dave
Attachments
simple_pwm_02.fcf
Simple PWM Flowcode program to test PWM period change
(7 KiB) Downloaded 312 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: PWM ChangePeriod Macro not working PIC18F14K50

Post by Benj »

Hello Dave,

It looks like the original property settings are used when enabling the PWM channel. Is it possible for you to edit the settings without first disabling the PWM output as I believe this should work. If not then let me know and I will show you how to get around this bug.

dazz
Posts: 1314
Joined: Sun Jan 15, 2012 3:15 pm
Has thanked: 474 times
Been thanked: 458 times
Contact:

Re: PWM ChangePeriod Macro not working PIC18F14K50

Post by dazz »

Hi Dave
not sure if this will work but ive slightly changed your flow code so rather than disable and reenable pwm it sets to 0

Regards
Dazz
simple_pwm.fcf
(11.5 KiB) Downloaded 361 times
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

dproffer
Posts: 5
Joined: Thu May 24, 2012 2:03 am
Has thanked: 2 times
Contact:

Re: PWM ChangePeriod Macro not working PIC18F14K50

Post by dproffer »

Hi Dazz,


Thank you very much for your reply and code review! I did a quick test of what you uploaded and it appears to work, moving the PWM from 48kHz to 64kHz. My quick review of your code, and I will do a more in-depth in the morning is that you physically change the PWM period to zeros rather than my disable/enable step. Sure did not find any documentation from Matrix on this procedure, that's weak.

Thanks again,

Dave Proffer

Post Reply