...
Your systems Engineer decided to assign Modbus discrete input numbers 100, 101 and 102 to the three switches and the other discrete inputs to 103 through 118.
Code Block | ||
---|---|---|
| ||
CPU_BOOLEAN AppDITbl[16]; CPU_BOOLEAN AppSwStart; CPU_BOOLEAN AppSwStop; CPU_BOOLEAN AppSwReset; CPU_BOOLEAN MB_DIRd (CPU_INT16U di, CPU_INT16U *perr) { *perr = MODBUS_ERR_NONE; switch (di) { case 100: return (AppSwStart); case 101: return (AppSwStop); case 102: return (AppSwReset); case 103: case 104: case 105: case 106: case 107: case 108: case 109: case 110: case 111: case 112: case 113: case 114: case 115: case 116: case 117: case 118: return (AppDITbl[di |
...
- 103]); default: *perr = MODBUS_ERR_RANGE; return (FALSE); } } |
...