Jean20 Posted May 21, 2020 Report Posted May 21, 2020 (edited) Hi, I am using Sysmac Studio. I want create a function block to convert a BYTE into 8 bits. How can I create that FB? Thank you, Jean Edited May 21, 2020 by Jean20
Michael Walsh Posted May 21, 2020 Report Posted May 21, 2020 I assume that your difficulty is with creating the code to do it, not with the actual creation of a function block. So, I am just showing the code below. You can use the Union functionality. First, open up Data Types and create a union: Then create a variable of that union type (MyUnion in this example): Then you can do a move from the byte variable that you want to convert into MyUnion.ByteLevel as shown below in rung 0. Then you can use the bits within that byte as shown in rung 1 as MyUnion.BitLevel[0].
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now