ADC MCP320x Component

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

ADC MCP320x Component

Post by p.erasmus »

HI Ben/leigh,

I am making a component for the MCP320x ADC which has an SPI interface ,I would like to ask some ideas regarding the simulation of the device(chip)

I have made makros which read the slider value(Voltage ) and then output a corresponding bit value as the ADC would do ,this functions ok as I then place the bit value to 2 ports and works correctly and yes I also read the slider voltage value and the sim can use the bit value of the voltage value.
my confusion is that it is not possible to simulate the actual chip inner workings so what I am doing is basically that -- Correct?

secondly should I use 4 sliders for the component to represent the 4 channels or is there away to only use 1 slider and link it in code to a user selected CH1-4 ,this is actually how the real code works it selects the channel to read ,any hints Ideas will be appreciated

P1.jpg
P1.jpg (14.64 KiB) Viewed 9593 times


:D
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: ADC MCP320x Component

Post by p.erasmus »

Hi Team.

I am not sure this the reason I am asking ,as you will see below I place a Sim Makro call and it show this green icon with the curved sides when I enter the call code then on closing the makro window it changes to the Icon as shown in orange is this normal ?

P1.jpg
P1.jpg (15.37 KiB) Viewed 9576 times

Thanks all help appreciated

:D
Regards Peter - QME Electronics

Steve-Matrix
Matrix Staff
Posts: 1513
Joined: Sat Dec 05, 2020 10:32 am
Has thanked: 212 times
Been thanked: 351 times

Re: ADC MCP320x Component

Post by Steve-Matrix »

This is a bug that will be fixed soon.

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: ADC MCP320x Component

Post by p.erasmus »

Thanks Steve
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: ADC MCP320x Component

Post by p.erasmus »

Hi Team.

Maybe I am just stupid, however It seems the old style slider is removed or replaced by the new look one ,is this correct or did I not look properly :oops:

P2.jpg
P2.jpg (8.69 KiB) Viewed 9556 times

Thanks as always all help appreciated

:D
Regards Peter - QME Electronics

Steve-Matrix
Matrix Staff
Posts: 1513
Joined: Sat Dec 05, 2020 10:32 am
Has thanked: 212 times
Been thanked: 351 times

Re: ADC MCP320x Component

Post by Steve-Matrix »

p.erasmus wrote:
Tue Jan 26, 2021 9:55 am
It seems the old style slider is removed or replaced by the new look one
I believe a decision was taken to limit which components are displayed in the App Developer mode. You can search for the other slider control in the component search and add it from there:

search_for_slider.png
search_for_slider.png (11.88 KiB) Viewed 9552 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: ADC MCP320x Component

Post by p.erasmus »

:D :D :oops:

Thanks Steve this helps me forward
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: ADC MCP320x Component

Post by p.erasmus »

Hi Ben,

I have the code working on real HW and the simulation also is working now I want to add a property to the component VREF I did add the property
as you will see here,the variable name is adcVref can you help me how do I access this variable from my macro as parameter or inside my macro ,
is this a float variable or a string variable .At the moment I pass the Vref (value 4.95) as float to my macro as parameter but would be better if it is a property and not a parameter the user must enter every time he calls the macro


P1.jpg
P1.jpg (49.3 KiB) Viewed 9497 times
P2.jpg
P2.jpg (59.24 KiB) Viewed 9497 times
Regards Peter - QME Electronics

BenR
Matrix Staff
Posts: 1940
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 506 times
Been thanked: 689 times

Re: ADC MCP320x Component

Post by BenR »

Hello Peter,

Double click the property and set the Property Type to Floating Point.

Then just reference the Property variable in your program like you would any other float variable and it should work as expected.

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: ADC MCP320x Component

Post by p.erasmus »

Hallo Ben,

Thank you very much

:D
Regards Peter - QME Electronics

Post Reply