Page 2 of 3
Re: ADC MCP320x Component
Posted: Fri Feb 05, 2021 12:14 pm
by p.erasmus
Hi Ben,
my component is simulating and working on HW however I think I have a confusion when exporting the component
When exporting it I set the Simulation macros as Simulation as you see here

- P1.jpg (32.62 KiB) Viewed 7930 times
Now when the component is exported and in the FC component library and I place it on the Flowchartd and call a simulation with a simulation Icon I see also the downloadable macros (I thought I would only see the macros which is declared Simulation Components)
as here

- P2.jpg (36.28 KiB) Viewed 7930 times
and the same with the Downloadable macros if I use a component macro icon(call) the I see the real HW components/macros but also the simulation macros,
as here

- P3.jpg (33.13 KiB) Viewed 7930 times
Thanks for your help , I am close of having my first made component I think

or I hope

Re: ADC MCP320x Component
Posted: Fri Feb 05, 2021 12:28 pm
by BenR
Hello Peter,
In the interface manager select your downlaoadable macro "SampleAdcRaw" and add the name of the simulation macro to the Simulation macro field "SampleAdcRawSim".
Next select the simulation macro "SampleAdcRawSim" and set the macro type to hidden.
Repeat for any other macros with simulation overrides.
Now when you export the user will only see the downloadable macros but when they simulate the simulation macros will be called.
I touch on the concept here in the video around 4:50.
viewtopic.php?f=6&t=183
Hope this makes sense.
Re: ADC MCP320x Component
Posted: Fri Feb 05, 2021 1:06 pm
by p.erasmus
Hi Ben
That is it now it is good ,Thanks a million ,I appreciate all your help with this topic
Re: ADC MCP320x Component
Posted: Sun Feb 07, 2021 6:02 pm
by p.erasmus
Hi Ben /Team.
I apologize for bugging you guys with my learning to make components
Working with the AD7680 source code I have a few things that is unclear to me and would appreciate your help and pointers
(1) is it absolutely necessary to add the " If SimulateComms " switch as in my proto component I have a Sim macro and a HW (downloadable) macro and I am not using this switch ,when I simulate my simulation is working with the indicators on the panel ok,when I flash this FC chart to hardware the hardware macros' are working just fine,I am trying to understand the main reasons for using the If SimulateComms switch

- P1.jpg (85.56 KiB) Viewed 7909 times
(2) I am aslo confused when I set the Simulate Comms property to Yes then during simulation the HW macro is called what is the reason that you call the HW macro and not the macro's that interact with the panel objects ,it seems the interaction to the panel objects get done when Simulate Comms property is set to no ,

- P2.jpg (19.08 KiB) Viewed 7909 times
I appreciate your help as really want to get to work with making components for my own work as well

Re: ADC MCP320x Component
Posted: Sun Feb 07, 2021 6:34 pm
by kersing
For simulation I would expect/use an event to trigger when simulation starts to set the properly. There should be such an event available, don’t have a computer with flowcode close so I can’t check right now.
Re: ADC MCP320x Component
Posted: Sun Feb 07, 2021 6:55 pm
by p.erasmus
Hi Kersing
Thanks for your reply there is an event that triggers and set the property ,however this is my confusion why is it calling the Hardware macro when simulating and interacting with the panel object when not .Secondly is it absolutely necessary to do in this way ?
Maybe I read the thing incorrectly

Re: ADC MCP320x Component
Posted: Mon Feb 08, 2021 12:39 pm
by BenR
Hello,
(1) is it absolutely necessary to add the " If SimulateComms " switch
No not at all, it's really up to you. I advise it because often you don't want the simulation code clogging up your embeded code and hence keeping them seperate is a good thing. Having the ability to simulate comms rather then just perform a panel simulation is a powerful thing that allows you to simulate the communications in real life using SCADA slave hardware such as an Arduino Uno with the Scada Slave firmware.
Another reason to have them seperate is to do the following.
Simulate Comms = No
Panel sliders set the approperiate values when reading the component
Simulate Comms = Yes
When reading the component real world hardware is sampled using some form of SCADA Slave or other comms injector and the real world data is shown on the panel sliders.

- SimComms.jpg (118 KiB) Viewed 7889 times
SCADA Slave demos -
https://matrixtsl.com/mmforums/viewtopi ... 84#p103184
Re: ADC MCP320x Component
Posted: Mon Feb 08, 2021 12:49 pm
by p.erasmus
Hi Ben,
Thank you for the explanation,I understand now that when Sim = yes I can simulate and test my UART,SPI I2C code to talk to a sensor or device in simulation for development of my component I looked the Scada wiki page and understand ,
My issue is this buying a ECIO28 pin for 4000 ruble or buy the Arduino chip pack for 5500 ruble as I have a UNO R3 ,I have to think if this is necessary for my components that I make as Russian money with a exchagne of 102 Ruble for a pound is tuff stuff

Re: ADC MCP320x Component
Posted: Mon Feb 08, 2021 4:09 pm
by BenR
Hello Peter,
Arduino Uno is included as one of our free devices. So Arduino chip pack is not required for compilation to a Uno.
Also we provide the hex file so you don't even have to touch Flowcode to load the SCADA slave firmware onto the Arduino. Just use Xloader or AVRdudess to load the .hex file onto the Arduino. Also the Chinese Arduino clones are fairly nice price point too
https://www.flowcode.co.uk/wiki/index.p ... DA_Slaves)
Hope this helps

Re: ADC MCP320x Component
Posted: Mon Feb 08, 2021 4:28 pm
by p.erasmus
Hi Ben,
This is indeed good news ,I will have a go at it as soon as possible.
Thanks I understand I can just flash the Scada hex file and use it with my PIC program however I will also try to use the UNO then so will try to compile a demo FC chart
I appreciate all your help and information

there is still many open topics but will go at them one after the other ,creating a dash panel graphics also seems a black art and still need to see how to do that as I never did graphics I am a Hardware man
things like this is nice but how to make it

- P1.jpg (37.77 KiB) Viewed 7872 times
Again I appreciate you help me through this
I just tried to compile the Uno Scada I2C Demo FC chart and not sure what I do wrong but many errors,I must confess this is my first time I compile code for anything else than a PIC

.I checked all properties seems to be set in the I2C , injector and scada uno components

- P2.jpg (64.88 KiB) Viewed 7866 times

- P3.jpg (140.13 KiB) Viewed 7866 times
Ben where do I find this injector file ?

- P4.jpg (46.76 KiB) Viewed 7866 times