void portBlockOut (u8 portBlockNumber, u8 value)
portBlockNumber : Port block number (0 through 5) |
value : 0 through 255 |
Sets the output state of all ports in the given port block, portBlockNumber. value is a bit array corresponding to the 8 individual ports in the port block. If portBlockNumber were 1, value's bit 0 would correspond to port 10 and value's bit 7 would correspond to port 17.
portBlockOut(1,7); // Ports 10-12: ON, Ports 13-17 OFF, (7 = b0000 0111 )
The following program will copy all the outputs read from an input module in slot 0 (DIO +0) to the output module in slot 1 (DIO + 10).
#include "moacon500.h" void cmain() { portInit(0, 1); // Input module in slot 0 portInit(1, 0); // Output module in slot 1 while(1) { u8 state = portBlockIn(0); // Read all 8 inputs portBlockOut(1, state); // Copy input state to outputs } }