Difference between revisions of "S7-SoftPLC:ADDI-DATA configuration"

From IBHsoftec Wiki English
Jump to: navigation, search
Line 6: Line 6:
 
* The adequate drivers of ADDI-DATA have to be installed.
 
* The adequate drivers of ADDI-DATA have to be installed.
 
* The software ADDIPACK has to be installed and correctly licenced.
 
* The software ADDIPACK has to be installed and correctly licenced.
* The interface card has to be configured in the ADDI-PACK.<br />
+
* The interface card has to be configured in the ADDI-PACK.
(if there are any problems, please contact the ADDI-DATA documentation and/or the ADDI-DATA support.)
+
(if there are any problems, please contact the ADDI-DATA documentation and/or the ADDI-DATA support.)
 
* The &quot;ADDI-DATA PC-Card&quot; driver has to be selected in ''S7-SoftPLC''.
 
* The &quot;ADDI-DATA PC-Card&quot; driver has to be selected in ''S7-SoftPLC''.
  

Revision as of 14:18, 19 December 2012

The ADDI-DATA-driver allows to access Digital I/O and Analog I/O cards from the PLC-program of S7-SoftPLC. With the ADDI-PACK software the physical IO-cards are mapped into a single virtual card. It can be accessed over functions (FC-blocks), which need to be called from the PLC-program. A cyclic data exchange over the process image does not make sense, due to the ADDI-DATA functions infrastructure.

Requirements

  • The interface card has to be installed on the computer.
  • The adequate drivers of ADDI-DATA have to be installed.
  • The software ADDIPACK has to be installed and correctly licenced.
  • The interface card has to be configured in the ADDI-PACK.

(if there are any problems, please contact the ADDI-DATA documentation and/or the ADDI-DATA support.)

  • The "ADDI-DATA PC-Card" driver has to be selected in S7-SoftPLC.

Accessing the I/O card

The FC-blocks, installed by the driver in S7-SoftPLC, represent functions of the ADDIDATA.DLL provided by ADDI-DATA. These functions are transparently mapped as FC-blocks into the PLC-program. For detailed information please read the adequate documentation of ADDI-DATA. The parameter "dw_DriverHandle" described in the ADDI-DATA documentation is not required, because the S7-SoftPLC driver takes care of opening and closing the ADDI-DATA driver as well as passing the "dw_DriverHandle" to the ADDI-DATA functions.


Read8DigitalInputs:

Corresponds to the function "b_ADDIDATA_Read8DigitalInputs (DWORD dw_DriverHandle, BYTE b_Port, PBYTE pb_PortValue)".

Request:

CALL FC 100
INO  := B#16#0 //b_Port
RET_VAL  := MW 0 //RET_VAL error code
OUT1  := MB 2 //pb_PortValue


The parameter IN0 corresponds to the ADDI-DATA parameter b_Port. The parameter OUT1 corresponds to the ADDI-DATA parameter pb_PortValue. The driver itself takes care of the dw_DriverHandle. The result of the function is returned in RET_VAL. This scheme applies to every driver function.


Read16DigitalInputs:

Corresponds to the function "b_ADDIDATA_Read16DigitalInputs(DWORD dw_DriverHandle, BYTE b_Port, PWORD pw_PortValue)".

Request:

CALL FC 101
INO  := B#16#0 //b_Port
RET_VAL  := MW 0 //RET_VAL error code
OUT1  := MB 2 //pw_PortValue


Read32DigitalInputs:

Corresponds to the function "b_ADDIDATA_Read32DigitalInputs(DWORD dw_DriverHandle, BYTE b_Port, PDWORD pdw_PortValue)".

Request:

CALL FC 102
INO  := B#16#0 //b_Port
RET_VAL  := MW 0 //RET_VAL error code
OUT1  := MD 2 //pdw_PortValue


Set8DigitalOutputs:

Corresponds to the function "b_ADDIDATA_Set8DigitalOutputsOn(DWORD dw_DriverHandle, BYTE b_Port, BYTE b_PortValue)".

Request:

CALL FC 103
INO  := B#16#0 //b_Port
IN1  := B#16#0 //b_PortValue
RET_VAL  := MW 0 //RET_VAL error code


Set16DigitalOutputs:

