Professional Documents
Culture Documents
1 TYPE Header
2 STRUCT //Frame header
3 ID : WORD := 16#0000; //Identifier
4 Num : INT := 0; //Number
5 Tim : TOD := TOD#00:00:00; //Time-of-day
6 END_STRUCT
7 END_TYPE
8
9
Page 1 of 11
SIMATIC SCL_Book\Message 08/15/2019 12:52:42 PM
Frame Example\Source Files\...\Message Frame
10 TYPE Message_frame
11 STRUCT //Message frame
12 Head : Header; //Frame header
13 Meas : ARRAY [1..4] OF INT; //Measured value field
14 Check: DINT := L#0; //Checksum
15 END_STRUCT
16 END_TYPE
17
18
Page 2 of 11
SIMATIC SCL_Book\Message 08/15/2019 12:52:42 PM
Frame Example\Source Files\...\Message Frame
19 DATA_BLOCK Send_mailb
20 TITLE = 'Send mailbox for the Message Frame example'
21 //The DB "Send_mailb" contains a variable with the data structure
22 //"Message_frame"
23
24 AUTHOR : Berger
25 FAMILY : SCL_Book
26 NAME : S_mailb
27 VERSION : 1.0
28
29 STRUCT
30 Data : Message_frame; //Variable with the data structure "Message_frame"
31 END_STRUCT
32
33 BEGIN
34 Data.Head.ID := 16#F100; //Default for this data block
35 END_DATA_BLOCK
36
37
Page 3 of 11
SIMATIC SCL_Book\Message 08/15/2019 12:52:42 PM
Frame Example\Source Files\...\Message Frame
38 DATA_BLOCK Receive_mailb
39 TITLE = 'Receive mailbox for the Message Frame example'
40 //The DB "Receive_mailb" contains a variable with the data structure
41 //"Message_frame"
42
43 AUTHOR : Berger
44 FAMILY : SCL_Book
45 NAME : R_mailb
46 VERSION : 1.0
47
48 STRUCT
49 Data : Message_frame; //Variable with data structure "Message_frame"
50 END_STRUCT
51
52 BEGIN
53 Data.Head.ID := 16#A003; //Default for this data block
54 END_DATA_BLOCK
55
56
Page 4 of 11
SIMATIC SCL_Book\Message 08/15/2019 12:52:42 PM
Frame Example\Source Files\...\Message Frame
57 DATA_BLOCK Meas_values
58 TITLE = 'Global data block for the measured values'
59 //The DB contains 4 fields with 4 measured values each in data format INT
60
61 AUTHOR : Berger
62 FAMILY : SCL_Book
63 NAME : M_values
64 VERSION : 1.0
65
66 STRUCT
67 M1 : ARRAY [1..4] OF INT;
68 M2 : ARRAY [1..4] OF INT;
69 M3 : ARRAY [1..4] OF INT;
70 M4 : ARRAY [1..4] OF INT;
71 END_STRUCT
72
73 BEGIN
74 END_DATA_BLOCK
75
76
Page 5 of 11
SIMATIC SCL_Book\Message 08/15/2019 12:52:42 PM
Frame Example\Source Files\...\Message Frame
Page 6 of 11
SIMATIC SCL_Book\Message 08/15/2019 12:52:42 PM
Frame Example\Source Files\...\Message Frame
Page 7 of 11
SIMATIC SCL_Book\Message 08/15/2019 12:52:42 PM
Frame Example\Source Files\...\Message Frame
Page 8 of 11
SIMATIC SCL_Book\Message 08/15/2019 12:52:42 PM
Frame Example\Source Files\...\Message Frame
Page 9 of 11
SIMATIC SCL_Book\Message 08/15/2019 12:52:42 PM
Frame Example\Source Files\...\Message Frame
Page 10 of 11
SIMATIC SCL_Book\Message 08/15/2019 12:52:42 PM
Frame Example\Source Files\...\Message Frame
Page 11 of 11