Mitsubishi Electric MELSEC iQ-F Series Manual
Mitsubishi Electric MELSEC iQ-F Series Manual

Mitsubishi Electric MELSEC iQ-F Series Manual

Hide thumbs Also See for MELSEC iQ-F Series:

Advertisement

Quick Links

MELSEC iQ-F Character String Operation
Function Block Library Reference

Advertisement

Table of Contents
loading

Summary of Contents for Mitsubishi Electric MELSEC iQ-F Series

  • Page 1 MELSEC iQ-F Character String Operation Function Block Library Reference...
  • Page 3: Safety Precautions

    SAFETY PRECAUTIONS (Read these precautions before use.) Before using this product, please read this manual and the relevant manuals introduced in this manual carefully and pay full attention to safety in order to handle the product correctly. This manual classifies the safety precautions into two categories: [ WARNING] and [ CAUTION].
  • Page 4: Introduction

    • Since the examples indicated by this manual, technical bulletin, catalog, etc. are used as a reference, please use it after confirming the function and safety of the equipment and system. Mitsubishi Electric will accept no responsibility for actual use of the product based on these illustrative examples.
  • Page 5: Table Of Contents

    CONTENTS SAFETY PRECAUTIONS ..............1 INTRODUCTION .
  • Page 6: Relevant Manuals

    RELEVANT MANUALS Manual name Description MELSEC iQ-F FX5S/FX5UJ/FX5U/FX5UC User's Manual (Hardware) Hardware of the CPU module, including I/O specifications, wiring, installation, and <SH-082452ENG> maintenance MELSEC iQ-F FX5 User's Manual (Application) Basic knowledge about programming, functions of the CPU module, devices/labels, <JY997D55401>...
  • Page 7: Chapter 1 Overview

    OVERVIEW The function blocks in this reference manual mean the FB libraries for character string operation in the MELSEC iQ-F series. Features This section describes the features of this function. Shortening programming time Programming time can be shortened because the character string operation program that had to be created by combining instructions for CPU modules is grouped into blocks for each function.
  • Page 8 MEMO 1 OVERVIEW 1.3 System Configuration...
  • Page 9: Chapter 2 Specifications

    This chapter describes the common specifications of the FB libraries in this reference manual. FB Library Specifications The FB libraries in this reference manual are used on a single CPU module of the MELSEC iQ-F series without communicating with external devices.
  • Page 10: List Of Structures

    List of Structures The following table lists the structure used in the FB libraries in this reference manual. Name Description Member Refers to member information. Member It is the structure used for constructing or acquiring the JSON string. Label Label name Data type Setting range Description...
  • Page 11: Precautions

    Precautions Before using the FB libraries in this reference manual, check the following precautions. Description The FBs in this reference manual do not include the error recovery processing. Prepare the error recovery processing separately to suit the user's system and the expected operation.
  • Page 12: Chapter 3 Details Of Fb Libraries

    DETAILS OF FB LIBRARIES M+StrProcessing_JSONDeserialize_F (Acquisition of JSON String) Overview This FB acquires the Value string corresponding to the specified Key string from the JSON string. M+StrProcessing_JSONDeserialize_F B:i_bEN o_bENO:B UD:i_udJSONAddr o_bOK:B o_bErr:B o_uErrId:UW (8)pb_st30Member o_uValueNum:UW Labels Input labels Label Name Data type Import Setting range...
  • Page 13: Function Details

    Function details Applicable hardware and software Module Firmware version Engineering tool FX5S CPU module 1.00 or later GX Works3 Version 1.087R or later FX5UJ CPU module 1.032 or later GX Works3 Version 1.087R or later FX5U/FX5UC CPU module 1.271 or later GX Works3 Version 1.087R or later Basic specifications Item...
  • Page 14 Usage procedure The following shows the procedure to acquire the Value string from the JSON string. Regarding the JSON string for acquisition, set uType (type of Value), s32Key (Key string), and uDepth (depth of hierarchy) for items to acquire the Value string in pb_st30Member (member list). •...
  • Page 15 Timing chart of I/O signals ■Completed successfully i_bEN (execution command) o_bENO (execution status) Acquisition status Unexecuted Executing Unexecuted pb_st30Member Acquisition Acquisition Initial state … Acquisition result n (member list) result 1 result 2 o_bOK (normal completion) o_bErr (error completion) o_uErrId (error code) ■Completed with an error i_bEN...
  • Page 16: Parameter Settings

    Precautions • Only the Value string whose uType (type of Value), s32Key (Key string), and uDepth (depth of hierarchy) completely match those specified in pb_st30Member (member list) is acquired. Partially matched strings are not acquired. • Special characters including escape sequences are not supported. A Value string including any special character may not be acquired correctly.
  • Page 17: Error Code

    Error code Error code Description Action 100H The setting value of i_udJsonAddr (JSON start address) exceeds Check and correct the setting, then execute the FB again. the maximum value of file register. 101H The setting value of uType (type of Value) of pb_st30Member Check and correct the setting, then execute the FB again.
  • Page 18: M+Strprocessing_Jsonserialize_F (Construction Of Json String)

    M+StrProcessing_JSONSerialize_F (Construction of JSON String) Overview This FB constructs the JSON string by specifying the Key string and Value string. M+StrProcessing_JSONSerialize_F B:i_bEN o_bENO:B UD:i_udJSONAddr o_bOK:B o_bErr:B o_uErrId:UW (8)pb_st30Member o_uJSONLength:UW Labels Input labels Label Name Data type Import Setting range Description i_bEN Execution Always...
  • Page 19: Function Details

    Function details Applicable hardware and software Module Firmware version Engineering tool FX5S CPU module 1.00 or later GX Works3 Version 1.087R or later FX5UJ CPU module 1.030 or later GX Works3 Version 1.087R or later FX5U/FX5UC CPU module 1.270 or later GX Works3 Version 1.087R or later Basic specifications Item...
  • Page 20 Usage procedure The following shows the procedure to construct the JSON string by using the Value string (value). Set a numerical value corresponding to the type of Value string (value) for the JSON string to be constructed in uType (type of Value) of pb_st30Member (member list). The type of Value string is as follows. 4: Numerical value/true/false/null, 3: String, 2: Array, 1: Object, or 0: Member structure array end.
  • Page 21 Timing chart of I/O signals ■Completed successfully i_bEN (execution command) o_bENO (execution status) Construction status Unexecuted Executing Unexecuted o_uJSONLength Number of characters (number of characters in JSON string in JSON string) o_bOK (normal completion) o_bErr (error completion) o_uErrId (error code) ■Completed with an error i_bEN (execution command)
  • Page 22: Parameter Settings

    Precautions • A JSON string is constructed without line break codes and spaces. • The number of characters in the constructed JSON string is output to the output label o_uJSONLength (Number of characters in JSON string). The JSON string with the terminator is stored in the file register. •...
  • Page 23: Error Code

    Error code Error code Description Action 100H The setting value of i_udJsonAddr (start address of JSON string Check and correct the setting, then execute the FB again. storage location) exceeds the maximum value of file register. 101H The setting value of uType (type of Value) of pb_st30Member Check and correct the setting, then execute the FB again.
  • Page 24: Chapter 4 Application Example

    APPLICATION EXAMPLE Acquiring Value String from JSON String This chapter describes the procedure to acquire the Value string from the JSON string. In the following example, M+StrProcessing_JSONDeserialize_F (Acquisition of JSON string) is used. Overview The Value string corresponding to the specified Key string is acquired from the JSON string. Key string for ”id1”: 3544528813, items to acquire...
  • Page 25: Process Flow

    Process flow The following shows the process flow to acquire the Value string from the JSON string. FB library registration Register the FB library. For the operating procedure, refer to the following. GX Works3 Operating Manual Programming Create programs. (Page 25 Programming) Presetting Before executing the FB, store the JSON string in the device by using GX Works3.
  • Page 26 Enter R0 in the device name and press the  key. Copy the following values of binary data for pasting to GX Works3, select R0(+0) from the table in the "MAIN (Device Memory)" window, and paste the values. 0A7B 2020 2020 6922 3164...
  • Page 27: Programming

    Programming This section describes programs used in the application example. Program example ■Setting the member information Set the member information in pb_st30Member (member list) of the FB public variable to acquire the Value string. Set the JSON start address to K0. [Element No.0 in member list] ·...
  • Page 28: Constructing The Json String

    Constructing the JSON String This section describes the procedure to construct the JSON string. In the following example, M+StrProcessing_JSONSerialize_F (Construction of JSON string) is used. Overview Construct the JSON string as follows. ”id1”: 3544528813, ”id2”: 1000006554, ”date”: ”2022/12/21”, ”detail”: { ”size”: [125, 128, 180, 179], ”weight”: 256.
  • Page 29: Programming

    Programming This section describes programs used in the application example. Program example ■Setting the member information Set the member information in pb_st30Member (member list) of the FB public variable to construct the JSON string. Set the JSON start address to K100. [Element No.0 in member list] ·...
  • Page 30 ■Constructing the JSON string Turning on M100 (execution command) constructs the JSON string according to the information of uType (type of Value), s32Key (Key string), s64Value (Value string), and uDepth (depth of hierarchy) specified in pb_st30Member (member list), and outputs the JSON string to the file register having the address specified in i_udJsonAddr (start address of JSON string storage location).
  • Page 31: Instruction Index

    INSTRUCTION INDEX ..10 M+StrProcessing_JSONDeserialize_F ..16 M+StrProcessing_JSONSerialize_F...
  • Page 32 MEMO...
  • Page 33: Revisions

    Japanese manual number: SH-082618-A This manual confers no industrial property rights or any rights of any other kind, nor does it confer any patent licenses. Mitsubishi Electric Corporation cannot be held responsible for any problems involving industrial property rights which may occur as a result of using the contents noted in this manual.
  • Page 34: Trademarks

    TRADEMARKS Microsoft and Windows are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries. The company names, system names and product names mentioned in this manual are either registered trademarks or trademarks of their respective companies. In some cases, trademark symbols such as '' or '' are not specified in this manual.
  • Page 36 Manual Number: SH(NA)-082619ENG-A HEAD OFFICE: TOKYO BLDG., 2-7-3, MARUNOUCHI, CHIYODA-KU, TOKYO 100-8310, JAPAN NAGOYA WORKS: 1-14, YADA-MINAMI 5-CHOME, HIGASHI-KU, NAGOYA 461-8670, JAPAN When exported from Japan, this manual does not require application to the Ministry of Economy, Trade and Industry for service transaction permission. Specifications subject to change without notice.

Table of Contents