Host Engineering Forum

General Category => Do-more CPUs and Do-more Designer Software => Topic started by: Bolt on November 08, 2021, 11:50:50 PM

Title: Sharing Code Across Machines and Network Writing
Post by: Bolt on November 08, 2021, 11:50:50 PM
I'm writing a program to be used on multiple machines.  If I simply designate V0 as "UnitNumber", I can then use V0 to differentiate it from its siblings.  But, if I Network Write to a "Master" PLC, I'd like to use the V0 as a pointer to tell it where to write (SS[V0]).  However, it won't let me use an array as the remote (or local) location.

How else can I approach this?  JSONBUILD an object also containing UnitNumber, dump that into remote's SS0, when remote notices SS0.Length > 0 JSONPARSE it and figure it where to put it?  Seems kinda kludge-y.  And local PLC would have to check if SS0 was empty before proceeding?  Could 2 PLC's theoretically try to write to it at the same time?

How do other's accomplish such a thing?
Title: Re: Sharing Code Across Machines and Network Writing
Post by: Controls Guy on November 09, 2021, 02:34:57 PM
It seems like the unit numbers don't change at runtime, so could the main PLC have a fixed unit number, such as 0 or 1?   Then the satellites each have a unique unit number but each one knows who he is.

In addition to fixing (in the scheme) the unit number of the main PLC, you could have a file on SD with the unit ID, so the program can be completely identical even down to symbolic constants, and plugging the #5 SD card into a machine makes it #5.   Any other unit-specific operating settings can also be on the SD card.
Title: Re: Sharing Code Across Machines and Network Writing
Post by: brucek on November 10, 2021, 07:35:35 AM
might be to simple but if your can use peerlink at 100ms update each plc can have a block to write to and you could know what plc sent or received specifically to a plc using the PL#.