Direct read API of single handle system
Bit Data
INT WINAPI ReadDeviceBit(LPCSTR sNodeName,LPCSTR sDeviceName,WORD* owData,WORD wCount);
16 bit data
INT WINAPI ReadDevice16(LPCSTR sNodeName,LPCSTR sDeviceName,WORD* owData,WORD wCount);
32 bit data
INT WINAPI ReadDevice32(LPCSTR sNodeName,LPCSTR sDeviceName,DWORD* odwData,WORD wCount);
16-bit BCD data
INT WINAPI ReadDeviceBCD16(LPCSTR sNodeName,LPCSTR sDeviceName,WORD* owData,WORD wCount);
32-bit BCD data
INT WINAPI ReadDeviceBCD32(LPCSTR sNodeName,LPCSTR sDeviceName,DWORD* odwData,WORD wCount);
Single float number data
INT WINAPI ReadDeviceFloat(LPCSTR sNodeName,LPCSTR sDeviceName,FLOAT* oflData,WORD wCount);
Double float number data
INT WINAPI ReadDeviceDouble(LPCSTR sNodeName,LPCSTR sDeviceName,DOUBLE* odbData,WORD wCount);
Text data
INT WINAPI ReadDeviceStr(LPCSTR sNodeName,LPCSTR sDeviceName,LPSTR psData,WORD wCount);
General data
INT WINAPI ReadDevice(LPCSTR sNodeName,LPCSTR sDeviceName,LPVOID pData,WORD wCount,WORD wAppKind);
General data (Variant Type)
INT WINAPI ReadDeviceVariant(LPCSTR sNodeName,LPCSTR sDeviceName,LPVARIANT pData,WORD wCount,WORD wAppKind);
Single handle system API
Bit Data
INT WINAPI WriteDeviceBit(LPCSTR sNodeName,LPCSTR sDeviceName,WORD* pwData,WORD wCount);
16 bit data
INT WINAPI WriteDevice16(LPCSTR sNodeName,LPCSTR sDeviceName,WORD* pwData,WORD wCount);
32 bit data
INT WINAPI WriteDevice32(LPCSTR sNodeName,LPCSTR sDeviceName,DWORD* pdwData,WORD wCount);
16-bit BCD data
INT WINAPI WriteDeviceBCD16(LPCSTR sNodeName,LPCSTR sDeviceName,WORD* pwData,WORD wCount);
32-bit BCD data
INT WINAPI WriteDeviceBCD32(LPCSTR sNodeName,LPCSTR sDeviceName,DWORD* pdwData,WORD wCount);
Single float number data
INT WINAPI WriteDeviceFloat(LPCSTR sNodeName,LPCSTR sDeviceName,FLOAT* pflData,WORD wCount);
Double float number data
INT WINAPI WriteDeviceDouble(LPCSTR sNodeName,LPCSTR sDeviceName,DOUBLE* pdbData,WORD wCount);
Text data
INT WINAPI WriteDeviceStr(LPCSTR sNodeName,LPCSTR sDeviceName,LPCSTR psData,WORD wCount);
General data
INT WINAPI WriteDevice(LPCSTR sNodeName,LPCSTR sDeviceName,LPVOID pData,WORD wCount,WORD wAppKind);
General data (Variant Type)
INT WINAPI WriteDeviceVariant(LPCSTR sNodeName,LPCSTR sDeviceName,LPVARIANT pData,WORD wCount,WORD wAppKind);
Group Symbol Read API for Single Handle
Group Symbol
INT WINAPI ReadSymbol(LPCSTR sNodeName,LPCSTR sSymbolName,LPVOID oReadBufferData);
Group Symbol (Variant Type)
INT WINAPI ReadSymbolVariant(LPCSTR sNodeName,LPCSTR sSymbolName,LPVARIANT pData);
Group Symbol Write API for Single Handle
Group Symbol
INT WINAPI WriteSymbol(LPCSTR sNodeName,LPCSTR sSymbolName,LPVOID pWriteBufferData);
Group Symbol (Variant Type)
INT WINAPI WriteSymbolVariant(LPCSTR sNodeName,LPCSTR sSymbolName,LPVARIANT pData);
sNodeName: The station name is fixed as "WinGP".
sDeviceName: Directly describes the symbol names and device addresses registered in GP-Pro EX.
Example 1) Use a symbol
 "SWITCH1"
