iQ-F – Conversion between a single STRING and an array of WORD values

This article contains GX Works3 function blocks for iQ-F CPU that allow the division of a single string into an array of WORD values and joining an array of WORD values into a single string.

Function blocks

These function blocks can be used to convert an array of numbers to one string with a specified separator or to convert a string with a specified separator to an array of numbers. An example of an application where this could be useful is exchanging multiple numerical values with another device over serial communication.

a) Array to string conversion

 This block takes all the WORD values specified by wArray (up to wArrayLength) and converts them to one string (sResult) containing the numbers separated by sSeparator.

edbsn7dfa601e5225bac4c5a59877d2c0f01a5063f4657706b772e7187ef04dc8b868e24ca91e7281ca7803643a6d358085fd9105cf7c542bb4977195be2054d6331e?inline=true

Input:

bEnable– signal to start the conversion  [bit]

wArray– array of numbers   [Word [Signed](0..4)]

sSeparator– separator of numbers in final string [String(32)]

wArrayLength– length of wArray    [Word[Signed]] (maximum value is 5 by default)

Output:

sResult– result string  [String(68)]

b) String to array conversion

This block takes the string specified by sString, searches it for separators based on sSeparator and divides the string into an array of WORD values (wArrayOutput).

edbsn7dfa601e5225bac4c5a59877d2c0f01aa9e1389b0c3ac84c95dc14b7d5cd9d3e2af4aec2185bc0bc321405599c383f3b0c9e049549d5a45f120d489482f1417f?inline=true

Input:

bEnable– signal to start the conversion   [bit]

sString– string which will be converted   [String(68)]

sSeparator–  separator of words in sString        [String(32)]

Output:

wArrayOutput–  array of numbers   [Word [Signed](0..4)]

In both cases the size of WORD arrays is 5, it is possible to change the sizes of the arrays by changing local variables of function blocks.

The same situation with the output string, which is a String(68) variable by default. You can change it if you need to have a longer string than (68).

Conversion example

iQ-F - Mitsubishi Electric
iQ-F - Conversion between a single STRING and an array of WORD values 4

DOWNLOAD – String to array and array to string conversion function blocks
Original article for more downloads – Article

Latest news and stories

Generating an HL file in Adtech Licensing Utility v. 10.0.0.47 and above

Generating an HL file in...
Read More

iQ-F – Conversion between a single STRING and an array of WORD values

iQ-F - Conversion between a...
Read More

Inv – FR-A800 – Master Slave Synchronization – Changing rotation direction

Inv - FR-A800 - Master-Slave...
Read More

The Adroit Team Takes on Padel: A Fun Match with a Competitive Edge

The Adroit Team Takes on...
Read More

Adroit Technologies announces Management changes as of 1st August 2024

Adroit Technologies announces Management changes...
Read More

Mitsubishi Electric Low Voltage Switchgear Workshop

Low Voltage Switchgear Workshop Powering...
Read More

Congratulations to Our Newly Certified Engineers at Adroit Technologies!

Congratulations to Our Newly Certified...
Read More

Adroit SCADA and Mitsubishi Electric Factory Automation Training

Master the Future of Automation...
Read More

Dave’s Desk

From Dave's Desk Welcome to...
Read More

Understanding energy use in real-time can lead to greater profits

Understanding energy use in real-time...
Read More

Mitsubishi Electric Partner Meeting in South Africa

Mitsubishi Electric Partner Meeting in...
Read More

Dave’s Desk February 2024

FROM DAVE’S DESK – Energy...
Read More

Discover the Future of Industrial Automation with Adroit Product Suite!

Adroit Technologies is revolutionizing the...
Read More

Dave’s Desk January 2024

FROM DAVE’S DESK – ENERGY,...
Read More

Dave’s Desk August

Dave's Desk I was asked...
Read More

Mitsubishi Electric Partner meeting in Italy

Mitsubishi Electric Partner meeting in...
Read More

How to effectively log your data in Adroit

How to effectively log your...
Read More

The FR-E800 supports the following control Methods

The FR-E800 supports the following...
Read More

Dave’s Desk

From Dave's Desk The recent...
Read More

Adroit at the Africa Automation Technology Fair

"ADROIT TECHNOLOGIES AT AFRICA AUTOMATION...
Read More

Need the most open, advanced, and scalable industrial SCADA platform on the market? We Are Experts!

Scroll to Top