Summary
Outputs the designated number of bytes to the COM port. The data is output regardless of the printer type specified.
Format
IO_WRITE (Printer port, Output Data Storage Address,
Number of Output Bytes)
Parameter 1: [p:PRN]
Parameter 2: Internal Device
Parameter 3: Integer value, Device address, Temporary address
The maximum value that can be assigned to Parameter 3 is 1024. Even when specifying values larger than 1024, only 1024 bytes of data is output from the COM port.
Example expression 1:
IO_WRITE ([p:PRN], [w:[#INTERNAL]LS1000], 10)
In the example above, 10 bytes of data stored in LS1000 and later areas are output from the COM port.
Example expression 2:
IO_WRITE ([p:PRN], [w:[#INTERNAL]LS1000], [w:[#INTERNAL]LS0800])
In the example above, the number of bytes of data written from LS1000 to LS0800 is output to COM port.
Example expression 3:
IO_WRITE ([p:PRN], [w:[#INTERNAL]LS1000], [t:0010])
In the example above, the data stored in LS1000 and later areas are output from the COM port. The number of bytes is that same as that written in the Temporary address [t:0010].
Data Storage Mode
When data is read from device addresses upon execution of the COM Port Operation function, you can specify the storage order of the readout data.
Setting the data storage mode in LS9130 can change the storage order.
The mode can be selected from four options: 0, 1, 2 or 3.
Mode 0
For example, when the COM Port Operation function is used to read the string "ABCDEFG" from a device address
[w:[#INTERNAL]LS9130] = 0
IO_WRITE ([p:PRN], [w:[#INTERNAL]LS1000], 7)
When the device address length is 16 bits
When the device address length is 32 bits
Mode 1
For example, when the COM Port Operation function is used to read the string "ABCDEFG" from a device address
[w:[#INTERNAL]LS9130] = 1
IO_WRITE ([p:PRN], [w:[#INTERNAL]LS1000], 7)
When the device address length is 16 bits
When the device address length is 32 bits
Mode 2
For example, when the COM Port Operation function is used to read the string "ABCDEFG" from a device address
[w:[#INTERNAL]LS9130] = 2
IO_WRITE ([p:PRN], [w:[#INTERNAL]LS1000], 7)
When the device address length is 16 bits
When the device address length is 32 bits
Mode 3
For example, when the COM Port Operation function is used to read the string "ABCDEFG" from a device address
[w:[#INTERNAL]LS9130] = 3
IO_WRITE ([p:PRN], [w:[#INTERNAL]LS1000], 7)
When the device address length is 16 bits
When the device address length is 32 bits
The data storage mode is not the same as the string data mode in the [System Settings] window's [Device/PLC] page. The comparison of the data storage mode and the string data mode is shown below.
Data in Device Addresses |
LH/HL Storage |
Double-word Byte LH/HL storage order |
D-Script data storage mode |
Text Data Mode |
---|---|---|---|---|
Store from Start Data |
HL Order |
HL Order |
0 |
1 |
LH Order |
1 |
2 |
||
HL Order |
LH Order |
2 |
5 |
|
LH Order |
3 |
4 |
||
Store from Last Data |
HL Order |
HL Order |
-- |
3 |
LH Order |
-- |
7 |
||
HL Order |
LH Order |
-- |
8 |
|
LH Order |
-- |
6 |