Corresponds to the function "b_ADDIDATA_Set16DigitalOutputsOn(DWORD dw_DriverHandle, BYTE b_Port, WORD w_PortValue)".

Request:

CALL FC 104
INO  := B#16#0 //b_Port
IN1  := B#16#0 //w_PortValue
RET_VAL  := MW 0 //RET_VAL error code


Set32DigitalOutputs:

Corresponds to the function "b_ADDIDATA_Set32DigitalOutputsOn(DWORD dw_DriverHandle, BYTE b_Port, DWORD dw_PortValue)".

Request:

CALL FC 105
INO  := B#16#0 //b_Port
IN1  := DW#16#0 //dw_PortValue
RET_VAL  := MW 0 //RET_VAL error code


InitAnalogInput:

Corresponds to the function "b_ADDIDATA_InitAnalogInput(DWORD dw_DriverHandle, WORD w_Channel, pstr_InitAnalogInput ps_InitParameters, DWORD dw_StructSize)".

This function requires a data structure for the initialisation of an input (see card documentation). The structure is passed to the FC with an ANY-pointer of the type byte (ps_InitParameters). A seperate parameter for length of the structure (dw_StructSize) is not neccessary, it is taken from the ANY-pointer.

Request:

CALL FC 106
INO  := W#16#0 //w_Channel
IN1  := P#M 8.0 BYTE 10 //ANY-pointer to structure
RET_VAL  := MW 0 //RET_VAL error code


ReleaseAnalogInput:

Corresponds to the function "b_ADDIDATA_ReleaseAnalogInput(DWORD dw_DriverHandle, WORD w_Channel)".

Request:

CALL FC 107
INO  := W#16#0 //w_Channel
RET_VAL  := MW 0 //RET_VAL error code


InitAnalogOutput:

Corresponds to the function "b_ADDIDATA_Init1AnalogOutput(DWORD dw_DriverHandle, WORD w_Channel, BYTE b_VoltageMode, BYTE b_Polarity)".

Request:

CALL FC 108
INO  := W#16#0 //w_Channel
IN1  := B#16#0 //b_VoltageMode
IN2  := B#16#0 //b_Polarity
RET_VAL  := MW 0 //RET_VAL error code


ReadAnalogInput:

Corresponds to the function "b_ADDIDATA_Read1AnalogInput(DWORD dw_DriverHandle, WORD w_Channel, DWORD dw_ConvertingTime, BYTE b_ConvertingTimeUnit, BYTE b_InterruptFlag, PDWORD pdw_ChannelValue)".

The function requires a pointer to the return value (see card documentation). The structure is passed to the FC with an ANY-Pointer of the type dword (pdw_ChannelValue). Please note, that the ANY-Pointer always has to have the length of DWORD 3 (12 byte).

The parameter b.InterruptFlag is not used, because it runs in polling-mode only.

Request:

CALL FC 109
INO  := W#16#0 //w_Channel
IN1  := DW#16#0 //dw_ConvertingTime
IN2  := B#16#0 //b_ConvertingTimeUnit
IN3  := P#M4.0 DWORD 3 //ANY-Pointer to result
RET_VAL  := MW 0 //RET_VAL error code


WriteAnalogOutput:

Corresponds to the function "b_ADDIDATA_Write1AnalogOutput(DWORD dw_DriverHandle, WORD w_Channel, dw_ValueToWrite)".

Request:

CALL FC 110
INO  := W#16#0 //w_Channel
IN1  := DW#16#0 //dw_ValueToWrite
RET_VAL  := MW 0 //RET_VAL error code

Return values:

On success RET_VAL = 0 is returned.

If an error has occurred, the error code from ADDIDATA.DLL is passed through, if possible.

If it should not be possible, the following error codes are returned:

Error code Reason
0x807F DriverHandle not available
0x8042 Error reading input
0x8043 Error writing output
0x8003 Wrong ANY-Pointer type
0x8023 ANY-Pointer does not point to a valid area or does not have the correct length


PLC switches to STOP:

If S7-SoftPLC is switched to STOP by the driver, an error code is inserted into the diagnostic buffer, which can be read out with the programming unit (S7 für Windows®, STEP®7).

Error code Reason
0xA140 An error has occured at "i_ADDIDATA_OpenWin32Driver”. The error number of ADDIDATA.DLL is following in the next diagnostic buffer entry.