I am communicating to a remote IO system not from Unitronics.
This IO System has 16,32, and 64 Digital Inputs or Output Modules but will only receive the information in 16bit registers via modbus in holding registers.
In order to translate digital values to registers I can use the num to bit or bit to num option of the unistream but I am bound to using an array of bits to use it.
I have my variables declared differently in my program therefore I need to use a lot of programming space and time to do it.
For example let's say I have variables named Valve1Open, Valve2Open, Valve3Open, ect.
First I need to create an array of bits ex OutputArray[0..16]
Then for each variable I need to do:
Valve1Open == InputArray[0]
Valve2Open == InputArray[1]
Valve3Open == InputArray[2]
...
and so on.
Then BitstoNum from OutputArray to get my OutputRegister to use in modbus.
For projects with multiple modules than can take 100-200 IOs or more this can get frustrating.
I would like to use a UDFB to put in all my variable names and just get 16 bit register as a result and reuse the block to reduce time,space, and variables.
Therefore I need at least 16 inputs/outputs on the UDFB.
But I could find more applications for UDFBs with more that 10 Inputs and Outputs.