News:

  • October 17, 2026, 01:16:13 PM

Login with username, password and session length

Author Topic: Sharing Code Across Machines and Network Writing  (Read 7106 times)

Bolt

  • Hero Member
  • *****
  • Posts: 598
Sharing Code Across Machines and Network Writing
« 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?
« Last Edit: November 08, 2021, 11:56:25 PM by Bolt »

Controls Guy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 3628
  • Darth Ladder
Re: Sharing Code Across Machines and Network Writing
« Reply #1 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.
I retract my earlier statement that half of all politicians are crooks.  Half of all politicians are NOT crooks.  There.

brucek

  • Sr. Member
  • ****
  • Posts: 62
Re: Sharing Code Across Machines and Network Writing
« Reply #2 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#.