I would like to know if there are any Flowcode tutorials on using
PWM, hopefully with some hardware examples also.
Ondra
PWM I want know how to use
- Steve
- Matrix Staff
- Posts: 3421
- Joined: Tue Jan 03, 2006 3:59 pm
- Has thanked: 114 times
- Been thanked: 422 times
- Contact:
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).
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).
-
- Posts: 43
- Joined: Sat Sep 13, 2008 10:36 pm
- Contact:
Re: PWM I want know how to use
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????
- 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
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.
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.
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