Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Expand
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

...

tpriABPlc Class Descriptions

Summary -
Expand
titleClass Inferface
Info
Overview

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
titleClass Inferface

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

  • tpriABPlc *pABPlc = new tpriABPlc;

    • Allocate a new tpriABplc object

  • destroy (tpriABPlcPlc *)pABPlc();

    • Destroy the tpriABPlc class object.

  • int Config (char *pHostName, int timeout);

where:

char *pHostName= host name or IP address

int timeout = time value for read and write operation in milliseconds

This function stores new configuration information for use by class functions

  •  int GetConnStatus (void);

where:

return status = connection status

                        0 = unconnected

1 = connected

This function returns the status of the connection between the Compute system and the PLC

  • int SetReadFile(char *file, int offset, int num);
    where:
    char *file = PLC file name from which to read data
    int offset  = byte offset from start of ‘filename’ from which to read data
    int num = number of data items to read

This function stores the PLC read control information for use by the ScanIO class member

  • int SetWriteFile(char *file, int offset, int num);
    where:
    char *file = PLC file name where to write data
    int offset  = byte offset from start of ‘filename’ to write data
    int num = number of data items to write

This function stores the PLC read control information for use by the ScanIO class member

  •  int Connect (void);

This function establishes a connection between the computer system and the PLC

  •  int Disconnect (void);

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

  •  int ScanIO (int *igram, int *ogram, int *ipsta);

where:
int *igram = user memory address where PLC read data will be returned

int *ogram = user memory address where PLC write will be obtained

int *ipsta = addr of an integer variable where I/O status will be returned

This function first reads a single data block of 16 bit integers values from the PLC user register memory and then writes a block of 16 bit integers to the PLC memory.  The plc locations for the read and write are obtained from prior calls to the SetReadFile90 and SetWriteFile() functions.

...

Expand
titleRTP Initialization file

The following is an example of a operational RTP initialization file.  It describes a system with 16 Analog inputs input (1 A/D card and 2 mux cards), 4 Digital input cards (64 bits), 32 Analog output channels (8 cards),and 4 digital dgital output cards (64 bits) in two (2) RTP chassises.  The RTP 6700 is set up for IP address 10.0.10.11

Code Block
# ---------------------------------------------------------------------------

#   Cold Mill RTP Control Table

#

#   This table defines the configuration information for the

#      RTP (Real Time Products) Process I/O system

#   It assumes connection via an Ethernet network and a RTP 6700 interface

#

#   Section [SYSTEM] defines system wide parameters

#   Section [AI] defines Analog Inputs

#   Section [AO] defines Analog Outputs

#   Section [DI] defines Digital Inputs

#   Section [DO] defines Digital Outputs

#

# --------------------------------------------------------------------------------------

#

[SYSTEM]

#   IPAddr:  IP address of 6700 controller

#   #AI:     Number of AI channels

#   #AO:     Number of AO channels

#   #DI:     Number of DI cards

#   #DO:     Number of DO cards

#

#IPAddr      #AI #DI #AO #DO

10.0.10.11   16   4   8   4    

#

[AI]

#

# Define analog input scan list

    16

#

# Field Definitions

#

#   CORR_ID:     Correlation ID.  A 32 bit number that is transmitted to the

#                eiobc and returned from the eiobc for each I/O point.
#      #                         Usually numbered sequentially.

#

#   TYPE:        An 8 bit number that defines the type of I/O to be performed.

#                There are currently four (4) types of I/O that can be

#                performed with the eiobc:

#

#                     TYPE            DEFINITION

#                     ----         -------------------

#                      1           OUTPUT_BASIC

#                      2           OUTPUT_WITH_BIT_OPS

#                      3           INPUT_BASIC

#                      4           INPUT_WITH_BIT_OPS

#

#                The TYPE used for analog inputs is 3, INPUT_BASIC.

#

#   DEV_ADDRESS: Device address.  An 8 bit number that defines the RTP

#                device address (chassis address).  If the chassis address is

#                set to 0x31, the address used for this field should be 0x01.

#

#   OPTION:      A bit mask of options.  A 16 bit value that is used as a mask

#                to control I/O options.  For type 3 (INPUT_BASIC) I/O, the

#                options are defined as follows:

