Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

titlePage Overview

This manual describes the various I/O drivers available for the Tsentry system. Both W32 and RTSS versions of most of the drivers are available.

Supported drivers include the following:

  • Allen Bradley PLC 2, PLC 3, and PLC 5

  • Nattional Instruments Process I/O controllers

  • GE 9030 / 9070 PLC

  • TCP/IP Generic Driver

  • Lantronix Terminal Server

  • Generalized Remote Device Connection Driver

  • Allen-Bradley Control Logic PLC

...

Allen-Bradley Process I/O Server

...

Expand
titleSoftware Driver

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:

File Name

Description

Modifications

ABPlc.cpp

Driver mainline function

Modify configuration class calls for specific PLC configuration.  Modify locations to read and write data.  Modify input and output datagram structure definition

ABPlcIn.cpp

ABPlc driver initialization

Insert required global common areas. 

PlcUsr.cpp

Process received values from PLC datagram and place in user data variables.

Get application variables and store in datagra for transmission to PLC

Change as required

...

TpriABPlc Class Descriptions

Expand
titleOverview

The Tsentry tpriABPlc class encapsulates the functionality required to communicate with the Allen Bradley PLC 2, PLC3, and PLC5 PLCs over a TCP/IP network.

...

Expand
titleProcess Driver Mainline

Some comments on the driver program below:

  • This test program, on each expiration of the process timer, writes a single block of data to the PLC and then reads a single block of data.  This sequence, the number of reads and writes, their addresses, and the sizes of the blocks can be modified to fit the requirements of the application.

  • PlcUsr and the ‘datagram’ structures they reference should be modified as required to reference appropriate variables in application variables for transfer between the PLC and the control system.

  • A sample driver is provided in the examples subdirectories of the standard Tsentry distribution

National Instruments Process I/O Driver

Expand
titleCapabilities
  • Handles National Instruments E-Series Boards

  • Direct program control over all I/O

  • Process I/O includes

    • 12-bit A/I channels

    • 12-bit A/O channels

    • Digital Inputs

    • Digital Outputs

  • High Speed bus access

    • A/I at 300KHZ sample rate

  • Software implemented as a C++ Class

  • Capable of running 1ms Input and Output scan rep rates

...

Expand
titleSoftware Driver

The core of the driver is provided as a C++ class which implements the initialization and communications functions.  A sample process is provided which calls the appropriate class members. 

The IP address, configuration, 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:

File Name

Description

Modifications

GePlcDrv.cpp

Driver mainline function

Insert required global common areas.  Modify register files and values are required.  Modify inout and output datagram structure definition

PlcUsrInput.cpp

Process received values from PLC datagram and place in user data variables

Change as required

PlcUsrOutput.cpp

Get application variables and store in datagra for transmission to PLC

Change as required

GELPC Class Descriptions

Expand
Info

The Tsentry GePlc class encapsulates the functionality required to communicate with the GE PLC (9030 and 9070) over a TCP/IP network.

The following public member functions are provided as part of the tpriGePlc class:

  • tpriGePlc *pGePlc = new tpriGePlc;

    • Allocate a new tpriGePlc object

 

  • destroy (tpriGePlc *)pGePlc();

    • Destroy the tpriGePlc class object.

 

  • int Init (char *piffile, char *tplcIpAddr, unsigned short tPortNo,

                     long cTimeOut, long sTimeOut, long rTimeOut);

where:

char *piffile = initialization file name (currently not supported) = NULL

char *tplcIpAddr = IP address of the PLC in xxx.xxx.xxx.xxx format

unsigned short tPortNo = port (service) number of the TCP support in the GE PLC.  This value is normally fised at 18245 by GE.

            long cTimeOut = Connection timeout value in milliseconds

long sTimeOut = Send message timeout value in milliseconds

long rTimeOut = receive message timeout value in milliseconds

This function stores parameter values for use by the member functions of the class

  • int Connect ();

    • Connect (using TCP/IP) to the PLC and open an application connection

 

  • int Write (char *seg, int ref, int size, int bMode, unsigned char *buffer);

