Page 1 of 1

PWM problem in Flowcode V6

Posted: Wed Dec 13, 2023 4:29 am
by ncc1502
Hi,
For a test I need to simulate a load cell.
The cell outputs a block signal of about 16470 Hz with no load and about 17850Hz at full load.

I have the latest version of Flowcode V6, a board with a PIC 18F4520 at 8 mHz. HS-PLL --> 32mHz.

I was thinking about using PWM and changing the base frequency instead (of the duty cycle)
If I select PWM with timer 2, a prescaler of 4 and a Period between 111 and 121 the frequency calculated by Flowcode is about correct for what I need.

I run into some problems, Flowcode says Duty cycle is a byte and 128 is about 50%.
In Hardware 50% Dutycycle is with setting 61 (checked with Oscilloscope). Any value above about 120 is constant output (this is also in sumulation)
In simulation the base frequency changes to the expected values when I change the Period between 111 and 121.

In Hardware the frequency does not change, it is about 18 kHz.In my scope screen nothing happens, the frequency it measures does not change.
Time of 1 periode should change between 56 uS and 50 uS, with a 10 uS timebase it should be half of a raster difference on screen

I can check with my LCD display that the ADC value of the potmeter is correct. The frequency is the calculated value of Flowode for the periods 111 to 121.

Does anybody know what is wrong

Re: PWM problem in Flowcode V6

Posted: Thu Dec 14, 2023 2:21 am
by ncc1502
Fixed with help from Medelec.