#
#                #                Bitit 15: Output command word contained in COMMAND

#                Bit 14: Check Test Return before writing output data

#                Bit 13: Wait DELAY number of microseconds for Test Return

#                        before output.  Only valid when Bit 14 is set.

#                Bit 12: Output data word contained in Output Data (OUT_DATA).

#

#                Bit 11: Check Test Return before reading input data.

#                Bit 10: Wait Delay number of microseconds for Test Return

#                        Only valid when Bit 11 set.

#                Bit 09: Perform an input operation and return data in

#                        response.  If this bit is not set, input is not

#                        performed and only POINT_STATUS is returned

#                        in response.

#                Bit 08: Perform a second input operation and return additional

#                        data in response.  Only valid if bit 09 is set.
#          #                                     If this bit is set and POINT_EXTENDED_INPUT return

#                        is used.

#                Bit 07: Replace the Output Data (OUT_DATA) with the value

#                        obtained from the second input operation for auto-

#                        ranging purposes.  Only valid if bit 08 is used.

#

#                The OPTION value for analog inputs is 0x9E00.

#

#   COMMAND:     Command to the iobc.  A 16 bit value that defines which

#                card in the chassis rack will be doing the analog

#                inputs.  A value of 0x0500 in COMMAND indicates that

#                there is a analog input card in logical slot 0

#                (physical slot 5) of the chassis.

#

#   OUT_DATA:    Output Data.  A 16 bit value that is used to tell the

#                analog input card which input channel to read.  Due

#                to the delay in reading sequential channels on the

#                same analog input card, it may be desirable to sequence

#                through all the analog input cards, reading all the

#                channel 0's, then all the channel 1's, etc.

#

#                The card number and channel are defined as follows:

#

#                  bits  0 1 2 3   4 5 6 7  8 9 10 11  12 13 14 15

#                                    x x x  x y  y  y   z  z  z  z

#

#                    where   xxxx defines the card number.

#                             yyy defines the channel number.

#                            zzzz defines the gain (0= +-10volts)

#

#                These values go in the OUT_DATA field below

#

#   DELAY:       Delay value.  A 16 bit value indicating the amount of

#                time after which, if the card is not ready, an error is

#                returned.  Multiply us by 1.19 to get the proper delay.

#                A delay of 100 us == 100 * 1.19 = 119 (base 10) or

#                77 (base 16).

#

#                The DELAY value for analog inputs is typically 0x00FF.

#

#   AND_VAL:     A 16 bit value to logically AND with the output data

#                value (OUT_DATA).  This value is not used for analog

#                inputs but must be present.

#

#                The AND_VALUE value for analog inputs is 0x0000.

#

#   OR_VAL:      A 16 bit value to logically OR with the output data

#                value (OUT_DATA).  This value is not used for analog

#                inputs but must be present.

#

#                The OR_VALUE value for analog inputs is 0x0000.

#

#

#      DELAY is a HEX value indicating the number of microseconds to wait before

#     returning an error.  Multiply us by 1.19 to get the proper delay.  A delay

#     of 100 us == 100 * 1.19 = 119 (base 10) or 77 (base 16).

#

#

#     SC

#     LH

#     OA

#     TN

#

#CORR_ID   TYPE  DEV_ADDRESS  OPTION   COMMAND  OUT_DATA  DELAY(uS)   AND_VAL   XOR_VAL

#

 0000010      3    0x00       0x9E00    0x0500    0x0080    0x0077      0x0000   0x0000

 0000011      3    0x00       0x9E00    0x0500    0x0090    0x0077      0x0000   0x0000

 0000012      3    0x00       0x9E00    0x0500    0x00A0    0x0077      0x0000   0x0000

 0000013      3    0x00       0x9E00    0x0500    0x00B0    0x0077      0x0000   0x0000

 0000014      3    0x00       0x9E00    0x0500    0x00C0    0x0077      0x0000   0x0000

 0000015      3    0x00       0x9E00    0x0500    0x00D0    0x0077      0x0000   0x0000

 0000016      3    0x00       0x9E00    0x0500    0x00E0    0x0077      0x0000   0x0000

 0000017      3    0x00       0x9E00    0x0500    0x00F0    0x0077      0x0000   0x0000

