Page 1 of 3

ADC MCP320x Component

Posted: Mon Jan 25, 2021 10:29 am
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 9614 times


:D

Re: ADC MCP320x Component

Posted: Mon Jan 25, 2021 4:24 pm
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 9597 times

Thanks all help appreciated

:D

Re: ADC MCP320x Component

Posted: Mon Jan 25, 2021 5:00 pm
by Steve-Matrix
This is a bug that will be fixed soon.

Re: ADC MCP320x Component

Posted: Mon Jan 25, 2021 5:02 pm
by p.erasmus
Thanks Steve

Re: ADC MCP320x Component

Posted: Tue Jan 26, 2021 9:55 am
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 9577 times

Thanks as always all help appreciated

:D

Re: ADC MCP320x Component

Posted: Tue Jan 26, 2021 10:32 am
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 9573 times

Re: ADC MCP320x Component

Posted: Tue Jan 26, 2021 11:22 am
by p.erasmus
:D :D :oops:

Thanks Steve this helps me forward

Re: ADC MCP320x Component

Posted: Mon Feb 01, 2021 12:15 pm
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 9518 times
P2.jpg
P2.jpg (59.24 KiB) Viewed 9518 times

Re: ADC MCP320x Component

Posted: Mon Feb 01, 2021 12:23 pm
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.

Re: ADC MCP320x Component

Posted: Mon Feb 01, 2021 1:10 pm
by p.erasmus
Hallo Ben,

Thank you very much

:D