...
Expand | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||
The core of the driver is provided as a C++ class that implements the initialization and communications functions. A sample process is provided which calls the appropriate class members. The IP address, configuration information, and data areas to be read and written are passed as calling parameters to the class functions. The following is a list of the provided driver files. After review of the example driver, the user is required to modify the files as indicated:
|
TpriModPlc Class Descriptions
Expand |
---|
Expand | ||
---|---|---|
| ||
The following public member functions are provided as part of the tpriModPlc class:
Allocate a new tpriModPlc object
Destroy the tpriModPlc class object.
where: int TraceLevel = debug trace level for class operations default value = 30 valid values range between 0 and 100, inclusive lower values produce less debug information higher values produce more debug information debug information written using LogMsg function This function stores a new value for the TraceLevel parameter
unsigned char timeoutticks, unsigned char timeoutmultiplier, unsigned long otrpi, unsigned long torpi ); where: int sTimeOut = Send message timeout value in milliseconds Default value = 2000 int rTimeOut = receive message timeout value in milliseconds Default value = 2000 This function stores timeout parameter values for use by the member functions of the class
where: unsigned short vendorid = Destination ID default value = 1 This function stores new values for the Destination ID
where: int noBytes = the maximum number of data bytes that will be placed in a single PDU default value = 125 a PDU is a protocol Data Unit and is equivalent to a single Ethernet frame valid values range between 2 and 125, inclusive lower values may produce more frames to transfer the same user data higher values may produce fewer frames to transfer the same user data This function sets a new value for the maximum number of user data bytes to be included in a single Ethernet frame (PDU) that is transmitted to the PLC. A value too low will increase the number of Ethernet frames that will be required to send a given number of user data bytes and reduce throughput. A number too high will not be understood or acknowledged by the PLC.
where: char *hostname = host name, or IP addresses expressed as a character string short int port = TCP/IP port number This function establishes a connection between the computer system and the Modicon PLC
This function breaks a connection between the computer system and the Modicon PLC
where: int offset = PLC memory offset in 16 bit words from which to read data int noElements = number of 16 bit integer data elements to read void *buf = address of user supplied data buffer This function reads a single data block of 16 bit integers values from the PLC user register memory starting at ‘offset’ words from 40000 and stores the results in a user defined buffer
where: int offset = PLC memory offset in 16 bit words from which to write data int noElements = number of 16 bit integer data elements to write void *buf = address of user supplied data buffer This function writes a single block of user supplied 16 bit data words to the PLC user register memory starting at ‘offset’ words after 40000 |