#

 0000020      3    0x00       0x9E00    0x0500    0x0100    0x0077      0x0000   0x0000

 0000021      3    0x00       0x9E00    0x0500    0x0110    0x0077      0x0000   0x0000

 0000022      3    0x00       0x9E00    0x0500    0x0120    0x0077      0x0000   0x0000

 0000023      3    0x00       0x9E00    0x0500    0x0130    0x0077     0x0077      0x0000   0x0000

 0000024      3    0x00       0x9E00    0x0500    0x0140    0x0077      0x0000   0x0000

 0000025      3    0x00       0x9E00    0x0500    0x0150    0x0077      0x0000   0x0000

 0000026      3    0x00       0x9E00    0x0500    0x0160    0x0077      0x0000   0x0000

 0000027      3    0x00       0x9E00    0x0500    0x0170    0x0077      0x0000   0x0000

#

[AO]

# Define analog output scan list

      8

#

# Field Definitions

#

#   CORR_ID:     Correlation ID.  A 32 bit number that is transmitted to the

#                eiobc and returned from the eiobc for each I/O point.

#                Usually numbered sequentially.

#

#   TYPE:        An 8 bit number that defines the type of I/O to be performed.

#                There are currently four (4) types of I/O that can be

#                performed with the eiobc:

#

#                     TYPE            DEFINITION

#                     ----         -------------------

#                      1           OUTPUT_BASIC

#                      2           OUTPUT_WITH_BIT_OPS

#                      3           INPUT_BASIC

#                      4           INPUT_WITH_BIT_OPS

#

#                The TYPE used for analog outputs is 2, OUTPUT_WITH_BIT_OPS.

#

#   DEV_ADDRESS: Device address.  An 8 bit number that defines the RTP

#                device address (chassis address).  If the chassis address is

#                set to 0x31, the address used for this field should be 0x01.

#

#   OPTION:      A bit mask of options.  A 16 bit value that is used as a mask

#                to control I/O options.  For type 2 (OUTPUT_WITH_BIT_OPS) I/O,

#                the options are defined as follows:

#

#                Bit 15: Output command word contained in COMMAND

#                Bit 14: Check Test Return before writing output data

#                Bit 13: Wait DELAY number of microseconds for Test Return

#                        before output.  Only valid when Bit 14 is set.

#                Bit 12: Output data word contained in Process Scan List

#                        message.  If this bit is not set then no output

#                        word should be included in the Process

#                        Scan List.

#

#                The OPTION value for analog outputs is 0x9000.

#

#   COMMAND:     Command to the iobc.  A 16 bit value that defines which

#                card in the chassis rack will be doing the analog

#                outputs.  A value of 0x0505 in COMMAND indicates that

#                there is a analog output card in logical slot 5

#                (physical slot 10) of the chassis.

#                (Note: logical slot = physical slot - 5.)

#

#   OUT_DATA:    Output Data.  A 16 bit value that is used as output data

#                to the iobc.  This value is not used for analog outputs

#                but must be present.

#

#                The OUT_DATA value for analog outputs is 0x0000.

#

#   DELAY:       Delay value.  A 16 bit value indicating the amount of

#                time after which, if the card is not ready, an error is

#                returned.  Multiply us by 1.19 to get the proper delay.

#                A delay of 100 us == 100 * 1.19 = 119 (base 10) or

#                77 (base 16).

#

#                The DELAY value for analog outputs is typically 0x00FF.

#

#   AND_VAL:     A 16 bit value to logically AND with the output data

#                value in the Process Scan List command.  Only valid when

#                Options Bit 12 is set.  A value of 0x0FFF sends all 12

#                bits of the output value to the output channel.

#

#                The AND_VALUE value for analog outputs is 0x0FFF.

#

#   XOR_VAL:     A 16 bit value to exclusively OR with the results

#                obtained from ANDing the output value in the Process

#                Scan List command and the AND Value (AND_VAL).

#                Only valid when Options Bit 12 is set.  This value

#                represents the channel number (0-4) of the analog

#                output card.

#

#

