control PWM duty cycle with input (hold input for time) Atm

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
HMS
Posts: 8
Joined: Thu Jun 09, 2011 6:58 am

control PWM duty cycle with input (hold input for time) Atm

Post by HMS »

Hi,

I made this little program,

I asked this in another thread but I wasnt abel to do this.

My problem is that I would like to change the PWM Signals when an Input (pushbutton is pressed) is done.

If switch "left" is pressed the left PWM (output left) should be around 30% duty cycle and hold for one second.
If switch "right" is pressed the right PWM (output right) should be around 30% duty cycle and hold for one second.

At the moment the duty cycle is only changed during the pushbutton is pressed. How can I change this the best way?

It must also work that when pshbutton left is pressed output left must change the duty cycle for one second, but when within 1 second bushbutto right is presses also the right must change the duty cycle for one second.

it sounds like multitasking for me and I dont know how to do this.

Another thing is I would like to activate the OC2 (third PWM) on my Atmega8. do I need to use a C Code for this?

Thanks
Attachments
control_PWM.fcf_avr
(11.5 KiB) Downloaded 236 times

User avatar
DavidA
Matrix Staff
Posts: 1076
Joined: Fri Apr 23, 2010 2:18 pm
Location: Matrix Multimedia Ltd
Has thanked: 58 times
Been thanked: 258 times
Contact:

Re: control PWM duty cycle with input (hold input for time)

Post by DavidA »

Hi HMS,

Since you are posting a Flowcode V4 program, i will move this topic to the Flowcode V4 forums, if you cannot access the V4 forums then you will need to follow an additional step to get your forum account upgraded.

This link will help you: http://www.matrixmultimedia.com/support ... f=29&t=602

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: control PWM duty cycle with input (hold input for time)

Post by Benj »

Hello,

The simulation is a bit slow but this should work correctly on the hardware to give you around 1 second delays.
Attachments
control_PWM.fcf_avr
(11 KiB) Downloaded 246 times

Post Reply