where

            char *seg = segment (plc memory area) type

                        “R”            = register variable

                        "L"            = Local Data Table (%L)

                        "P"            = Program Data Table (%P)

                        "R"            = Register Table (%R)

                        "AI"            = Analog Input Table (%AI)

                        "AQ"            = Analog Output Table (%AQ)

                        "I"               = Discrete Input Table, byte mode (%I)

                        "Q"            = Discrete Output Table, byte mode (%Q)

                        "T"            = Discrete Temporary Table, byte mode (%T)

                        "M"            = Discrete Internal Table, byte mode (%M)

                        "SA"            = Discrete System A Table, byte mode (%SA)

                        "SB"            = Discrete System B Table, byte mode (%SB)

                        "SC"            = Discrete System C Table, byte mode (%SC)

                        "S"            = Discrete System D Table, byte mode (%S)

                        "G"            = Genius Global Data Table, byte mode (%G)

                        "GA"            = Genius Global Data Table, byte mode (%GA)

            int ref = 1st variable within segment to transfer (beginning of table = 1)

int size = size of transfer in number of words, bytes or bits (see bmode)

int bmode = units size;

0 = words or bytes,

1 = bits

unsigned char *buffer = pointer to application program data buffer

This function writes an application buffer to the PLC

 

  • int Read (char *seg, int ref, int size, int bMode, unsigned char *buffer);

where

            char *seg = segment (plc memory area) type

                        See definitions in the Write function

            int ref = 1st variable within segment to transfer (beginning of table = 1)

int size = size of transfer in native units (words, bytes or bits) see bmode

int bmode = transfer unit size; 0 = words or bytes, 1 = bits

unsigned char *buffer = pointer to application program data buffer

This function reads an application buffer from the PLC

 

  • int getSrpErrorCode();

Return an integer equal to the last SRTP (GE PLC protocol) error code

 

  • int Is_Connect ();

Return an integer that indicates whether the application has an open connection with the GE PLC

...

Expand
titleClass Virtual Functions

The custom device driver class then overrides a set of virtual functions that will be called by the base classes at the appropriate times.  These virtual functions are:

 

  • Virtual int initDrv()
    The framework calls this function to process one-time initialization of internal parameters including device name, timeout values, max retry counts, etc.  Return zero to indicate success and nonzero to indicate that an error has occurred.

  •  Virtual int setupComm(int oper)
    The framework calls this function to connect (oper <> 0) or disconnect (oper = 0) from the remote device.  Return zero to indicate success and nonzero to indicate that an error has occurred.  This function does not need to be overridden under normal circumstances.

  •  Virtual int waitMsg()
    The framework calls this function to allow the derived class to decide when it is time to send a message to the remote device.  Return zero to indicate a message should now be sent and nonzero to continue waiting.

  •  Virtual int buildMsg()
    The framework calls this function to assemble the next outbound message immediately after the user has returned zero from a call to waitMsg().  The custom driver should copy the outbound message into the class data member txBuf[] character buffer and store the number of characters in the class data member txCnt.

  •  Virtual int xmitMsg()|
    The framework calls this function to transmit data to the remote device.  Return 0 to indicate success or nonzero indicate an error.  This function does not need to be overridden under normal circumstances.

  •  Virtual int waitRsp()
    The framework calls this function to read data from the remote device.  It must also call testRsp() to check if a full message has been received.  Return 0 to indicate reception of a complete message or timeout or -1 to continue reading data.  This function does not need to be overridden under normal circumstances.

  •  Virtual int testRsp()
    The framework calls this function to decide whether or not a response has been received from the remote device.  Upon entry into this function all data received from the remote device since transmission of the most recent message is stored in the class data member rxBuf[] character buffer and the number of received bytes stored in rxCnt.  Any bytes at the beginning of the rxBuf[] buffer that are not part of a valid response may be removed using the class member function tossRsp(int nToss).  If a valid message is found, copy it from the beginning of the rxBuf[] buffer to the response buffer using the class member function ripRsp(nRsp).  Return zero to indicate that the response is complete, less than zero to indicate that the response is incomplete, and greater than zero to indicate that an error has occurred.

  •  Virtual int procRsp()
    The framework calls this function to process a complete response from the remote device.  Return zero to reset and wait until the next message should be sent, and nonzero to reset the connection.

...

Allen Bradley Control Logix PLC Driver

Expand
titleCapabilities

This driver:

  • Communicates with A-B Control Logix 5500 and 5555 PLC systems

  • Uses TCP/IP Communications over:

    • Standard Ethernet network connection

    • High Speed dedicated process I/O network with deterministic network performance

  • Software implemented as a C++ Class

  • Multiple PLC support

  • Supports:

    • Read Variables

    • Write variables

