Luka0204 Posted November 9, 2016 Report Posted November 9, 2016 Hi, I have variable (named var1) with data type 'Word[Unsigned]/Bit String [16-bit]' with Array [0..7]. I want to put 16 variables with data type 'bit' in var1. Is there function for that? Also is it possible to put 16 variables (bit) like this: var1[0].0:=bit1; var1[0].1:=bit2 etc. I'm using GX Works 2 with CPU L02 Best Regards
kaare_t Posted November 9, 2016 Report Posted November 9, 2016 No, but you can do it by using "BITARR_TO_INT", and then from the INT (Word-Signed) convert to WORD (Word-Unsigned) by using "INT_TO_WORD" Alternatively if you don't want to create an array of your bits, you can use "SET_BIT_OF_INT" (16 times if no loop), and then take the INT (Word-Signed) and convert it to WORD (Word-Unsigned) by using "INT_TO_WORD" Also a combination of the two is possible, with or without loops to ease the time taken to develop. If you clarify more what you want to achieve, and what kind of language you are using (ST, LD, STLD...) we can help you further if you have any more questions.
Luka0204 Posted November 10, 2016 Author Report Posted November 10, 2016 Thanks for the reply. I used 'SET_BIT_OF_INT' with 'INT_TO_WORD' for my program and it is a good solution. Once again, thank you!
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