Flowcode V8.2.0.12
PIC 16F1704
I have a very simple test of Enable the PWM and set the 8 bit Duty Cycle. I also have a 1 second test running. I am watching with the oscilloscope. The 1 second test shows on the scope. Nothing for the PWM. I have tried Channel 1,2,3,4 / Timers 2,4,6 and routing the output to various pins (currently C.3)
I have also tried with different PIC chips with no results. Full disclosure: I am new to flowcode - usually program at assembler level. My feeling is I am missing something that would be obvious to a seasoned user.
I have read other PWM threads here, but they are years old.
Thanks!
PWM won't run in simulator
Moderator: Benj
- diversedevices
- Posts: 5
- Joined: Mon Aug 26, 2019 11:36 pm
- Has thanked: 2 times
- Been thanked: 2 times
- Contact:
- 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 won't run in simulator
Hello,
We do try and put everything on the scope that we can however PWM is currently not supported. This is mainly because it has the ability to cause the simulator to run slowly also precise timings (sub ms) will be extremely complex to generate in the simulator and so waveforms will likely be wrong.
To get around this the wave form is instead shown on the component on the panel.
I'm in the process of releasing a document that shows exactly what does and doesn't simulate.
We do try and put everything on the scope that we can however PWM is currently not supported. This is mainly because it has the ability to cause the simulator to run slowly also precise timings (sub ms) will be extremely complex to generate in the simulator and so waveforms will likely be wrong.
To get around this the wave form is instead shown on the component on the panel.
I'm in the process of releasing a document that shows exactly what does and doesn't simulate.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- diversedevices
- Posts: 5
- Joined: Mon Aug 26, 2019 11:36 pm
- Has thanked: 2 times
- Been thanked: 2 times
- Contact:
- diversedevices
- Posts: 5
- Joined: Mon Aug 26, 2019 11:36 pm
- Has thanked: 2 times
- Been thanked: 2 times
- Contact:
Re: PWM won't run in simulator
I have programmed an actual chip with this code and the 1 second test output works, but nothing on the PWM.
Is there something else that needs to be done to create the output?
Is there something else that needs to be done to create the output?
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
- Contact:
Re: PWM won't run in simulator
Try setting the period register (see properties) to a value greater than the (128) duty setting (e.g. 255)
- diversedevices
- Posts: 5
- Joined: Mon Aug 26, 2019 11:36 pm
- Has thanked: 2 times
- Been thanked: 2 times
- Contact:
Re: PWM won't run in simulator
Thank you for the quick reply, Leigh.
I tried altering the period without success, I tested the hardware to make certain C.3 was functioning, I tried combinations of Channel 1,2,3,4 with Timers 2,4 & 6. I have tried two different chips (just in case). Compiles within FlowCode without errors.
I also just tried substituting a 16F1825 and running this, and not output on PWM. I must be missing something very basic.
I tried altering the period without success, I tested the hardware to make certain C.3 was functioning, I tried combinations of Channel 1,2,3,4 with Timers 2,4 & 6. I have tried two different chips (just in case). Compiles within FlowCode without errors.
I also just tried substituting a 16F1825 and running this, and not output on PWM. I must be missing something very basic.
- diversedevices
- Posts: 5
- Joined: Mon Aug 26, 2019 11:36 pm
- Has thanked: 2 times
- Been thanked: 2 times
- Contact:
Re: UPDATE: PWM won't run in simulator
I saw that there are 2 PWM functions. One is in the "Creation" section and the other is in the "Output" section. I emailed Matrix and the reply was that they are the same (but you have to pay extra for the one in the Output section which is included with the Basic IO purchase).
I went ahead and purchased the BASIC IO, set up the Output PWM and it WORKS as expected. The screenshot shows the two different PWM's. The PWM1 is the Output PWM, and the cal_pwm1 is the "Creation PWM'.
I suspect the "Output PWM' creates a PWM using microcontroller resources and the "Creation PWM' was intended to use the PWM function in many of the PIC processors.
I went ahead and purchased the BASIC IO, set up the Output PWM and it WORKS as expected. The screenshot shows the two different PWM's. The PWM1 is the Output PWM, and the cal_pwm1 is the "Creation PWM'.
I suspect the "Output PWM' creates a PWM using microcontroller resources and the "Creation PWM' was intended to use the PWM function in many of the PIC processors.