pmw for uno

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
benrouse77
Posts: 26
Joined: Thu Jul 05, 2012 11:29 pm
Has thanked: 12 times
Been thanked: 1 time

pmw for uno

Post by benrouse77 »

Does anyone know how to find out what pins on the arduino uno link up to each PWM on flowcde v5?

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times

Re: pmw for uno

Post by Enamul »

Hi,
This picture might help you..
http://www.google.co.uk/imgres?imgurl=h ... Aw&dur=279

As it shows PWM which FLOWCODE should use.
Enamul
University of Nottingham
enamul4mm@gmail.com

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

Re: pmw for uno

Post by dazz »

Hi Ben
the pwm pins are assigned as follows
PWM 1 PIN D6
PWM 2 PIN D5
PWM 3 PIN B1
PWM 4 PIN B2
PWM 5 PIN B3
PWM 6 Pin D3

These conform to the atmel datasheet pinouts so use the datasheet, give me a few days and i will upload a new fcd with the pwms labeled a bit clearer, hang on a tcik i'll do it now befoire i forget give me a few minutes to do it and test it
Regards
Dazz
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

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

Re: pmw for uno

Post by dazz »

Hi Ben

Fcd is attached with updated chip view, copy it into your fcd folder then select the Arduino Uno PDIP pwm in project options the PWM's are numbered in brackets to thier pins
hope it helps
Regards
Dazz
Arduino Uno PDIP pwm.fcd
(9.73 KiB) Downloaded 358 times
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

benrouse77
Posts: 26
Joined: Thu Jul 05, 2012 11:29 pm
Has thanked: 12 times
Been thanked: 1 time

Re: pmw for uno

Post by benrouse77 »

Thanks daz, this is what I needed. I was looking at the data sheet before and could'nt find it. how do I identify them myself on other chips?

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times

Re: pmw for uno

Post by Enamul »

You have to have a look at the FCD file of that corresponding IC and there is a list in the definition portion. I have only demo version that's why I can't see that last time. But you can see always in FCD floder..
Enamul
University of Nottingham
enamul4mm@gmail.com

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

Re: pmw for uno

Post by dazz »

Hi Ben long post coming up

As enamul said the fcd file need tweaking, i should have added the pwm numbers but the chip views started to get cluttered its simple to rejig them
the most important bit is to copy the fcd's into a folder on your desktop that way if it goes wrong you still have the originals,


open one in the new folder the pins in the chip view are listed near the top of the fcd (arduino uno used as an example) in the following bit you will see it lists the pwms(in red to highlight only) but not the corresponding number that you see in the flowcode component
[Pins]
Pin1="DIGITAL 3 PWM PD3"
Pin2="DIGITAL 4 PD4"
Pin3=
Pin4=
Pin5=
Pin6=
Pin7=
Pin8=
Pin9="DIGITAL 5 PWM PD5"
Pin10="DIGITAL 6 PWM PD6"
Pin11="DIGITAL 7 PD7"
Pin12="DIGITAL 8 PB0"
Pin13="PB1 DIGITAL 9 PWM"
Pin14="PB2 SS DIGITAL 10 PWM"
Pin15="PB3 MOSI DIGITAL 11 PWM INT"
Pin16="PB4 MISO DIGITAL 12 "
Pin17="PB5 SCK DIGITAL 13 LED"
Pin18=
Pin19="ADC6"
Pin20=
Pin21=
Pin22="ADC7"
Pin23="PC0 ANALOG 0"
Pin24="PC1 ANALOG 1"
Pin25="PC2 ANALOG 2"
Pin26="PC3 ANALOG 3"
Pin27="PC4 SDA ANALOG 4"
Pin28="PC5 SCL ANALOG 5"
Pin29="RESET PC6"
Pin30="RXD DIGITAL 0 PD0"
Pin31="TXD DIGITAL 1 PD1"
Pin32="DIGITAL 2 PD2"



if you scroll down to the defines section you will see the pwm assignment each is over 3 lines, you need to note the port and the pin number highlighted in red below ie:pwm1= D6 etc