#CORR_ID   TYPE  DEV_ADDRESS  OPTION   COMMAND  OUT_DATA  DELAY(uS)   AND_VAL   XOR_VAL

 0000001      2    0x00       0x9000    0x0507    0x0000    0x00FF      0x0FFF   0x0000

 0000002      2    0x00       0x9000    0x0507    0x0000    0x00FF      0x0FFF   0x4000

 0000003      2    0x00       0x9000    0x0507    0x0000    0x00FF      0x0FFF   0x8000

 0000004      2    0x00       0x9000    0x0507    0x0000    0x00FF      0x0FFF   0xC000

#

 0000005      2    0x00       0x9000    0x0508    0x0000    0x00FF      0x0FFF   0x0000

 0000006      2    0x00       0x9000    0x0508    0x0000    0x00FF      0x0FFF   0x4000

 0000007      2    0x00       0x9000    0x0508    0x0000    0x00FF      0x0FFF   0x8000

 0000008      2    0x00       0x9000    0x0508    0x0000    0x00FF      0x0FFF   0xC000

#

[DI]

# Define digital input scan list

               4

#

# Field Definitions

#

#   CORR_ID:     Correlation ID.  A 32 bit number that is transmitted to the

#                eiobc and returned from the eiobc for each I/O point.

#                Usually numbered sequentially.

#

#   TYPE:        An 8 bit number that defines the type of I/O to be performed.

#                There are currently four (4) types of I/O that can be

#                performed with the eiobc:

#

#                     TYPE            DEFINITION

#                     ----         -------------------

#                      1           OUTPUT_BASIC

#                      2           OUTPUT_WITH_BIT_OPS

#                      3           INPUT_BASIC

#                      4           INPUT_WITH_BIT_OPS

#

#                The TYPE used for digital inputs is 3, INPUT_BASIC.

#

#   DEV_ADDRESS: Device address.  An 8 bit number that defines the RTP

#                device address (chassis address).  If the chassis address is

#                set to 0x31, the address used for this field should be 0x01.

#

#   OPTION:      A bit mask of options.  A 16 bit value that is used as a mask

#                to control I/O options.  For type 3 (INPUT_BASIC) I/O, the

#                options are defined as follows:

#

#                Bit 15: Output command word contained in COMMAND

#                Bit 14: Check Test Return before writing output data

#                Bit 13: Wait DELAY number of microseconds for Test Return

#                        before output.  Only valid when Bit 14 is set.

#                Bit 12: Output data word contained in Output Data (OUT_DATA).

#                Bit 11: Check Test Return before reading input data.

#                Bit 10: Wait Delay number of microseconds for Test Return

#                        Only valid when Bit 11 set.

#                Bit 09: Perform an input operation and return data in

#                        response.  If this bit is not set, input is not

#                        performed and onlu POINT_STATUS is returned

#                        in response.

#                Bit 08: Perform a second input operation and return additional

#                        data in response.  Only valid if bit 09 is set.

#                        If this bit is set and POINT_EXTENDED_INPUT return

#                        is used.

#                Bit 07: Replace the Output Data (OUT_DATA) with the value

#                        obtained from the second input operation for auto-

#                        ranging purposes.  Only valid if bit 08 is used.

#

#                The OPTION value for digital inputs is 0x8A00.

#

#   COMMAND:     Command to the iobc.  A 16 bit value that defines which

#                card in the chassis rack will be doing the digital

#                inputs.  A value of 0x0503 in COMMAND indicates that

#                there is a digital input card in logical slot 3

#                (physical slot 8) of the chassis. 

#                (Note: logical slot = physical slot - 5.)

#

#   OUT_DATA:    Output Data.  A 16 bit value that is used as output data

#                to the iobc.  For digital inputs, this value is used as

#                an initialization value.

#

#                The OUT_DATA value for digital inputs is 0x0000.

#

#   DELAY:       Delay value.  A 16 bit value indicating the amount of

#                time after which, if the card is not ready, an error is

#                returned.  Multiply us by 1.19 to get the proper delay.

#                A delay of 100 us == 100 * 1.19 = 119 (base 10) or

#                77 (base 16).

#

#                The DELAY value for digital inputs is typically 0x00FF.

#

#   AND_VAL:     A 16 bit value to logically AND with the output data

#                value (OUT_DATA).  This value is not used for digital

#                inputs but must be present.

#

#                The AND_VALUE value for digital inputs is 0x0000.

