Class: ToyopucRegister

ToyopucRegister

Provides access to a Toyopuc register at a user-defined address. ToyopucRegister objects are created as part of a group by calling createGroup.

Members


value :bool|number

Gets/sets the value of the register.

In order to update the local value with the value from the PLC, register.read or group.read must be called. group.read can be polled automatically by using autoRead.

If the local value is changed, register.write or group.write must be called to push the value to the PLC. group.write can be called automatically when a value changes by using autoWrite.

Type:
  • bool | number
Since:
  • 1.0 (WAT 2.3)

Methods


read()

Reads the value of the register.

If it is desired to keep the value up to date with the value on the PLC, this method must be called periodically. Alternatively, toyopuc.ToyopucGroup#read can be used to read all registers in the group.

When called (automatically or explicitly), either readSuccess or readFailure will be emitted to indicate that the read is complete if the function returns true.

Since:
  • 1.0 (WAT 2.3)
Returns:

When true, indicates that a read request was started

Type
bool

write()

Writes the value of the registers.

After the value has been locally changed, it can be written to the PLC using this function. Alternatively, toyopuc.ToyopucGroup#write can be used to write all registers in the group.

When called (automatically or explicitly), either writeSuccess or writeFailure will be emitted to indicate that the write is complete if the function returns true.

Since:
  • 1.0 (WAT 2.3)
Returns:

When true, indicates that a write request was started

Type
bool

Events


readFailure

Emitted after a failed read.

Parameters:
Name Type Description
description string

The error that occurred

Since:
  • 1.0 (WAT 2.3)

readSuccess

Emitted after a successful read.

Since:
  • 1.0 (WAT 2.3)

writeFailure

Emitted after a failed write.

Parameters:
Name Type Description
description string

The error that occurred

Since:
  • 1.0 (WAT 2.3)

writeSuccess

Emitted after a successful write.

Since:
  • 1.0 (WAT 2.3)