How to create a UNION of BOOL[16] and WORD

Hello all,
new to Node-Red.

I would like to create a union connecting an array of bool [16] and a word (hex) then convert the word to a string. Any ideas? so 0000000000001100 -> 0000000C -> "0000000C"

Thank you for your time.

Just checking, your 16bit binary number would normally be reduced to a 4digit hex number i.e 000C (as each hex digit represents 4 bits)

Would it it be OK to do that or do you really need "0000000C"?

Could you feed your two values into a debug node and show us what you see please. That will ensure there is no confusion. The sort of confusion there may be is whether the WORD value is a String or a Number. Also whether you mean true/false for your bools or 1/0 (which are actually Numbers not booleans).

Sorry for the lack of detail. I am connecting my PC running Node-Red to my RFID controller via serial.
The Omron V640 system has this as the protocol
image

The 'Node No', 'Command Code' and 'parameter' sections make up a string.
I have already taken care of the preamble and postamble .

I was hoping to use the dashboard tools to have a switch for each page of a tag to read and union those to a DWORD (sorry for my initial mistake) or eight digits then convert to a string for the 8 characters
image

I have done this in my Omron NX102 PLC already and wanted to offer a solution for any customers using Node-Red versus a PLC. The PLC has a built-in capability to create a union of BOOL[32] and DWORD

So, by assigning a switch to bit 2 and another to bit 3 (designating tag pages 1 & 2 the rest off) this would result in a DORD of 0000000C then convert to a 8 character string to basically CONCAT NodeNo, Command, Parameter

Hope this helps.

As I asked,

Edit: And tell us what you expect to get out, given that input data.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.