Used to read and write IO. Each IO read and write provides four ways to perform the operation.
The IOData structure is a convenience structure for working with the IO Data from the controller.. This allows you to access the bits by treating it like an array.
Writable addresses are network input on all controllers. Interface Panel and General Output are writable on YRC1000 and newer.
If the error "Code (40961): The address is invalid." appears when calling any of these functions. Check that the group is valid (if applicable). ReadByte and ReadWord address functions only accepts the address of the first bit of the input group/output group (addresses ending with zero).
Name | Description |
---|---|
ConvertIOGroupToBitAddress | Conversion of IOGroup to bit address. |
ReadBit | Read a bit from the controller using the specified IO type, group, and bit position. |
ReadBit | Read a bit from the controller using the specified address. |
ReadByte | Read a byte from the controller using the specified IO type and group. Reads the value as IOByteData. |
ReadByte | Read a byte from the controller using the specified address. Gets value as IOByteData. |
ReadByte | Read a byte from the controller using the specified IO type and group. Reads the value as Byte. |
ReadByte | Read a byte from the controller using the specified address. Gets value as Byte |
ReadWord | Read a word from the controller using the specified IO type and group. Reads the value as IOWordData. |
ReadWord | Read a word from the controller using the specified address. Gets value as IOWordData. |
ReadWord | Read a word from the controller using the specified IO type and group. Reads the value as UINT16. |
ReadWord | Read a word from the controller using the specified address. Reads the value as UINT16 |
WriteBit | Write a bit from the controller using the specified IO type and group. |
WriteBit | Write a bit from the controller using the specified address. |
WriteByte | Write a byte to the controller using the specified IO type and group. Writes the value as IOByteData. |
WriteByte | Write a byte to the controller using the specified address. Writes the value as IOByteData. |
WriteByte | Write a byte to the controller using the specified IO type and group. Writes the value as Byte. |
WriteByte | Write a byte to the controller using the specified address. Writes the value as Byte |
WriteWord | Write a word to the controller using the specified IO type and group. Writes the value as IOWordData. |
WriteWord | Write a word to the controller using the specified address. Writes the value as IOWordData. |
WriteWord | Write a word to the controller using the specified IO type and group. Writes the value as UINT16. |
WriteWord | Write a word to the controller using the specified address. Writes the value as UINT16 |
ReadRegister | Read a register as a UInt16 object. |
ReadRegister | Read a register as a RegisterData object. |
WriteRegister | Write a register as a UInt16 object. |
WriteRegister | Write a register as a RegisterData object. |
UInt32 ConvertIOGroupToBitAddress(IOType type, UInt16 group, Byte bitIndex, out StatusInfo statusInfo);
Please note that the return value for ConvertIOGroupToBitAddress will NOT be a StatusInfo object as seen in other functions.
type
[in] The type of IO to convert. See IOType.
group
[in] The group of IO to convert.
bitIndex
[in] The bit index of the IO to convert.
statusInfo
[out] A StatusInfo object indicating if the operation was successful.
The bit address.
//`c` is a MotomanController object that has been created with ` YMConnect.OpenConnection`
uint bitAddress = c.IO.ConvertIOGroupToBitAddress(IOType.GeneralOutput, 0, 0, out status);
Console.WriteLine(status);
Console.WriteLine(bitAddress);
//be sure to close `c` with `YMConnect.CloseConnection` when the application is done
Output
Code (0): OK
10000
StatusInfo ReadBit(IOType type, UInt16 group, Byte bitPosition, out bool ioBit);
ioType
[in] The type of IO to read. See IOType.
group
[in] The group of IO to read.
bitPosition
[in] The bit position of the IO to read.
ioBit
[out] The value of the bit.
A StatusInfo object indicating if the operation was successful.
//`c` is a MotomanController object that has been created with ` YMConnect.OpenConnection`
status = c.IO.ReadBit(IOType.GeneralInput, 0, 0, out bool value);
Console.WriteLine(status);
Console.WriteLine(value);
//be sure to close `c` with `YMConnect.CloseConnection` when the application is done
Output
Code (0): OK
0
StatusInfo ReadBit(UInt32 address, out bool ioBit);
address
[in] The address of the IO to read.
value
[out] The value of the bit.
A StatusInfo object indicating if the operation was successful.
//`c` is a MotomanController object that has been created with ` YMConnect.OpenConnection`
status = c.IO.ReadBit(10010, out bool value);
Console.WriteLine(status);
Console.WriteLine(value);
//be sure to close `c` with `YMConnect.CloseConnection` when the application is done
Output
Code (0): OK
0
StatusInfo ReadByte(IOType type, UInt16 group, out IOByteData io);
ioType
[in] The type of IO to read. See IOType.
group
[in] The group of IO to read.
value
[out] The value of the byte represented as an IOByteData object. See IOData.
A StatusInfo object indicating if the operation was successful.
//`c` is a MotomanController object that has been created with ` YMConnect.OpenConnection`
status = c.IO.ReadByte(IOType.GeneralInput, 0, out IOByteData value);
Console.WriteLine(status);
Console.WriteLine(value);
//be sure to close `c` with `YMConnect.CloseConnection` when the application is done
Output
Code (0): OK
00000000
StatusInfo ReadByte(UInt32 address, out IOByteData io);
address
[in] The address of the IO to read.
value
[out] The value of the byte represented as an IOByteData object. See IOData
A StatusInfo object indicating if the operation was successful.
//`c` is a MotomanController object that has been created with ` YMConnect.OpenConnection`
status = c.IO.ReadByte(10010, out IOByteData value);
Console.WriteLine(status);
Console.WriteLine(value);
//be sure to close `c` with `YMConnect.CloseConnection` when the application is done
Output
Code (0): OK
00000000
StatusInfo ReadByte(IOType type, UInt16 group, out Byte io);
ioType
[in] The type of IO to read. See IOType.
group
[in] The group of IO to read.
io
[out] The value of the byte represented as a Byte.
A StatusInfo object indicating if the operation was successful.
//`c` is a MotomanController object that has been created with ` YMConnect.OpenConnection`
status = c.IO.ReadByte(IOType.GeneralInput, 0, out byte value);
Console.WriteLine(status);
Console.WriteLine(value);
//be sure to close `c` with `YMConnect.CloseConnection` when the application is done
Output
Code (0): OK
0
StatusInfo ReadByte(UInt32 address, out Byte io);
address
[in] The address of the IO to read.
value
[out] The value of the byte represented as a Byte.
A StatusInfo object indicating if the operation was successful.
//`c` is a MotomanController object that has been created with ` YMConnect.OpenConnection`
status = c.IO.ReadByte(10010, out byte value);
Console.WriteLine(status);
Console.WriteLine(value);
//be sure to close `c` with `YMConnect.CloseConnection` when the application is done
Output
Code (0): OK
0
StatusInfo ReadWord(IOType type, UInt16 group, out IOWordData io);
ioType
[in] The type of IO to read. See IOType.
group
[in] The group of IO to read.
value
[out] The value of the word represented as an IOWordData object. See IOData
A StatusInfo object indicating if the operation was successful.
//`c` is a MotomanController object that has been created with ` YMConnect.OpenConnection`
status = c.IO.ReadWord(IOType.GeneralInput, 0, out IOWordData value);
Console.WriteLine(status);
Console.WriteLine(value);
//be sure to close `c` with `YMConnect.CloseConnection` when the application is done
Output
Code (0): OK
0
StatusInfo ReadWord(UInt32 address, out IOWordData io);
address
[in] The address of the IO to read.
value
[out] The value of the word represented as a UINT16.
A StatusInfo object indicating if the operation was successful.
//`c` is a MotomanController object that has been created with ` YMConnect.OpenConnection`
status = c.IO.ReadWord(10010, out IOWordData value);
Console.WriteLine(status);
Console.WriteLine(value);
//be sure to close `c` with `YMConnect.CloseConnection` when the application is done
Output
Code (0): OK
0
StatusInfo ReadWord(IOType type, UInt16 group, out UInt16 io);
ioType
[in] The type of IO to read. See IOType.
group
[in] The group of IO to read.
io
[out] The value of the word represented as a UINT16.
A StatusInfo object indicating if the operation was successful.
//`c` is a MotomanController object that has been created with ` YMConnect.OpenConnection`
status = c.IO.ReadWord(IOType.GeneralInput, 0, out UInt16 value);
Console.WriteLine(status);
Console.WriteLine(value);
//be sure to close `c` with `YMConnect.CloseConnection` when the application is done
Output
Code (0): OK
0
StatusInfo ReadWord(UInt32 address, out UInt16 io);
address
[in] The address of the IO to read.
value
[out] The value of the word represented as a UINT16.
A StatusInfo object indicating if the operation was successful.
//`c` is a MotomanController object that has been created with ` YMConnect.OpenConnection`
status = c.IO.ReadWord(10010, out ushort value);
Console.WriteLine(status);
Console.WriteLine(value);
//be sure to close `c` with `YMConnect.CloseConnection` when the application is done
Output
Code (0): OK
0
StatusInfo WriteBit(UInt32 address, bool ioBit);
address
[in] The address of the IO to write.
value
[in] The value of the bit.
A StatusInfo object indicating if the operation was successful.
//`c` is a MotomanController object that has been created with ` YMConnect.OpenConnection`
status = c.IO.WriteBit(10010, true);
Console.WriteLine(status);
//be sure to close `c` with `YMConnect.CloseConnection` when the application is done
Output
Code (0): OK
StatusInfo WriteBit(IOType type, UInt16 group, Byte bitPosition, bool ioBit);
type
[in] The type of IO to write. See IOType.
group
[in] The group of IO to write.
bitPosition
[in] The bit position of the IO to write.
ioBit
[in] The value of the bit.
A StatusInfo object indicating if the operation was successful.
//`c` is a MotomanController object that has been created with ` YMConnect.OpenConnection`
status = c.IO.WriteBit(IOType.GeneralOutput, 0, 0, true);
Console.WriteLine(status);
//be sure to close `c` with `YMConnect.CloseConnection` when the application is done
Output
Code (0): OK
StatusInfo WriteByte(IOType type, UInt16 group, IOByteData io);
ioType
[in] The type of IO to write. See IOType.
group
[in] The group of IO to write.
value
[in] The value of the byte represented as an IOByteData object. See IOData
A StatusInfo object indicating if the operation was successful.
//`c` is a MotomanController object that has been created with ` YMConnect.OpenConnection`
status = c.IO.WriteByte(IOType.GeneralOutput, 0, new IOByteData(1));
Console.WriteLine(status);
//be sure to close `c` with `YMConnect.CloseConnection` when the application is done
Output
Code (0): OK
StatusInfo WriteByte(UInt32 address, IOByteData io);
address
[in] The address of the IO to write.
value
[in] The value of the byte represented as an IOByteData object. See IOData
A StatusInfo object indicating if the operation was successful.
//`c` is a MotomanController object that has been created with ` YMConnect.OpenConnection`
status = c.IO.WriteByte(10010, new IOByteData(1));
Console.WriteLine(status);
//be sure to close `c` with `YMConnect.CloseConnection` when the application is done
Output
Code (0): OK
StatusInfo WriteByte(IOType type, UInt16 group, Byte io);
ioType
[in] The type of IO to write. See IOType.
group
[in] The group of IO to write.
io
[in] The value of the byte represented as a Byte.
A StatusInfo object indicating if the operation was successful.
//`c` is a MotomanController object that has been created with ` YMConnect.OpenConnection`
status = c.IO.WriteByte(IOType.GeneralOutput, 0, 1);
Console.WriteLine(status);
//be sure to close `c` with `YMConnect.CloseConnection` when the application is done
Output
Code (0): OK
StatusInfo WriteByte(UInt32 address, Byte io);
address
[in] The address of the IO to write.
io
[in] The value of the byte represented as a Byte.
A StatusInfo object indicating if the operation was successful.
//`c` is a MotomanController object that has been created with ` YMConnect.OpenConnection`
status = c.IO.WriteByte(10010, 1);
Console.WriteLine(status);
//be sure to close `c` with `YMConnect.CloseConnection` when the application is done
Output
Code (0): OK
StatusInfo WriteWord(IOType type, UInt16 group, IOWordData io);
ioType
[in] The type of IO to write. See IOType.
group
[in] The group of IO to write.
io
[in] The value of the word represented as an IOWordData object. See IOData
A StatusInfo object indicating if the operation was successful.
//`c` is a MotomanController object that has been created with ` YMConnect.OpenConnection`
status = c.IO.WriteWord(IOType.GeneralOutput, 0, new IOWordData(1));
Console.WriteLine(status);
//be sure to close `c` with `YMConnect.CloseConnection` when the application is done
Output
Code (0): OK
StatusInfo WriteWord(UInt32 address, IOWordData io);
address
[in] The address of the IO to write.
value
[in] The value of the word represented as an IOWordData object. See IOData
A StatusInfo object indicating if the operation was successful.
//`c` is a MotomanController object that has been created with ` YMConnect.OpenConnection`
status = c.IO.WriteWord(10010, new IOWordData(1));
Console.WriteLine(status);
//be sure to close `c` with `YMConnect.CloseConnection` when the application is done
Output
Code (0): OK
StatusInfo WriteWord(IOType type, UInt16 group, UInt16 io);
ioType
[in] The type of IO to write. See IOType.
group
[in] The group of IO to write.
value
[in] The value of the word represented as a UINT16.
A StatusInfo object indicating if the operation was successful.
//`c` is a MotomanController object that has been created with ` YMConnect.OpenConnection`
status = c.IO.WriteWord(IOType.GeneralOutput, 0, 1);
Console.WriteLine(status);
//be sure to close `c` with `YMConnect.CloseConnection` when the application is done
Output
Code (0): OK
StatusInfo WriteWord(UInt32 address, UInt16 io);
address
[in] The address of the IO to write.
value
[in] The value of the word represented as a UINT16.
A StatusInfo object indicating if the operation was successful.
//`c` is a MotomanController object that has been created with ` YMConnect.OpenConnection`
status = c.IO.WriteWord(10010, 1);
Console.WriteLine(status);
//be sure to close `c` with `YMConnect.CloseConnection` when the application is done
Output
Code (0): OK
StatusInfo ReadRegister(UInt16 registerAddress, out UInt16 registerData);
registerAddress
[in] The address of the register to read.
registerData
[out] The value of the register represented as a UInt16 object.
A StatusInfo object indicating if the operation was successful.
//`c` is a MotomanController object that has been created with ` YMConnect.OpenConnection`
StatusInfo status = c.IO.ReadRegister(0, out UInt16 value);
Console.WriteLine(status);
Console.WriteLine(value);
//be sure to close `c` with `YMConnect.CloseConnection` when the application is done
Output
Code (0): OK
00000000
StatusInfo ReadRegister(UInt16 registerAddress, out RegisterData registerData);
address
[in] The address of the register to read.
value
[out] The value of the register represented as a RegisterData object.
A StatusInfo object indicating if the operation was successful.
//`c` is a MotomanController object that has been created with ` YMConnect.OpenConnection`
StatusInfo status = c.IO.ReadRegister(0, out RegisterData value);
Console.WriteLine(status);
Console.WriteLine(value);
//be sure to close `c` with `YMConnect.CloseConnection` when the application is done
Output
Code (0): OK
00000000
StatusInfo WriteRegister(UInt16 registerAddress, UInt16 registerData);
address
[in] The address of the register to write.
value
[in] The value of the register represented as a UInt16.
A StatusInfo object indicating if the operation was successful.
//`c` is a MotomanController object that has been created with ` YMConnect.OpenConnection`
StatusInfo status = c.IO.WriteRegister(0, 1);
Console.WriteLine(status);
//be sure to close `c` with `YMConnect.CloseConnection` when the application is done
Output
Code (0): OK
StatusInfo WriteRegister(UInt16 registerAddress, RegisterData registerData);
address
[in] The address of the register to write.
value
[in] The value of the register represented as a RegisterData object.
A StatusInfo object indicating if the operation was successful.
//`c` is a MotomanController object that has been created with ` YMConnect.OpenConnection`
StatusInfo status = c.IO.WriteRegister(0, new RegisterData(1));
Console.WriteLine(status);
//be sure to close `c` with `YMConnect.CloseConnection` when the application is done
Output
Code (0): OK