Example 2) Directly specify the device address
 "M100"
The following table shows the data types that you can specify when using symbols in each function.
| Function | Symbol data type | |||||||
|---|---|---|---|---|---|---|---|---|
| Bit | 16 Bit | 32 Bit | Float | Double | String | |||
| Signed/ Unsigned/ Hexadecimal | BCD | Signed/ Unsigned/ Hexadecimal | BCD | |||||
| XXXDeviceBit | O | - | - | - | - | - | - | - | 
| XXXDevice16 | - | O | - | - | - | - | - | - | 
| XXXDevice32 | - | - | - | O | - | - | - | - | 
| XXXDeviceBCD16 | - | - | O | - | - | - | - | - | 
| XXXDeviceBCD32 | - | - | - | - | O | - | - | - | 
| XXXDeviceFloat | - | - | - | - | - | O | - | - | 
| XXXDeviceDouble | - | - | - | - | - | - | O | - | 
| XXXDeviceStr | - | - | - | - | - | - | - | O | 
| XXXDevice | O | O | O | O | O | O | O | O | 
pxxData: Pointer for read/write data
Defines the destination pointer for values that are read or values that are written. For each function, please define the corresponding data format pointer.
| Data types for access | Argument type | 
|---|---|
| Bit Data | WORD * pwData | 
| 16 bit data | WORD * pwData | 
| 32 bit data | DWORD * pdwData | 
| 16-bit BCD data | WORD * pwData | 
| 32-bit BCD data | DWORD * pdwData | 
| Single float number data | FLOAT * pflData | 
| Double float number data | DOUBLE * pdbData | 
| Text data | LPTSTR psData | 
| General data | LPVOID pData | 
| General data (for VB) | LPVARIANT pData | 
wCount: Number of read/write data
For the Read/WriteDeviceStr function, the amount of text data is expressed in single-byte units. If the symbol refers to a 16-bit device, use two characters to specify the number. If it refers to a 32-bit device, use four characters.
The following table shows the maximum amount of read/write data.
| Data types for access | Read/Write | 
|---|---|
| Bit Data | 255 | 
| 16 bit data | 1020 | 
| 32 bit data | 510 | 
| 16-bit BCD data | 1020 | 
| 32-bit BCD data | 510 | 
| Single float number data | 510 | 
| Double float number data | 255 | 
| Text data | 1020 single-byte characters | 
wAppKind: Data Type Value
To specify the Data Type Value, you can either directly specify the value or specify using a constant name. For more details, please refer to the following.
 38.9.5.1 Data Type
38.9.5.1 Data Type

The Read/WriteDevice function specifies the data type with parameters. It allows you to change the data type dynamically.
Return value (NULL)
Normal end: 0
Problem: Error code
Supplementary
When using Read/WriteDeviceBit function
pwData stores the same amount of data as in wCount starting from D0 bit.
For example, when wCount = 20
| 
 | F | E | D | C | B | A | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | 
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| PwData | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 
| PwData+1 | * | * | * | * | * | * | * | * | * | * | * | * | 20 | 19 | 18 | 17 | 
Handling sequential multiple bit data
it is more efficient to read/write in 16/32 bits using Read/WriteDevice16 and Read/WriteDevice32 than using Read/WriteDeviceBit.
"*" contains undefined values Mask the value using an application program.
When using Read/WriteDeviceBCD16/32 functions
Use these functions for handling data as BCD internally in the device/PLC. Note that data (pxxData content) sent to or received from the function is binary data, not BCD.
BCD conversion is run internally in the WinGP SDK. Cannot handle negative numbers.
| Function Name | Decimal notation | Hexadecimal notation | 
|---|---|---|
| Read/WriteDeviceBCD16 | 0...9999 | 0000 to 270F | 
| Read/WriteDeviceBCD32 | 0...99999999 | 00000000 to 05F5E0FF | 
When using the text data function
For variables to receive text data, secure sufficient data space to receive the data.