private CanOpenStatus configureIoOutputs() { byte io_blocks; uint canopenErrorCode; CanOpenStatus ret; // Read number of I/O-outputs. ret = client_sdo.objectRead(0x2100, 0, out io_blocks, out canopenErrorCode); if (ret != CanOpenStatus.CANOPEN_OK) { return(ret); } this.digital_outputs = io_blocks * 8; // Disable all I/O outputs. ret = client_sdo.objectWrite(0x1600, 0, 0, out canopenErrorCode); if (ret != CanOpenStatus.CANOPEN_OK) { return(ret); } // Map output blocks. Signals are located on object index 6200 with subindex 1 -> n. for (int i = 0; i < io_blocks; i++) { UInt32 val = (UInt32)(0x62000008 + 0x100 * io_blocks); ret = client_sdo.objectWrite(0x1600, (byte)(1 + io_blocks), val, out canopenErrorCode); if (ret != CanOpenStatus.CANOPEN_OK) { return(ret); } } // Enable all I/O outputs. ret = client_sdo.objectWrite(0x1600, 0, io_blocks, out canopenErrorCode); if (ret != CanOpenStatus.CANOPEN_OK) { return(ret); } UInt32 cobid; cobid = (UInt32)(0x00000200 + (node_id)); if (io_blocks == 0) { cobid = cobid | 0x80000000; // Disable PDO. } // Set COBID for RPDO. ret = client_sdo.objectWrite(0x1400, 1, cobid, out canopenErrorCode); if (ret != CanOpenStatus.CANOPEN_OK) { return(ret); } // Set transmission type to 254. ret = client_sdo.objectWrite(0x1400, 2, (byte)(254), out canopenErrorCode); if (ret != CanOpenStatus.CANOPEN_OK) { return(ret); } // Start node. ret = nmt_mlaster.nodeStart(node_id); if (ret != CanOpenStatus.CANOPEN_OK) { return(ret); } return(CanOpenStatus.CANOPEN_OK); }
protected void btnStartNode3_Click(object sender, EventArgs e) { nmt_Master.nodeStart(3); }