I/O Unit Online Check Sub

I have attached a sub that does a simple task of checking to see if an I/O unit is ready and communication enabled. If communications is disabled, it will enable comms. Being we have a diverse range of I/O, it made sense to just create a sub that will do the check (this is the Basic version without mistic support, but it should be pretty easy to integrate mistic devices).
It simply takes a pointer table with an I/O unit loaded into index 0, a unit type, a bit index and return variable. The return variable’s bit index will be set if the I/O unit is not online, else it clears the bit. i find it useful to do a quick check to see if the unit is ‘there’ before probing the unit and causing errors. This just makes that check much easier.

I hope someone finds this useful.