#

#   OR_VAL:      A 16 bit value to logically OR with the output data

#                value (OUT_DATA).  This value is not used for digital

#                inputs but must be present.

#

#                The OR_VALUE value for digital inputs is 0x0000.

#

#

#CORR_ID   TYPE  DEV_ADDRESS  OPTION   COMMAND  OUT_DATA  DELAY(uS)   AND_VAL   XOR_VAL

 0000001    3        0x01     0x8A00   0x0500    0x0000   0x00FF      0x0000     0x0000

 0000002    3        0x01     0x8A00   0x0501    0x0000   0x00FF      0x0000     0x0000

 0000003    3        0x01     0x8A00   0x0502    0x0000   0x00FF      0x0000     0x0000

 0000004    3        0x01     0x8A00   0x0503    0x0000   0x00FF      0x0000     0x0000

#

[DO]

# Define digital output scan list

      4

#

# Field Definitions

#

#   CORR_ID:     Correlation ID.  A 32 bit number that is transmitted to the

#                eiobc and returned from the eiobc for each I/O point. 

#                Usually numbered sequentially.

#

#   TYPE:        An 8 bit number that defines the type of I/O to be performed. 

#                There are currently four (4) types of I/O that can be

#                performed with the eiobc:

#

#                     TYPE            DEFINITION

#                     ----         -------------------

#                      1           OUTPUT_BASIC

#                      2           OUTPUT_WITH_BIT_OPS

#                      3           INPUT_BASIC

#                      4           INPUT_WITH_BIT_OPS

#

#                The TYPE used for digital outputs is 1, OUTPUT_BASIC.

#

#   DEV_ADDRESS: Device address.  An 8 bit number that defines the RTP

#                device address (chassis address).  If the chassis address is

#                set to 0x31, the address used for this field should be 0x01.

#

#   OPTION:      A bit mask of options.  A 16 bit value that is used as a mask

#                to control I/O options.  For type 1 (OUTPUT_BASIC) I/O, the

#                options are defined as follows:

#

#                Bit 15: Output command word contained in COMMAND

#                Bit 14: Check Test Return before writing output data

#                Bit 13: Wait DELAY number of microseconds for Test Return

#                        before output.  Only valid when Bit 14 is set.

#                Bit 12: Output data word contained in Process Scan List

#                        message.  If this bit is not set then no output

#                        word should be included in the Process

#                        Scan List.

#

#                The OPTION value for digital outputs is 0xF000.

#

#   COMMAND:     Command to the iobc.  A 16 bit value....

#

#   OUT_DATA:    Output Data.  A 16 bit value that is used as output data

#                to the iobc.  This value is not used for digital outputs

#                but must be present. 

#

#                The OUT_DATA value for digital outputs is 0x0000.

#

#   DELAY:       Delay value.  A 16 bit value indicating the amount of

#                time after which, if the card is not ready, an error is

#                returned.  Multiply us by 1.19 to get the proper delay. 

#                A delay of 100 us == 100 * 1.19 = 119 (base 10) or

#                77 (base 16).

#

#                The DELAY value for digital outputs is typically 0x00FF.

#

#   AND_VAL:     A 16 bit value to logically AND with the output data

#                value (OUT_DATA).  This value is not used for digital

#                outputs but must be present.

#

#                The AND_VALUE value for digital outputs is 0x0000.

#

#   OR_VAL:      A 16 bit value to logically OR with the output data

#                value (OUT_DATA).  This value is not used for digital

#                outputs but must be present.

#

#                The OR_VALUE value for digital outputs is 0x0000.

#

#

#  CORR_ID   TYPE  DEV_ADDRESS  OPTION   COMMAND  OUT_DATA  DELAY(uS)   AND_VAL   XOR_VAL

   0000001    1        0x01     0xF000   0x0504    0x0000   0x00FF      0x0000     0x0000

   0000002    1        0x01     0xF000   0x0505    0x0000   0x00FF      0x0000     0x0000

   0000003    1        0x01     0xF000   0x0506    0x0000   0x00FF      0x0000     0x0000

   0000004    1        0x01     0xF000   0x0507    0x0000   0x00FF      0x0000     0x0000

#   End of RTP I/O Configuration File

...