pwm disabled

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

Post Reply
jlschuck
Flowcode v5 User
Posts: 12
Joined: Tue Apr 30, 2013 5:40 pm
Has thanked: 7 times
Been thanked: 1 time

pwm disabled

Post by jlschuck »

I am using the Professional version of Flowcode 5 AVR. I want to generate a pwm signal that is proportional to an analog input signal. When I select the PWM block from the mechatronics menu and place it in the work panel it shows up as "disabled".

The PWM(0) function is greyed out. Indicating to me that according to Flowcode 5, the ATXmega64A3 does not have a pwm function.

However, according to the Atmega64A3 data sheet, on page 52, table 30-3, pin 20 is PC4. PC4 has alternate functions TCC1, which is the timer capture and compare, and AWEXC, advanced waveform executable.

Anyone have the same experience?

Thanks

dazz
Posts: 1314
Joined: Sun Jan 15, 2012 3:15 pm
Has thanked: 474 times
Been thanked: 458 times

Re: pwm disabled

Post by dazz »

HI
You need to enable the pwm channel or it will say disabled in the panel(until enabled and sim run)
pwm channels for that chip are as follows

PC0=Pwm channel 1
PC1=Pwm channel 2
PC2=Pwm channel 3
PC3=Pwm channel 4
PC4=Pwm channel 5 ***
PC5=Pwm channel 6

See attached flowchart

Regards
Dazz
pwm.fcf_avr
(8.5 KiB) Downloaded 323 times
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

jlschuck
Flowcode v5 User
Posts: 12
Joined: Tue Apr 30, 2013 5:40 pm
Has thanked: 7 times
Been thanked: 1 time

Re: pwm disabled

Post by jlschuck »

Hello Dazz,

Thanks for your help with the pwm disabled problem. I guess I should have stayed awake during the component macro section of the Flowcode tutorial. But now that you have shown me how to get the pwm enabled and running I can't seem to connect it to PC4 or any pin for that manner. It keeps telling me there are no connections for this device. Can you help?

dazz
Posts: 1314
Joined: Sun Jan 15, 2012 3:15 pm
Has thanked: 474 times
Been thanked: 458 times

Re: pwm disabled

Post by dazz »

Hi
Pwm's are software assigned, you assign it to pins by right clicking the pwm component on the panel, select ext properties, then choose a channel see my list below for the channels to pins, if you also select chip view and look at the channels here you will see how atmel number them and flowcode assigns them

PIN Flowcode Atmel
PC0=Pwm channel 1=OC0A
PC1=Pwm channel 2=OC0B
PC2=Pwm channel 3=OC0C
PC3=Pwm channel 4=OC0D
PC4=Pwm channel 5=OC1A
PC5=Pwm channel 6=OC1B


Regards
Dazz
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

jlschuck
Flowcode v5 User
Posts: 12
Joined: Tue Apr 30, 2013 5:40 pm
Has thanked: 7 times
Been thanked: 1 time

Re: pwm disabled

Post by jlschuck »

Hello Dazz,

Fantastic, thanks for the information. I suppose that is in the help file explanation for configuring PWM(0), sort of, but not as clearly as you state it. So I did as you said and selected channel 5 for PC4. Then I connected an led to PC4 hoping I could brighten or dim the led according to the duty cycle. No luck. So again I am lamely asking for your help. Thanks.

By the way, I am an old analog guy with about 25 yrs experience so if you need any help with the hardware side of things I'd be glad to help.

dazz
Posts: 1314
Joined: Sun Jan 15, 2012 3:15 pm
Has thanked: 474 times
Been thanked: 458 times

Re: pwm disabled

Post by dazz »

Hi
Can you post your flowchart please

Regards
Dazz
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

jlschuck
Flowcode v5 User
Posts: 12
Joined: Tue Apr 30, 2013 5:40 pm
Has thanked: 7 times
Been thanked: 1 time

Re: pwm disabled

Post by jlschuck »

Here you are Dazz. I tried looking for examples of how to add an led to a port on the chip, no luck. I did connect the led to pin 4 and the inserted the LED macro. I edited the LED macro to LED(on) and then ran flowcode. The LED did light up, however it did respond to the pwm.

Thanks again.
Attachments
testpwm.fcf_avr
(8.5 KiB) Downloaded 295 times

dazz
Posts: 1314
Joined: Sun Jan 15, 2012 3:15 pm
Has thanked: 474 times
Been thanked: 458 times

Re: pwm disabled

Post by dazz »

Hi
For Pwm you dont need to add anything to the port as the Pwm is an output(add an led to that pin in hardware), if you put an led on the pin in flowcode it wont do anything as it cant be simulated, dont worry it took me a while to work it out when i started with flowcode

Is the pwm working on hardware coulnt work out if it works or not from your post

Regards
Dazz
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

jlschuck
Flowcode v5 User
Posts: 12
Joined: Tue Apr 30, 2013 5:40 pm
Has thanked: 7 times
Been thanked: 1 time

Re: pwm disabled

Post by jlschuck »

Hi Dazz,

I haven't tried it on hardware yet. I will tonight after work and get back to you. I saw elsewhere on the forum other people are having trouble simulating the pwm output in flowcode. Now I know why. I was considering using flowcode for work, but it appears it is geared more towards Microchip than Atmel.

dazz
Posts: 1314
Joined: Sun Jan 15, 2012 3:15 pm
Has thanked: 474 times
Been thanked: 458 times

Re: pwm disabled

Post by dazz »

Hi
its virtually the same for all chip versions, the pwm simulates in its component you can see the period and duty cycle its the same for all chips( took me a good while to work out :lol:), If you get stuck with anything just holler as someone is always willing to help out, did you know you can also cross import fcf files from other chip versions, ie if a flowchart was posted for a pic you can import it into flowcode_avr just change the chip and pin assignments etc, which again expands its useabilty.

For work v6 might be a good option as you can build your own components (a little difficult at first but gets easier) , and in time there will be a website for user made components for free or for sale,
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

Post Reply