PWM I want know how to use

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

Moderators: Benj, Mods

Post Reply
Ondra
Posts: 325
Joined: Wed Aug 29, 2007 7:33 pm
Been thanked: 2 times
Contact:

PWM I want know how to use

Post by Ondra »

I would like to know if there are any Flowcode tutorials on using
PWM, hopefully with some hardware examples also.


Ondra

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

Post by Steve »

We don't have any examples to hand, but the PWM component is fairly easy to use.

The period of the PWM can be set within the "properties" window of the component (click the down arrow on the component and select "properties...").

To use it, set the duty cycle appropriately using the "SetDutyCycle" macro (the nDuty parameter needs to be between 0 and the value of the period register set in the properties window). You then need to enable it using the "Enable" macro.

The nIdx value needs to be 1 or 2 (if the chip has more than 1 PWM output).

khaled yasin
Posts: 43
Joined: Sat Sep 13, 2008 10:36 pm
Contact:

Re: PWM I want know how to use

Post by khaled yasin »

i know how to use the PWM icon but i dont know how set the pins in a 16F877 to send it to an H-bridge L298N,do i have to state an output before calling the PWM macro or after????

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 I want know how to use

Post by Benj »

Hello

Please post in the appropriate places on the forum, Also please do not repeat the same posts around the forum it just makes more work for me.

The PWM component directly controls the I/O pins referred to as CCP1 and CCP2 (if you have a device with 2 channel PWM) on the chip diagram. No input or output icons have to be called. For using the motor control as per my article you need two extra digital outputs ontop of the existing 2 channel PWM to control the motor directions.

Post Reply