can't change adc port in macro

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
rud@softselect.net
Flowcode V4 User
Posts: 3
Joined: Fri Jul 10, 2009 10:42 am
Contact:

can't change adc port in macro

Post by rud@softselect.net »

hi Everyone,
I am trying to create a macro using adc(2) but in the macro list Adc(0) shows, how do i get ADC(2) to select :x
I have attached the file in question
Flowcode4 for AVR
Attachments
control.fcf_avr
(6.5 KiB) Downloaded 201 times

User avatar
Steve
Matrix Staff
Posts: 3424
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Re: can't change adc port in macro

Post by Steve »

ADC(0) doesn't necessarily represent the ADC0 pin of the microcontroller. You can select the actual ADC pin to use in the "component connections" screen by right clicking the ADC component.

rud@softselect.net
Flowcode V4 User
Posts: 3
Joined: Fri Jul 10, 2009 10:42 am
Contact:

Re: can't change adc port in macro

Post by rud@softselect.net »

hi steve,
I tried it the way u described but the program didnt work, i then added 2 more adc componts till ADC(2) showed in the selection, selected it then deleted the components set up for adc(0) and ADC(1), then compiled and sent to chip, works like a charm
thanks Friedrich

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: can't change adc port in macro

Post by medelec35 »

I posted this for Flowcode 4, it may help for future reference?
Tutorial:
Example Starting from a new Flowchart using ANA3 and ANA5
1) Select ADC from inputs menu
2) Right click on newly created pot on panel, click connections (note in properties panel shows ADC(0) since this 1st ADC component that's what you will be using) from drop down list select ADC3, then done. Now Component ADC(0) is associated with ANA3 of microcontroller.
3) Again Select ADC from inputs menu, this will created another Pot on panel, so now you should have 2 pots. Right click on this 2nd pot on panel, click connections (note in properties panel shows ADC(1) since this 2nd created ADC component). From drop down list select ADC5, then done.
4) Drag component macro onto your flowchart, then double click it to bring its properties box up Select ADC(0), then ReadAsByte etc. At this stage you can create a new variable , or use an existing variable.
5) Drag another component macro onto your flowchart, then double click it to bring its properties box up Select ADC(1), then ReadAsByte etc. At this stage you can create a new variable , or use an existing variable.

Now you have 1st pot connected to ANA3 of microcontroller and 2nd pot connected to ANA5 of microcontroller.
Martin

Post Reply