PWM problem in Flowcode V6

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 6.

Moderator: Benj

Post Reply
ncc1502
Posts: 48
Joined: Mon Apr 07, 2008 9:18 pm
Has thanked: 23 times
Been thanked: 8 times
Contact:

PWM problem in Flowcode V6

Post 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
Attachments
Load Cell.fcfx
(20.46 KiB) Downloaded 72 times
Better safe then sorry

ncc1502
Posts: 48
Joined: Mon Apr 07, 2008 9:18 pm
Has thanked: 23 times
Been thanked: 8 times
Contact:

Re: PWM problem in Flowcode V6

Post by ncc1502 »

Fixed with help from Medelec.
Better safe then sorry

Post Reply