When data is read/written from/to device addresses at the execution of the File Read/File Write function, the storage order of the written (readout) data can be specified.
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.
Use the following to reference LS9130.
Write File: _CF_write(), SD_write(), _USB_write()
Read File: _CF_read(), _SD_read(), _USB_read()
Read CSV File: _CF_read_csv(), _SD_read_csv(), _USB_read_csv()
Send printer operation: IO_WRITE([p:PRN],...)
When writing or reading to device addresses, instead of using the LS9130 storage mode, you can use the following functions to interact with the [Text Data Mode] property in the [System Settings], [Device/PLC] page.
Output File List: _CF_dir(), _SD_dir(), _USB_dir()
Mode 0
Example: When the File Read function is used to write a string "ABCDEFG" in a device address
[w:[#INTERNAL]LS9130] = 0
_CF_read ("\DATA", "DATA0001.BIN", [w:[#INTERNAL]LS0100],
0, 7)
When the device address length
is 16 bits
When the device address length
is 32 bits
Mode 1
Example: When the File Read function is used to write a string "ABCDEFG" in a device address
[w:[#INTERNAL]LS9130] = 1
_CF_read ("\DATA", "DATA0001.BIN", [w:[#INTERNAL]LS0100],
0, 7)
When the device address length
is 16 bits
When the device address length
is 32 bits
Mode 2
Example: When the File Read function is used to write a string "ABCDEFG" in a device address
[w:[#INTERNAL]LS9130] = 2
_CF_read ("\DATA", "DATA0001.BIN", [w:[#INTERNAL]LS0100],
0, 7)
When the device address length
is 16 bits
When the device address length
is 32 bits
Mode 3
Example: When the File Read function is used to write a string "ABCDEFG" in a device address
[w:[#INTERNAL]LS9130] = 3
_CF_read ("\DATA", "DATA0001.BIN", [w:[#INTERNAL]LS0100],
0, 7)
When the device address length
is 16 bits
When the device address length
is 32 bits
The data storage mode for scripts is not the same as the string data mode in the [System Settings], [Device/PLC] page. A 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 |