WinGP SDK provides three ways to handle bit data when accessing the bit device.
16-bit unit: Handles the data as a bit array in a 16-bit unit on the bit device.
The specified number of bit data is stored/used right-aligned from the D0 bit.
The data buffer requires sufficient space for 16 bit even if the specified number is 1. Also, the number needs to be specified in 16-bit units.
(Example) Data buffer storing order when 20 bit devices are specified:
D15 |
D14 |
D13 |
D12 |
D11 |
D10 |
D9 |
D8 |
D7 |
D6 |
D5 |
D4 |
D3 |
D2 |
D1 |
D0 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
16 |
15 |
14 |
13 |
12 |
11 |
10 |
9 |
8 |
7 |
6 |
5 |
4 |
3 |
2 |
1 |
* |
* |
* |
* |
* |
* |
* |
* |
* |
* |
* |
* |
20 |
19 |
18 |
17 |
Applicable API
ReadDeviceBit/WriteDeviceBit()
When specifying 1 (EASY_AppKind_Bit) for the data type in ReadDevice/WriteDevice(), ReadDeviceVariant/WriteDeviceVariant()
When specifying a bit symbol and a group that includes any bit symbol in ReadSymbol/WriteSymbol()
Variant BOOL unit: Handles 1 bit as the Variant BOOL data.
The data buffer is a BOOL type where 1 bit is 1 Variant. It handles the specified number of data as a BOOL-type array.
Applicable API
When specifying 0x201 (EASY_AppKind_BOOL) for the data type in ReadDeviceVariant/WriteDeviceVariant()
When specifying the bit symbol and the group that includes any bit symbols in ReadSymbolVariant/WriteSymbolVarinat()
Bit offset symbols when accessing the device with a structure variable in the logic instruction
When you directly specify the bit offset symbol to access the device, the data buffer handles the data either in "16-bit unit" or "Variant BOOL unit" as described above.
Note that the group symbol itself has bit offset symbols and no data is secured for the bit offset symbols in the data buffer when accessing the device with the structure variable in the logic instruction.
The bit offset symbols never exist by themselves and always have parent word symbols. A data area is secured for the parent. Use part of the respective secured area for the bit offset symbols.