Naše značky

Impact-Company-Logo-English Black-01-177x54

Vítejte na internetových stránkách společnosti Schneider Electric

Vítejte na našich internetových stránkách.
		
Jak vám dnes můžeme pomoci?
Using the DATA_EXCH block to issue a function code 6 (write single register) from a M340 Ethernet interface.

Goals and Symptoms

To use the DATA_EXCH FB in Unity Pro is issue a modbus function code 6 from a Ethernet interface in a M340 PLC system.

Facts and Changes

A minimum version of Unity Pro v4.0 and a M340 CPU or NOE v2.0 must be used for the DATA_EXCH to work properly.

Causes and Fixes


First open the Project Settings form the tools menu in Unity Pro.



Under the Language Extensions tab check off directly represent array variables, Allow dynamic arrays, and disable array size compatibility check.
Then press OK.



Next open the variable editor and create e variables for the DATA_EXCH block



In this example a value of 16#1234 will be written to %MW1876 of slave device connected via MB TCP/IP. This information is shown above in the bytes of the EMIS_PARA variable.
Note: 1876 in decimal is 754 in hex. All values shown in the DATA_EXCH block are in Hex.

Explanation of the EMIS_PARA variable

To understand the setup of this array you must take each byte of each word separately.
In the first word (16#0706) the 2 bytes are 07 (high byte) and 06 (low byte). The low byte (06) is the MB function code. The high byte (07) is the first part of the starting address in the slave device.
In the second word (16#1254) the low byte (54) is the rest of the starting address in the slave and the high byte (12) is the start of the data to be sent.
The last word is only shows the low byte (34) and this is the remaining data to be sent.

If you look at the 5 bytes (in Hex) individually you get: 06 07 54 12 34

06 = MB function code 6
0754 = 1876 decimal (%MW1876)
1234 = Data to be sent

The last thing to mention here is that the forth word of the management parameter (Manage_PARA) is equal to the size in bytes of the transmitted data. In this case 5.


Now create a new FBD section in Unity Pro and press OK.



Add a ADDM and DATA_EXCH block and link the parameters as follows.



Note: In a M340 the TYP parameter is always a 1
The string input for the ADDM block must be chosen to meet the requirements of your network. An explanation of the syntax of this input can be found in the Unity help files.
In this example %M0 is used to trigger the function code 6 and the slave device is located at 192.168.40.45.

Build and download to the M340.

Open a animation table and trigger %M0. You should see the RECP parameter (RECIEVE_DATA) values go from all 0's to the same as the EMIS parameter. This is because the slave device echoes the data back to the master is the transmission was a success. Also the first word of the Management parameter should also be changing while the block is enabled. This indicates successful transmissions.





Schneider Electric Česká republika

Zjistěte více
Řada:
Zjistěte více
Řada:

Potřebujete pomoc?

  • Nástroj pro výběr produktů

    Rychle a snadno vyhledávejte správné produkty a příslušenství pro vaše aplikace.

  • Získejte nabídku

    Poptejte nás online a náš lokální specialista se s vámi spojí!

  • Kde nakoupit?

    Jednoduše najděte nejbližšího distributora výrobků Schneider Electric ve vašem okolí.

  • Centrum nápovědy

    Zdroje podpory pro všechny své potřeby najdete na jednom místě.

  • Dokumentace k produktům
  • Software ke stažení
  • Nástroj pro výběr produktů
  • Hledání náhrady za produkty
  • Centrum nápovědy a kontakty
  • Najít naše pobočky
  • Získejte nabídku
  • Kde koupit
  • Komunita Schneider Electric
  • Profil společnosti
  • Nahlásit nevhodné chování
  • Přístupnost
  • Newsroom
  • Investoři
  • EcoStruxure
  • Vyhledávání pracovních míst
  • Blog
  • Zásady ochrany osobních údajů
  • Oznámení o souborech cookie
  • Podmínky použití
  • Změnit nastavení souborů cookie