PIC16F877A-PWM Output x 2

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

Moderator: Benj

Post Reply
KrisJeff
Flowcode v5 User
Posts: 25
Joined: Sun Feb 01, 2009 5:32 pm
Location: Albox, Almeria, Spain.
Has thanked: 4 times
Contact:

PIC16F877A-PWM Output x 2

Post by KrisJeff »

I require 2 PWM outputs from my 16F877A. I can simulate OK but the chip only outputs to PWM-1 I realize that you can assign the PWM outputs to the pins require but I just cant understand how? In properties I can highlight the pwm_pin and nothing comes up to confirm the pin? Also can expose but again it doesn't seem to do anything? It's driving me bonkers. I thought that enabling each PWM it would output to both PWM pins. However, although simulating OK it only outputs to the one PWM outhttp://www.matrixtsl.com/mmforums/download/fil ... d=28363put (CCP1)?
Attachments
PWM_fader16F877A O&C.fcfx
(15.82 KiB) Downloaded 278 times

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: PIC16F877A-PWM Output x 2

Post by Benj »

Hello,

The Channel property allows you to map the peripheral the component will use the generate the PWM signal. The pin propery simply shows the pin used by the selected peripheral. If only one channel exists then your target device only has one PWM peripheral on-board.

You can use software to generate PWM using for example a timer interrupt if you do not have enough hadware channels on your device.

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: PIC16F877A-PWM Output x 2

Post by medelec35 »

Hi KrisJeff,
If you look at the properties of the PWM components on 2D panel:
PWM1.png
(259.56 KiB) Downloaded 1027 times
You can see that PWMs are both set to Channel1 and frequencies are different.
Also, You can see in the properties the pin PWM output should appear on.
You need to set PWM2 to Channel2:
PWM2.png
(24.1 KiB) Downloaded 1027 times
and make sure the period overflow and prescaler are matching on both channels.
Martin

KrisJeff
Flowcode v5 User
Posts: 25
Joined: Sun Feb 01, 2009 5:32 pm
Location: Albox, Almeria, Spain.
Has thanked: 4 times
Contact:

Re: PIC16F877A-PWM Output x 2

Post by KrisJeff »

Dear medelec,
Thank you. I'm new to version 8. My properties panel was not set wide enough so I could only see the left column? What a plonker?
Thank you so much. :D

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: PIC16F877A-PWM Output x 2

Post by medelec35 »

You have not used Flowcode before so an easy mistake to make.
Within the Learning Centre You will find a useful Introduction to Microcontroller Programming course.
Although created using V7, It should be compatible with V8.
There are plenty of training videos as well.
Thanks for letting us know issue is resolved.
Martin

Post Reply