Mitsubishi Electric MELSEC iQ-F Series Quick Start Manual page 49

Hide thumbs Also See for MELSEC iQ-F Series:
Table of Contents

Advertisement

Program
■Receiving of message data
M34 turns on for setting the information used for M+ENET_MQTT_Receive (Receiving of MQTT data).
M34
M36 (Execution command) turns on for storing the receive data into the specified file register.
After the data is successfully received, M32 (Normal completion) turns on. The receive data is stored in the file register set
with i_uReceiveTopicNameDataAddr (Receive topic name data start address) and i_uReceiveMessageDataAddr (Receive
message data start address).
M36
Connection number: K1
Receive topic name data start address: K1100
Receive message data start address: K1300
■Acquisition of only the required strings from receive data
• Settings for required member information
M40 (Execution command) turns on for setting the member information to be acquired.
M40
1
M_StrProcessing_JSONDeserialize_F_00A_1.pb_st30Member[0].uType := K3; //Set the Value type to K3 (character string).
2
M_StrProcessing_JSONDeserialize_F_00A_1.pb_st30Member[0].s32Key := 'Sample'; //Set the Key name to "Sample".
3
M_StrProcessing_JSONDeserialize_F_00A_1.pb_st30Member[0].uDepth := K1; //Set the depth of layer to K1.
4
M_StrProcessing_JSONDeserialize_F_00A_1.pb_st30Member[1].uType := K0; //Set the Value type to K0 (end of the member structure array).
• Acquisition of JSON string
When M40 (Execution command) turns on, the function block acquires the Value strings that exactly match the values of
uType (Value type), s32Key (Key name), and uDepth (depth of layer) in the set member list (pb_st30Member) from JSON
strings stored at the JSON start address, and it stores the values into the s64Value (Value) values in the member list
(pb_st30Member).
M40
JSON start address: K1300
MOV
K1100
D21
MOV
K1300
D22
B: i_bEN
DUT: i_stModule
FX5ENET_1
UW: i_uConnectionNo
D0
UW: i_uReceiveTopicNameDataAddr
D21
UW: i_uReceiveMessageDataAddr
D22
M_StrProcessing_JSONDeserialize_F_00A_1
(M+StrProcessing_JSONDeserialize_00A)
StrProcessing_JSONDeserialize FB
B: i_bEN
UD: i_udJsonAddr
D22
5.4 Checking the Operation of Subscribe (Receiving of MQTT Data)
Set the receive topic name data start address to K1100.
Set the receive message data start address to K1300.
M_FX5ENET_MQTT_Receive_00A_1
(M+FX5ENET_MQTT_Receive_00A)
MQTT Receive FB
o_uConnectionStatus :UW
o_uNumOfDiscardedPackets :UW
o_uSubscribeId :UW
o_uReceiveTopicSize :UW
o_uReceiveMessageSize :UW
o_bENO :B
o_bOK :B
o_bErr :B
o_uErrId :UW
o_uValueNum :UW
pb_st30Member
M31
o_bENO :B
M32
o_bOK :B
M33
o_bErr :B
o_uErrId :UW
D23
D24
D25
D26
D27
D28
M41
M42
M43
D30
D31
5 CHECKING OPERATIONS
5
48

Advertisement

Table of Contents
loading

This manual is also suitable for:

Melsec iq-fx5-enet mqtt

Table of Contents