Create 16 single bit input to a 16bit modbus value

i want to convert 16 time single bit into one 16 bit value for my modbus project. when 1 bit input change the 16 bit value has also to change. There has to be a memory of all the states of the inputs... has somebody an solution?

This should get you started...