Capable of running 500ms Input and Output scan rep rates, depending on data buffer size.

Expand
titleA-B Configuration

The Allen Bradley PLC must be set up with the proper IP address.  This configuration is completed with the A-B software.  The IP must be chosen such that it lies within the subnet selected for the specific Ethernet controller used for communications.

If the Ethernet controller is one that is controlled by the Windows 2000 system, the subnet is specified in the network setup utility of the control panel.

If the Ethernet controller is one that is controlled by the RTX Real-Time TCP/IP controller, the IP address is specified in the file d:\LocNtRt\sys\pif\RtxTcp.ini. 

Expand
titleSoftware Driver

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:

File Name

Description

Modifications

ClPlc.cpp

Driver mainline function

Modify configuration class calls for specific PLC configuration.  Modify locations to read and write data.  Modify input and output datagram structure definition

ClIn.cpp

ClPlc driver initialization

Insert required global common areas. 

PlcUsr.cpp

Process received values from PLC datagram and place in user data variables.

Get application variables and store in datagra for transmission to PLC

Change as required

Expand
titleCLeip Class Description

The Tsentry CLeip class encapsulates the functionality required to communicate with the Allen Bradley 5500 and 5555 PLCs over a TCP/IP network.

The following public member functions are provided as part of the tpriCLeip class:

  •  tpriCLeip *pCLeip = new tpriCLeip;

    • Allocate a new tpriCLeip object

  • destroy (tpriCLeip *)pCLeip();

    • Destroy the tpriCLeip class object.

  •  int SetTraceLevel (int TraceLevel);

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

 

  • int SetEnetPort (int port);

where:

int port = Ethernet Port number

            Default value = 1

This function stores a new value for the Ethernet Port parameter.  This communications parameter defines the port number for the Ethernet controller in the PLC chassis

 

  • int SetLogixSlot (int slot);

where:

int slot = Control Logix process slot number

            Default value = 0

This function stores a new value for the Ethernet Port parameter.  This communications parameter defines the slot in which the Control Logix processor resides.

 

  • int SetTimeOut (int sTimeOut, int rTimeOut, unsigned char ticktime,

                              unsigned char timeoutticks, unsigned char timeoutmultiplier,

                              unsigned long otrpi, unsigned long torpi );

where:

int sTimeOut = TCP Send message timeout value in milliseconds

                                    Default value = 2000

int rTimeOut = TCP Receive message timeout value in milliseconds

                                    Default value = 2000

unsigned char ticktime = (optional) Protocol Tick time (see below)

                              Default value = 10
                              Minimum value = 0
                              Maximum value = 15

unsigned char timeoutticks = (optional) TickTimes multiplier (see below)

Default value = 14

Minimum value = 1

Maximum value = 255

unsigned char timeoutmultiplier = (optional) Inactivity timeout (see below)

Default value = 1

Minimum value = 1

Maximum value = 255

unsigned long otrpi = (optional) Originator->Term Reqested packet interval (u-sec)

Default value = 2064960

unsigned long torpi = (optional) Terminator->Orig Reqested packet interval (u-sec)

                                     Default value = 2064960

 

This function stores timeout parameter values for use by the member functions of the class.

The values sTimeOut and rTimeOut are used to determine the maximum time that will elapse for a single user level call (read or write, respectively) to transfer data to or from the PLC.  If this timeout is exceeded, the I/O request will return to the caller indicating a timeout has occurred.

The remaining values are used to define the PLC’s connection session timeout information.  The values ticktime and timeoutticks are used to calculate the maximum time allowed for a connection request to be serviced by the PLC.  If the PLC cannot establish a connection session within this amount of time, the Connect method will return to the caller an error indicating that a timeout has occurred.  This timeout value is calculated by the following formula:

Connection_Timeout (ms) = 2^(ticktime) * timeoutticks

 

The values timeoutmultiplier otrpi (which stands for Originator->Terminator Requested Packet Interval) and torpi (Terminator->Originator Requested Packet Interval) determine the inactivity timeout of the PLC session.  If this timeout is exceeded BETWEEN calls to the driver (more precisely, between protocol messages sent between the control system and the PLC), the PLC connection session will time out, and the connections to the PLC must be rebuilt.  Subsequent user calls to the driver to transfer data between the control system and the PLC will find the connection destroyed and will return an error.  This timeout value is calculated by the following formula:

