Reference) SIEMENS_S7 TCP/IP2 communication driver's communication method and etc are same with SIEMENS_S7 TCP/IP communication driver, but memory save address of read/write data are different.
SIEMENS_S7 TCP/IP communication driver's Help
<Figure 1> is read setting example of SIEMENS S7 PLC TCP/IP in Germany.
<Figure 1> Read setting example of SIEMENS_S7 TCP/IP2 driver |
Device setting of <Figure 1> input Connection type( TCP/IP ), IP address of PLC( 192.168.1.103 ), TCP service port( fixed to 102 ) respectively.
Also, enter PLC Rack Number( Default no.0), CPU Slot Number( CPU Module Number : Default 2, 3 or 4), Result of comparing WORD address with PLC memory data( Default no.500 address), whether to use read/write address as BYTE unit( 0 = Not use, 1 = Use as BYTE unit ) and whether to save read data as BYTE unit( 0 = Not use, 1 = Save as BYTE unit ) by classifying as comma(,), at Option part of <Figure 1>.
Importance) You have to enter PLC Rack number and CPU Slot number at Option part correctly for communication. ( Refer to no.3 item )
( Generally, 400 series CPU is 0 and 4, 300 series CPU is 0 and 2. )
Refer to SIEMENS S7 PLC manual about communication module setting method of SIEMENS_S7 TCP/IP protocol.
SIEMENS_S7 TCP/IP2 communication driver's read schedule
Read schedule setting parameters are as follows :
1) STATION – Don't care.
2) DB number and Data type to read – Input among DBxx.y, M.y, I.y, Q.y, PI.y, C and T. ( Refer to <Table 1> )
xx = DB number between 0 and 256,
y = Data type to read among Blank, B, W, D and F.
( B : Byte, W or Blank etc : WORD, D : DWORD, F : FLOAT )
3) Read Start Address – Start address to read within DB address.
In case of using read/write address as BYTE unit - Always BYTE unit address,
In case of not using read/write address as BYTE unit - Number of BYTE/WORD/DWORD/FLOAT unit,
But, T and C area always use WORD unit.
4) Save Start Address for Communication Server - Saving start address of Communication Server.
5) Read Size - The number of BYTE/WORD/DWORD/FLOAT to read.
( It can read data of maximum 462 BYTE/231 WORD/115 DWORD/115 FLOAT, at a time. It can differ according to equipment type. )
Read schedule example)
STATION | Read Data Type | Read Start Address | Save Start Address | Read Size | |
READ, | 1, | DB20.B, | 0, | 0, | 20, |
READ, | 1, | DB20.B, | 100, | 50, | 50, |
READ, | 1, | DB10.W, | 0, | 100, | 10, |
READ, | 1, | DB11.W, | 0, | 120, | 10, |
FLOAT, | 1, | DB21.F, | 0, | 0, | 115, |
FLOAT, | 1, | DB21.F, | 180, | 600, | 20, |
DWORD, | 1, | DB22.D, | 0, | 0, | 5, |
DWORD, | 1, | DB22.D, | 50, | 20, | 10, |
READ, | 1, | M.W, | 0, | 150, | 16, |
READ, | 1, | I.W, | 0, | 180, | 16, |
Memory area |
Contents |
Remarks |
DB |
Data Block |
DB block between 0 and 256 Possible to register at Ladder |
M |
Memory area |
|
I |
Input area |
|
Q |
Output area |
|
PI |
Peripheral Input area |
Same area with PQ |
PQ |
Peripheral Output area |
Use when output (Same area with PI) |
C |
Count area |
|
T |
Timer area |
|
<Table 1> Memory area type and contents of Siemens S7 TCP/IP2 communication driver |
If you click the icon in protocol option part, you can see the dialog box such as <Figure 2>. You can also set read schedule by using this part.
<Figure 2> Example of SIEMENS_S7 TCP/IP2 driver's Option dialog box |
You can set read schedule by using , , button and listbox of <Figure 2>.
Also, you can enter PLC Rack number and CPU slot number at PLC Rack Number ( 0 ~ 7 ), PLC CPU Slot Number ( 0 ~ 15 ), Result of comparing WORD address with PLC memory data( 0 ~ 9999 ), whether to use read/write address as BYTE unit and whether to save read data as BYTE unit part of <Figure 2>.
<Figure 3> Example of SIEMENS_S7 TCP/IP2 driver's read schedule Add/Edit dialog box |
When you click Add button or Edit button in dialog box of <Figure 2>, dialog box of <Figure 3> is shown.
Reference) CPU of 312, 314 series and etc reduce the number of 'S7 Standard Communication' at CPU setting of Ladder program, when several ports or computers connect to single PLC. ( Refer to no.4 item )
You can change PLC memory as set value by using writing settings.
Digital Write
Digital write setting parameters are as follows :
PORT |
Connected PORT number | 0 ~ 255 |
Station |
Don't care | |
ADDRESS |
Digital output address | 0000 ~ xxxF,
|
Extra1 |
Memory area, DB number and data unit | Input as DBxx.y I.y, Q.y, PQ.y format.
xx = DB number between 0 and 256 y = B, W, D, F data unit, B : BYTE unit, Blank, W etc : WORD unit, D : DWORD unit, F : FLOAT unit. |
Extra2 |
When do DWORD/FLOAT output, designate bit between no.0 and no.15, between no.16 and no.32 | 0 : Bit between no.0 and no.15( 00h ~ 0Fh ), 1 : Bit between no.16 and no.31( 10h ~ 1Fh ). |
Write example 1)
Port : 0 Station : 0 Address : 0127, Extra1 : DB20.B, Extra2 : Blank
If you set as above and write digital value, you can ON/OFF the 8th(no.7) bit value of no.12 byte of DB20 memory.
Write example 2)
Port : 0 Station : 0 Address : 12152, Extra1 : DB12.B, Extra2 : Blank
If you set as above and write digital value, you can ON/OFF the 3rd(no.2) bit value of no.1215 byte of DB12 memory.
Write example 3)
Port : 0 Station : 0 Address : 005F, Extra1 : DB20.W, Extra2 : Blank
If you set as above and write digital value, you can ON/OFF the 16th(no.F) bit value of no.5 WORD of DB20 memory.
Write example 4)
Port : 0 Station : 0 Address : 0160, Extra1 : DB20.W, Extra2 : Blank
If you set as above and write digital value, you can ON/OFF the 1st(no.0) bit value of no.16 WORD of DB20 memory.
Write example 5)
Port : 0 Station : 0 Address : 0069, Extra1 : DB20.D, Extra2 : 0
If you set as above and write digital value, you can ON/OFF the 10th(no.9) bit value of no.6 DWORD of DB20 memory.
Write example 6)
Port : 0 Station : 0 Address : 0069, Extra1 : DB20.D, Extra2 : 1
If you set as above and write digital value, you can ON/OFF the 23th(no.22) bit value of no.6 DWORD of DB20 memory.
Write example 7)
Port : 0 Station : 0 Address : 003F, Extra1 : M, Extra2 : Blank
If you set as above and write digital value, you can ON/OFF the no.F bit value of no.3 WORD of M memory.
Write example 8)
Port : 0 Station : 0 Address : 0053, Extra1 : Q, Extra2 : Blank
If you set as above and write digital value, you can ON/OFF the no.3 bit value of no.3 WORD of Q memory.
Analog Write
Analog write setting parameters are as follows :
Station |
Don't care |
|
ADDRESS |
Analog output address |
BYTE/WORD/DWORD/FLOAT output address as decimal number ( But, in case of selecting Byte Unit R/W Addressing, it is always BYTE unit output address ) |
Extra1 |
Memory area, DB number and data unit |
Input DBxx.y I.y, Q.y, PQ.y as format. xx = DB number between 0 and 256. y = B, W, D, F data unit, B : BYTE unit, Blank, W etc : WORD unit, D : DWORD unit, F : FLOAT unit. |
Extra2 |
Setting for writing/comparing multi-analog value |
1 = Save multi writing value ( Don't care about Extra1 area ) 2 = Write multi writing value as current saved value, ( Continuous writing as much as the number of being saved from current set address ) 3 = Delete all saved contents as multi writing value, ( Don't care about Extra1 area ) 4 = Compare PLC memory address value with current saved value, ( Continuous writing as much as the number of being saved from current set address ) Etc value( in case of larger than 0 or 4 ) = General( single ) analog value writing |
Write example 1)
Port : 0 Station : 0 Address : 0011, Extra1 : DB21.B, Extra2 : Blank
If you set as above and write analog value, you can change the 12th(no.11 address) byte area of DB21 memory as designated value(value between 0 and 255).
Write example 2)
Port : 0 Station : 0 Address : 0152, Extra1 : DB22.W, Extra2 : Blank
If you set as above and write analog value, you can change the 153th(no.152 address) WORD area of DB22 memory as designated value(value between 0 and 65535).
Write example 3)
Port : 0 Station : 0 Address : 0035, Extra1 : DB23.D, Extra2 : Blank
If you set as above and write analog value, you can change the 36th(no.35 address) DWORD area of DB23 memory as designated value(within range of DWORD data).
Write example 4)
Port : 0 Station : 0 Address : 0176, Extra1 : DB24.F, Extra2 : Blank
If you set as above and write analog value, you can change the 177th (no.176 address) FLOAT area of DB24 memory as designated value.
Write example 5)
Port : 0 Station : 0 Address : 0016, Extra1 : M, Extra2 : Blank
If you set as above and write analog value, you can change no.16 WORD area of M memory as designated value.
Write example 6)
Port : 0 Station : 0 Address : 0003, Extra1 : C, Extra2 : Blank
If you set as above and write analog value, you can change no.3 WORD area of C memory as designated value.
(Output value is used as BCD code between 0 and 999)
Write example 7)
Port : 0 Station : 0 Address : 0025, Extra1 : T, Extra2 : Blank
If you set as above and write analog value, you can change no.25 WORD area of T memory as designated value.
(Output value is used as BCD code between 0 and 999)
Reference) Generally, output value of C and T memory area uses the BCD format data between 0 and 999.
Example of writing script to set the multi word writing)
$AO_0000.Extra2 = 3; // Delete previous saved multi write value
@SetTagValue("AO_0000", 0);
$AO_0000.Extra2 = 1; // Set as saving multi write value
for(i = 0; i < 105; i = i + 1) {
@sprintf($AO_0000.Extra1, "%03d", i); // Set lest ignore same data by entering random value to Extra1
@SetTagValue("AO_0000", 5000); // Save real output value, Save randomly as 5000, in here
}
@sprintf($AO_0000.Extra1, "DB30.W"); // Designate the memory, Set the DB address and unit of B ( Byte ), W ( Word ), D ( Dword ) and F ( Float )
$AO_0000.Extra2 = 2; // Designate writing multi value
@SetTagValue("AO_0000", 1); // Writing value, write the 105 values, from designated address
Example of writing script to confirm whether memory value and current value of PLC are same)
$AO_CHECK_MEM_SET = 2; // Set WORD address to confirm completion of comparison as 2
for(i = 0; i < 1; ) {
if($AI_CHECK_WRITE_STATUS == 2) i = 10; // Writing the value of 2 is completed.
@TagCheckLoop(); // The function to confirm tag value change
}
$AO_0000.Extra2 = 3; // Delete previous saved data value
@SetTagValue("AO_0000", 0);
$AO_0000.Extra2 = 1; // Set as saving data value
for(i = 0; i < 105; i = i + 1) {
@sprintf($AO_0000.Extra1, "%03d", i); // Set lest ignore same data by entering random value to Extra1
@SetTagValue("AO_0000", 5000); // Save real output value, Save randomly as 5000, in here
}
@sprintf($AO_0000.Extra1, "DB30.W"); // Designate the memory, Set the DB address and unit of B ( Byte ), W ( Word ), D ( Dword ) and F ( Float )
$AO_0000.Extra2 = 4; // Designate comparison of data value
@SetTagValue("AO_0000", 1); // Command for comparing the data as much as entered, from designated address
for(i = 0; i < 1; ) {
if($AI_CHECK_WRITE_STATUS == 1) i = 10; // Result of comparison 1 = Same data
if($AI_CHECK_WRITE_STATUS == 0) { // Result of comparison 0 = Different data exist
@MessageBox("Contents of comparison data are different, each other.", "Data comparison error", MB_OK);
return;
}
@TagCheckLoop(); // The function for confirming tag value change
}
@MessageBox("Contents of comparison data are same.", "Data comparison complete", MB_OK);
Note when you write script for comparison)
1) Result of comparison is saved at WORD memory address which is set at Option part, as 1 ( same data ), 0 ( different data ).
2) Confirm the result of comparison by entering value except 1 and 0( At example, a value of 2 ) to the set WORD address first, before comparing PLC and memory.
3) AO_CHECK_MEM_SET analog output tag is set to forcedly write the WORD address, which is set at Option part. ( Set as Extra1 = #MEM# )
4) Attune AI_CHECK_WRITE_STATUS analog input tag to WORD address which is set by PLC_SCAN tag.
You can use SIEMENS PLC CPU slot number CPU is installed at rack.
SIEMENS PLC CPU slot number enters slot number where CPU installed at rack. In case of <Figure 4>, CPU slot number is 2.
( Generally, 400 series CPU slot is 4, 300 series is 2. )
<Figure 4> Example of SIEMENS S7 PLC |
When multiple ports or computer access to single PLC, Siemens Ladder program requires settings as follows if you use CPU such as 312, 314 series and etc.
1) Open the Ladder by executing SIEMENTIC Manager program, such as <Figure 5>.
2) Open the 'Hardware' object of <Figure 5>. ( Double click the mouse left button, etc )
3) HW Config is opened, such as <Figure 6>.
4) If you select 'CPU Properties' after selecting CPU at Menu and etc, Properties dialog box is opened.
5) If you select 'Communication' tab of Properties dialog box, screen is opened, such as <Figure 7>.
6) Reduce the number of connection of 'S7 Standard Communication' area at <Figure 7>. ( Minimum 0 )
7) Download the changed contents to PLC.
<Figure 5> Example of opening specific Ladder at SIEMENTIC Manager program |
<Figure 6> Example of opening HW Config |
<Figure 7> Example of selecting Communication tab of CPU Properties dialog box |
IP address and etc of TCP/IP communication card are set as following area at Siemens Ladder program.
1) Open the Ladder by executing SIEMENTIC Manager program.
2) Open the 'Hardware' object. ( Double click the mouse left button, etc )
3) Open the HW Config.
4) If you select 'Object Properties' at Menu and etc after selecting TCP/IP communication module, Properties dialog box is opened such as <Figure 8>.
5) If you select 'Properties' button at <Figure 8>, <Figure 9> dialog box is opened.
6) Enter IP address and etc to IP address of <Figure 9> and Subnet Mask area.
7) Download the changed contents to PLC.
<Figure 8> Properties setting dialog box of TCP/IP communication module |
<Figure 9> Properties setting dialog box of TCP/IP communication module |