BusWorks Model XT1531‐000
4 CH Current 4 CH Digital I/O w/USB & Modbus
Acromag, Inc. Tel: 248‐295‐0880
‐
45
‐
Example Code (w/Coil Registers Disabled)
break;
}
}
// This method assumes that there is only 1 master writing to the output(s) and
// simply stores the last written values internally
main()
{
unsigned char Loop;
// set/clear the outputs as needed
WriteDigitalOutput(1, ON);
WriteDigitalOutput(12, OFF);
// write the outputs using whatever Modbus hook you have, this is an example and yours will differ
for(Loop=0; Loop<4; Loop++)
WriteHoldingRegister(FIRST_DO_HA Loop, OutputWord[Loop]);
}
// This method assumes that there is more than 1 master or some other entity that
// could possibly change the output(s) and reads the current output values from
// the device first.
main()
{
unsigned char Loop;
// Read the 4 output words from the device first and store in the
// OutputWord variable using whatever Modbus hook you have. This is
// just an example and your code will differ.
for(Loop=0; Loop<4; Loop++)
ReadHoldingRegister(FIRST_DO_HA Loop, OutputWord[Loop]);
// set/clear the outputs as needed
WriteDigitalOutput(1, ON);
WriteDigitalOutput(12, OFF);
// write the outputs using whatever Modbus hook you have, this is an example and yours will differ
for(Loop=0; Loop<4; Loop++)
WriteHoldingRegister(FIRST_DO_HA Loop, OutputWord[Loop]);
}