Inactivity_Timeout (u-sec) = 4 * 2^(timeoutmultiplier) * min (otrpi, torpi)

Using the default values, the connection timeout and inactivity timeout are:

Connection_Timeout (ms) = 2^(ticktime) * timeoutticks

= 2^10 * 14

= 1024 * 14

= 14336

Connection_Timeout (seconds) = 14.336

Inactivity_Timeout (u-sec) = 4 * 2^(timeoutmultiplier) * min (otrpi, torpi)

= 4 * 2^1 * min (2064960, 2064960)

= 4 * 2 * 2064960

= 16519680

Inactivity_Timeout (seconds) = 16.51968

 

  • int SetConnectionID (unsigned int connid);

where:

unsigned int connid = Logical Connection ID

                       Default value = 0x0b000100

This function stores a new value for the Logical Connection ID parameter

 

  • int SetConnectionSN (unsigned short connsn);

where:

unsigned short connsn = Logical Connection Serial Number

 

This function stores a new value for the Logical Connection Serial Number

 

  • int SetOriginatorInfo(unsigned short vendorid,  unsigned int sn);

where:

unsigned short vendorid = Originator (local system) vendor ID

default value = 1

unsigned int sn = Originator Sequence Number

default value = 0xBC1C0042

This function stores new values for the Originator (local system) information

 

  • int Connect (char *hostname, short int port);

where:

char *hostname = host name, or

IP addresses expressed as a character string

short int port = TCP/IP port number name, or

 

This function establishes a connection between the computer system and the Allen-Bradley Control Logix PLC. Note that if a connection has already been established with a given connection serial number, no other connection may be made to that PLC with the same connection serial number until that connection is either gracefully disconnected or has timed out due to inactivity.

 

  • int Disconnect ();

This function breaks a connection between the computer system and the Allen-Bradley Control Logix PLC

 

  • int readClPccc (int adrType, void *FileName, int offset, int noElements,

                                 int dataType, void *buf);

where:

int adrType = address type

void *FileName = file name within PLC from which to read data

int offset = offset (in data variables) from which to start data read

int noElements = number of data elements to read

int dataType = type of data to be read

void *buf = address of user supplied data buffer

This function reads a single data block from the PLC and stores the results in a user defined buffer.

Offsets may work in one of two ways.  If the PLC contains a variable array called by a file name of “PLCVars”, function calls to retrieve data starting at the 61st element of this array could contain 2nd and 3rd arguments of:

“PLCVars”, 60

or,

“PLCVars[60]”, 0

Legal values for the dataType argument are:

CL_SINT – 1-byte integers

CL_INT – 2-byte integers

CL_DINT – 4-byte integers

CL_REAL – IEEE 4-byte floating point numbers

 

  • int writClPccc (int adrType, void *FileName, int offset, int noElements,

                                 int dataType, void *buf);

where:

int adrType = address type

void *FileName = file name within PLC to write user data

int offset = offset (in data variables) from which to start data write

int noElements = number of data elements to write

int dataType = type of data to be written

void *buf = address of user supplied data buffer containing write data

This function writes a single data block to the PLC from the user defined buffer. Offsets may work in one of two ways. If the PLC contains a variable array called by a file name of “PLCVars”, function calls to write data starting at the 61st element of this array could contain 2nd and 3rd arguments of:

“PLCVars”, 60

or,

“PLCVars[60]”, 0

Legal values for the dataType argument are:

CL_SINT – 1-byte integers

CL_INT – 2-byte integers

CL_DINT – 4-byte integers

CL_REAL – IEEE 4-byte floating point numbers

 

  • int readClCip (void *FileName, int offset, int noElements, int *dataType, void *buf);

where:

void *FileName = file name within PLC from which to read data

int offset = offset (in data variables) from which to start data read

int noElements = number of data elements to read

int *dataType = pointer to an integer variable where the type of the data read shall be returned

void *buf = address of user supplied data buffer

This function reads a single data block from the PLC and stores the results in a user defined buffer.

Legal values returned in the dataType variable are:

CL_SINT – 1-byte integers

CL_INT – 2-byte integers

CL_DINT – 4-byte integers

CL_REAL – IEEE 4-byte floating point numbers

 

  •  int writClCip (void *FileName, int offset, int noElements, int dataType, void *buf);

where:

void *FileName = file name within PLC to write user data

int offset = offset (in data variables) from which to start data write

int noElements = number of data elements to write

int dataType = type of data to be written

