LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

combine to integer into a single byte, MLC9000, MLC 9000, data manipulation

Hi,
the following is more a discussion then a question, I found two ways to solve my problem, but perhaps there is better way to do it.

Problem:
For a bus compatible PID-Control-System (MLC9000 from West Instruments) I have to combine to integer numbers to a new hex value.
"Instance" has a value from 0 to 7 and "Parameter Nr." has a value from 0 to 31. In binary form "Instance" reaches from 000 up to 111
and "Par.Nr." reaches from 00000 up to 11111, the target is to combine them in a way that in the binary array "Par.Nr." is on index 0 to 4
and "Instance" is on index 5 to 7.
The Result should be:
0 + 25 = 10011000 = 25 = 19h and
1 + 25 = 10011100 = 57 = 39h

Regards, Stefan Pofahl
0 Kudos
Message 1 of 3
(2,603 Views)
My solutions:

Multiply "Instance" with 32 and add it to "Par. Nr.".

Bitshift "Instance" to left 5 bit and add it to "Par. Nr.".
Waldemar

Using 7.1.1, 8.5.1, 8.6.1, 2009 on XP and RT
Don't forget to give Kudos to good answers and/or questions
Message 2 of 3
(2,601 Views)
Waldemar thank you for your ideas!
I added them to my code (see the attachment,
LabView Vers. 7.1),
I like best the solution to multiply
by 32 and than add them to the second
integer.

Regards Stefan
0 Kudos
Message 3 of 3
(2,592 Views)