Summary/Issue Description
When an application requires to convert data, it is important to use the same data type in order to use the values, therefore, it's important to have the basics of the data types:
The INTEGER data stores whole numbers such as negative and positive numbers. Integers are typically used to store counts and quantities.
The BIT STRING data is a sequence of bits that can be used to represent sets or manipulate binary data. Bit strings are also known as WORD data and are represented only with 0 and 1.
Root Cause
On Sysmac Studio you cannot directly convert INT to a BIT STRING data, but it can use the Conversion Instruction to convert Integers to WORD and then use a UNION user-defined data type which allows the users to move the values and display it as a bit string
Solution
Step 1: Create a UNION DATA TYPE, under Programming > Data > Data types > Union. Click on the empty space and assign a name for the Data type i.e. BIT_STRING_CONVERT. Then right-click on the data type and create a new member, you must have at least a WORD member and an ARRAY of BOOL:
Step 2: Create a Global variable with the user-defined data type recently created, under Programming > Data > Global Variables. Right-click on the empty space and create a variable to store the Integer value, and a variable for the user-defined data BIT_STRING CONVERT.
Step 3: Use the DINT to WORD instruction on Sysmac on a programming section and define the variables as the example below:
Once the conversion is done, you have access to the bit string to control and monitor the data at your convenience.
Date/Revision History
First Review: 02/05/2025 V1.0
2nd Review: 02/07/2025 V1.1
Author:
Karla Flores Avila, Technical Support Specialist
References
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article