void *buf = address of user supplied data buffer containing write data

This function writes a single data block to the PLC from the user defined buffer.

Legal values for the dataType argument are:

CL_SINT – 1-byte integers

CL_INT – 2-byte integers

CL_DINT – 4-byte integers

CL_REAL – IEEE 4-byte floating point numbers

Expand
titleProcess Driver Mainline

Some comments on the driver program are below:

This test program, on each expiration of the process timer, writes a single block of data to the PLC and then reads a single block of data.  This sequence, the number of reads and writes, their addresses, and the sizes of the blocks can be modified to fit the requirements of the application.

PlcUsr and the ‘datagram’ structures they reference should be modified as required to reference appropriate variables in application variables for transfer between the PLC and the control system.

 A sample driver is provided in the examples subdirectories of the standard Tsentry distribution

Modicon PLC Driver

Expand
titleCapabilities

This driver:

  • Communicates with Modicon (Schneider Automation) TSX Quantum PLC systems

  • Uses TCP/IP Communications over:

    • Standard Ethernet network connection

    • High Speed dedicated process I/O network with deterministic network performance

  • Software implemented as a C++ Class

  • Multiple PLC support

  • Supports:

    • Read Variables

    • Write variables

Capable of running 500ms Input and Output scan rep rates, depending on data buffer size.

Expand
titleModicon PLC Configuration

The Modicon PLC must be set up with the proper IP address.  This configuration is completed with the Schneider Automation software.  The IP must be chosen such that it lies within the subnet selected for the specific Ethernet controller used for communications.

If the Ethernet controller is one that is controlled by the Windows 2000 system, the subnet is specified in the network setup utility of the control panel.

If the Ethernet controller is one that is controlled by the RTX Real-Time TCP/IP controller, the IP address is specified in the file d:\LocNtRt\sys\pif\RtxTcp.ini. 

Enough memory must be installed in the PLC to support the data buffer size that will be requested by the software reads and writes.

Expand
titleSoftware Driver

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:

File Name

Description

Modification

ModPlc.cpp

Driver mainline function

Modify configuration class calls for specific PLC configuration.  Modify locations to read and write data.  Modify input and output datagram structure definition

ModPlcIn.cpp

ModPlc driver initialization

Insert required global common areas. 

PlcUsr.cpp

Process received values from PLC datagram and place in user data variables.

Get application variables and store in datagra for transmission to PLC

Change as required

TpriModPlc Class Descriptions

Expand
titleOverview

The Tsentry tpriModPlc class encapsulates the functionality required to communicate with the Modicon Quantum PLCs over a TCP/IP network.

Expand
titleClass Inferface

The following public member functions are provided as part of the tpriModPlc class:

  • tpriModPlc *pModPlc = new tpriModPlc;

Allocate a new tpriModPlc object

 

  • destroy (tpriModPlc *)pModPlc();

