Constants Visibility

For general Flowcode discussion that does not belong in the other sections.
User avatar
p.erasmus
Posts: 434
http://meble-kuchenne.info.pl
Joined: Thu Dec 03, 2020 12:01 pm
Location: Russia / Россия
Has thanked: 104 times
Been thanked: 88 times

Constants Visibility

Post by p.erasmus »

Hi Team.

I am struggling with the scope visibility of Constants I will appreciate any hints or help.
On the ADS1118 ADC there is a complex setting /configuration possible and to make a component that supports all these configurations it is necessary to define them and allow the user of the component to select these various settings , ,
At the moment I have these settings as CONST in globals and then pass them into the macro call as shown below.
P2.jpg
P2.jpg (16.22 KiB) Viewed 4856 times
The question is there a more elegant way for example include them with in the macro and then when the macro is called the user can select them with the .XXX syntax.I tried but was not successful (maybe I miss something) .
Also if the CONST are in Global s will they get exported with the Component, when exported ?
Any ideas help hints appreciated
P1.jpg
P1.jpg (105.24 KiB) Viewed 4856 times
:oops: :oops:
Regards Peter - QME Electronics

medelec35
Matrix Staff
Posts: 1492
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 536 times
Been thanked: 485 times

Re: Constants Visibility

Post by medelec35 »

Hi,
What about adding it in properties?
Properties1.png
Properties1.png (11.16 KiB) Viewed 4847 times
You just select Fixed list of ints for the properties type.
Properties2.png
Properties2.png (43.71 KiB) Viewed 4847 times
As soon as a property selected, the Property in the EV part is automatically accessed.
Properties3.png
Properties3.png (26.1 KiB) Viewed 4846 times
So you will just need to enalbe it.
Of course that will only work if only one gain is needed?

Another way is a number selection.
0 for 512mV, 1 for 614mV etc.
The number values is added to the decription so the user knows which one to select.
Like this:
Properties_Macro.png
Properties_Macro.png (49.8 KiB) Viewed 4837 times
Martin

User avatar
p.erasmus
Posts: 434
Joined: Thu Dec 03, 2020 12:01 pm
Location: Russia / Россия
Has thanked: 104 times
Been thanked: 88 times

Re: Constants Visibility

Post by p.erasmus »

Hi Martin,

Thank you for your help.

I like the property way as it use names and a person can clearly see what you select.however it seems
that selecting a byte type is not possible in the list of variable types. What I actually need is a byte type(because it is a mask of size byte ) to mask out the corrects settings.
the closes I can see a Bit mask which allows me to tick on the value I would like for the mask but my concern is that it seems it is a integer variable type showing a Z next too it
What would have been ideal for me if there was a list of bytes :D just a fool can wish such things :D
learning flowcode now a bit deeper sorry for all the amateur questions ,I appreciate every bodies help :oops:
Attachments
Pmask.jpg
Pmask.jpg (25.97 KiB) Viewed 4835 times
Regards Peter - QME Electronics

User avatar
p.erasmus
Posts: 434
Joined: Thu Dec 03, 2020 12:01 pm
Location: Russia / Россия
Has thanked: 104 times
Been thanked: 88 times

Re: Constants Visibility

Post by p.erasmus »

Hi All.

As Martin suggested I created properties and the properties contain the Mask for the Configuration register ,this works nice I am just not sure if this is an elegant way any comments on it is appreciated.
Calling the Macro and the Setting the properties as parameters result in the correct configuration for the Channel :D and the call is readable you can see what channel , Mode ,Sample Rate and if it is a single Conversion or Continuous Sampling
Pmask.jpg
Pmask.jpg (101.19 KiB) Viewed 4823 times
Thanks Martin for your pointers !! appreciated
Regards Peter - QME Electronics

medelec35
Matrix Staff
Posts: 1492
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 536 times
Been thanked: 485 times

Re: Constants Visibility

Post by medelec35 »

Even though Bytes is not there, I belive you can still use bytes in your flowchart but just use intergers within properties.
Would a drop down list be better option?
Martin

User avatar
p.erasmus
Posts: 434
Joined: Thu Dec 03, 2020 12:01 pm
Location: Russia / Россия
Has thanked: 104 times
Been thanked: 88 times

Re: Constants Visibility

Post by p.erasmus »

Martin
yes a drop down list would be great if it shows in the component call (macro) to select because different channels can have different selections in Run time,so it is necessary to be able to select different config settings for each channels as they are called
I never created such a drop down list have to look how to do it :oops:
Regards Peter - QME Electronics

BenR
Matrix Staff
Posts: 1790
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 455 times
Been thanked: 621 times

Re: Constants Visibility

Post by BenR »

Hello,

It is also possible to make constant values available to the user by going into the Interface -> Globals tabs of the Component Management window.
GlobalConstants.jpg
GlobalConstants.jpg (25.07 KiB) Viewed 4818 times
Just set the Global constants / variables to public and they will appear as options in the parameter fields for component macros.

User avatar
p.erasmus
Posts: 434
Joined: Thu Dec 03, 2020 12:01 pm
Location: Russia / Россия
Has thanked: 104 times
Been thanked: 88 times

Re: Constants Visibility

Post by p.erasmus »

:D
Thank you Ben this is also valuable information :D
Regards Peter - QME Electronics

Steve-Matrix
Matrix Staff
Posts: 1310
Joined: Sat Dec 05, 2020 10:32 am
Has thanked: 175 times
Been thanked: 299 times

Re: Constants Visibility

Post by Steve-Matrix »

You could create a "fixed list of ints" property and then change the numbers on the left of the list. The property variable ("var_name") would equal the value, not the text.
fixed_int_property.png
fixed_int_property.png (41.83 KiB) Viewed 4812 times

User avatar
p.erasmus
Posts: 434
Joined: Thu Dec 03, 2020 12:01 pm
Location: Russia / Россия
Has thanked: 104 times
Been thanked: 88 times

Re: Constants Visibility

Post by p.erasmus »

Hi All

Thank you so much for all the help ,I appreciate this, :D :D
Regards Peter - QME Electronics

Post Reply