BusWorks Model XT1531‐000
4 CH Current 4 CH Digital I/O w/USB & Modbus
Acromag, Inc. Tel: 248‐295‐0880
‐
43
‐
Example Code (w/Coil Registers Disabled)
WriteDigitalOutput(int channel, bool state)
{
switch( channel )
{
case 0:
case 4:
case 8:
case 12:
if( state )
OutputWord[ channel / 4 ] |= 0x0001;
break;
else
OutputWord[ channel / 4 ] &= ~0x0001;
case 1:
case 5:
case 9:
case 13:
if( state )
OutputWord[ channel / 4 ] |= 0x0002;
break;
else
OutputWord[ channel / 4 ] &= ~0x0002;
case 2:
case 6:
case 10:
case 14:
if( state )
OutputWord[ channel / 4 ] |= 0x0004;
break;
else
OutputWord[ channel / 4 ] &= ~0x0004;
case 3:
case 7:
case 11:
case 15:
if( state )
OutputWord[ channel / 4 ] |= 0x0008;
else