Destroy the tpriModPlc class object.

 

 

  • int SetTraceLevel (int TraceLevel);

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

 

  • int SetTimeOut (int sTimeOut, int rTimeOut, unsigned char ticktime,

                              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

 

  • int int SetDestinationInfo(unsigned char destID);

where:

unsigned short vendorid = Destination ID

default value = 1

This function stores new values for the Destination ID

 

  • int SetPduMaxIoDataBytes (int noBytes);

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.  

 

  • int Connect (char *hostname, short int port);

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

 

  • int Disconnect ();

This function breaks a connection between the computer system and the Modicon PLC

 

  • int read4x (int offset, int noElements, void *buf);

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

 

  • int writ4x (int offset, int noElements, void *buf);

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

Expand
titleProcess Driver Mainline

Some comments on the driver program follow:

This test program, on each expiration of the process timer, writes a single block of data to the PLC and then reads a single block of data.  This sequence, the number of reads and writes, their addresses, and the sizes of the blocks can be modified to fit the requirements of the application.

PlcUsr and the ‘datagram’ structures they reference should be modified as required to reference appropriate variables in application variables for transfer between the PLC and the control system.

 A sample driver is provided in the examples subdirectories of the standard Tsentry distribution.

VMIC Reflective Memory Driver

Expand
titleCapabilities

This driver provides an interface to an internal VMIC reflective memory card. It manages both reading and writing variables to the card’s onboard memory, which the card automatically synchronizes with all other cards on the optical network. The driver supports the following:

  • Operation in both Win32 and RTSS environment

  • Support for both VMICPCI-5576 and VMICPCI-5579 cards

  • Ini file configuration of read and write variable transfers

Expand
titleVMIC Card Configuration

There is no specific card configuration required for the VMIC reflective memory driver. Simply put the card into an empty full-length PCI slot, and the software driver manages the rest.

Expand
titleConfiguration File

The VMIC driver is configured by a flat ASCII file divided into [Sections].  The following sections are required in this file:

[General]

This section defines general parameters for the VMIC device.  The parameters are specified in the standard Key=Value pair format.

  • DeviceIdx=1

Defines the device index of the card you wish to use. By default this value is 1, and unless you have more than one VMIC card, this parameter is not needed.

  • DeviceType=PCI-5576

Defines the card type that you wish to use. Supported values are ‘PCI-5576’ and ‘PCI-5579’ (no quotes).  If this parameter is not specified, the driver will search for the first supported device that it can find.

  • ChkOverlap=0

This optional flag sets whether or not the driver will check your variable list to make sure that no two variables overlap one another in the VMIC memory buffer. For instance, two variables may mistakenly both be configured to write to the same bytes on the card. If this flag is set the driver will detect this overlap and fail to initialize. A message will be logged to the console to indicate the offending variables, and the ini file will need to be corrected before the driver will work.  By default this option is enabled; set the flag to 0 to turn it off. 

  • IODescFile=d:\MyIODesc.txt

This optional parameter specifies an output text file to which the VMIC driver will write a complete description of all variables and their associated offsets into the VMIC reflective memory buffer.  This is particularly useful when transferring entire structures and you want to know the offsets for each of the constituent variables contained in those structures.

 [VarDef]

This section defines all variables that are to be read from or written to the reflective memory segment. Each line in this section defines a single variable in a set of whitespace-delimited fields:

#Variable Name

#Read/Write

#Offset

#RemoteType

MyWriteStruct.MyWriteVar  

W

0x1000

MyReadStruct.MyReadVar       

R

0x2000

VT_I2

Empty lines or lines beginning with the ‘#’ symbol are ignored.

 

The fields for each variable are:

  • #VariableName

The variable name within the TSENTRY data dictionary (identical to that used by Probe, etc.).  Besides individual variables, entire arrays or structures may also be specified.

  • #Read/Write

Flag specifying whether the variable is to be read from the card (R) or written to the card (W).

  • #Offset

Offset into the VMIC onboard memory where this variable is to be read from or written to. This value can be specified in hex with the ‘0x’ prefix or in decimal.  The data will be reflected in the memory of all other VMIC cards in the ring at this same offset. Note that offsets 0x00-0x3F are reserved for use by the VMIC card and cannot be used for reflected data.

  • #RemoteType

Optional parameter used if the data on the card should be interpreted in a format different from that inside the PC’s internal memory. Typically this is used if the internal variable is a 4-byte integer but should be read/written as a 2-byte integer. This parameter applies only if an individual variable is specified; it will not automatically convert arrays or elements inside of structures.  The following remote types are supported:

VT_I1        1-byte integer (C/C++ character)

VT_I2        2-byte integer (C/C++ short)

VT_I4        4-byte integer (C/C++ long)

VT_I8        8-byte integer (C/C++ __int64)

VT_R4        1-byte integer (C/C++ float)

VT_R8        1-byte integer (C/C++ double)

Expand
titleClass Interface

The following public member functions are provided as part of the tpriVmic class:

  •  tpriVmic::tpriVmic()

    • Constructor for the VMIC driver object.

  •  tpriVmic::~tpriVmic()

    • Destructor for the VMIC driver object.

  • int tpriVmic:: initDrv(char *fileName)
    Initialize the VMIC driver with the specified ini file.

    • Inputs:
      char * fileName                        Configuration file name.

    • Return value:
      Zero indicates success, non-zero indicates failure.

  • int tpriVmic::writeIODesc()
    Write the I/O decription table to the specified file on disk.

    • Inputs:
      char * fileName                        Output file name.

    • Return value:
      Zero indicates success, non-zero indicates failure.

  •  int tpriVmic::runDrv()
    Run the VMIC driver state machine.  This function should be called iteratively in the main loop of the driver process.

    • Return value:
      Zero indicates success, non-zero indicates failure.

Expand
titleProcess Driver Mainline

A sample driver is provided in the examples subdirectories of the standard TSENTRY distribution.