Code: Select all

Define48=#define MX_PWM_1_PORT[color=#FF0040] PORTD[/color] 
Define49=#define MX_PWM_1_TRIS DDRD
Define50=#define MX_PWM_1_[color=#FF0040]PIN 6[/color]

Define51=#define MX_PWM_2_PORT[color=#FF0040] PORTD[/color] 
Define52=#define MX_PWM_2_TRIS DDRD
Define53=#define MX_PWM_2_[color=#FF0040]PIN 5[/color]

Define54=#define MX_PWM_3_PORT[color=#FF0040] PORTB[/color]
Define55=#define MX_PWM_3_TRIS DDRB
Define56=#define MX_PWM_3_[color=#FF0040]PIN 1[/color]

Define57=#define MX_PWM_4_PORT[color=#FF0040] PORTB[/color] 
Define58=#define MX_PWM_4_TRIS DDRB
Define59=#define MX_PWM_4_[color=#FF0040]PIN 2[/color]

Define60=#define MX_PWM_5_PORT [color=#FF0040] PORTB[/color]
Define61=#define MX_PWM_5_TRIS DDRB
Define62=#define MX_PWM_5_[color=#FF0040]PIN 3[/color]

Define63=#define MX_PWM_6_PORT[color=#FF0040] PORTD[/color]
Define64=#define MX_PWM_6_TRIS DDRD
Define65=#define MX_PWM_6_[color=#FF0040]PIN 3[/color]



now scroll back to the top of the fcd and add the port and number to the pinouts see below in green  do this for all pwm pins and then save i put pwm at the end of the filename to show its been modified, pop it in you flowcode fcd folder 

[Pins]
Pin1="DIGITAL 3 PWM[color=#00BF00](6)[/color] PD3"
Pin2="DIGITAL 4 PD4"
Pin3=
Pin4=
Pin5=
Pin6=
Pin7=
Pin8=
Pin9="DIGITAL 5 PWM[color=#00BF00](2)[/color] PD5"
Pin10="DIGITAL 6 PWM[color=#00BF00](1)[/color] PD6"
Pin11="DIGITAL 7 PD7"
Pin12="DIGITAL 8 PB0"
Pin13="PB1 DIGITAL 9 PWM[color=#00BF00](3)[/color]"
Pin14="PB2 SS DIGITAL 10 PWM[color=#00BF00](4)[/color]"
Pin15="PB3 MOSI DIGITAL 11 PWM[color=#00BF00](5)[/color] INT"
Pin16="PB4 MISO DIGITAL 12 "
Pin17="PB5 SCK DIGITAL 13 LED"
Pin18=
Pin19="ADC6"
Pin20=
Pin21=
Pin22="ADC7"
Pin23="PC0 ANALOG 0"
Pin24="PC1 ANALOG 1"
Pin25="PC2 ANALOG 2"
Pin26="PC3 ANALOG 3"
Pin27="PC4 SDA ANALOG 4"  
Pin28="PC5 SCL ANALOG 5"
Pin29="RESET PC6"
Pin30="RXD DIGITAL 0 PD0" 
Pin31="TXD DIGITAL 1 PD1"
Pin32="DIGITAL 2 PD2"

 start flowcode open the new fcd and check it's right in the chip view, note the colour highlighted text is only to show what needs changing, chip view is b/w only in flowcode


when you are satisfied with them either leave it as is or you can pop all the fcd's into a new folder and just leave your modified ones, you will also notice i left quite a few pins blank, this was done to gently ease users away from arduino way of thinking and into an avr way of doing things, as the pwm's are assigned as per the avr datasheet, also if pins have been left blank it just means they are unusable due to the arduino hardware

Hope this helps if you need more help just holler

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

benrouse77
Posts: 26
Joined: Thu Jul 05, 2012 11:29 pm
Has thanked: 12 times
Been thanked: 1 time

Re: pmw for uno

Post by benrouse77 »

this is great, thank you.

Ben

Post Reply