Are there STEP 7 example FCs available to handle data handshake of ASCII configured gateways?

Q

Are there STEP 7 example FCs available to handle data handshake of ASCII configured gateways?

A

There are three FCs available:

FC ASCII init

STL source code:
ASCII init.stl

Handling:
To be called once before FCs ASCII send and receive can be used. Usually called during PLC initialization phase in OB100.

Parameters IN:
Q_ADDR = start address of the ASCII gateways output data.

Parameters OUT:
RET_VAL = 0 no error, = 8003hex given Q_ADDR not of type output

Example:

      CALL  "ASCII init"

       Q_ADDR :=QB256

       RET_VAL:=MW100

FC ASCII send:

STL Source code:
ASCII send.stl

Handling:
Called whenever a data string needs to be sent. Can be called at any time after ASCII init has been called

Parameters IN:
Q_ADDR = start address of the ASCII gateways output data
I_ADDR = start address of the ASCII gateways input data
DATA = Pointer to data to be sent

DATALEN = amount of data in bytes to be sent

Parameters OUT:
RET_VAL = 0 no error, = 8003hex given Q_ADDR not of type output, = 8002hex given I_ADDR not of type input, = 8001hex gateway signals not be initialized (ASCII init not called before), = 8000hex data cannote be sent, another send command is still pending

Example:

      CALL  "ASCII send"

       Q_ADDR :=QB256

       I_ADDR :=IB256

       DATA   :="MyDataBlock".MyTxString[1]

       DATALEN:=10

       RET_VAL:=MW100

FC ASCII receive:

STL Source code:
ASCII receive.stl

Handling:
Called to check if new ASCII data has been received and if to get a copy of the received data

Parameters IN:
Q_ADDR = start address of the ASCII gateways output data
I_ADDR = start address of the ASCII gateways input data
DATA = Pointer to data where to get a copy of the received data to

Parameters OUT:
RET_VAL = 0 data received (DATA,DATALEN contains the number of bytes received), = 8003hex given Q_ADDR not of type output, = 8002hex given I_ADDR not of type input, = 8001hex gateway signals not be initialized (ASCII init not called before), = 8000hex no data received
DATALEN = amount of data received

Example:

      CALL  "ASCII receive"

       Q_ADDR :=QB256

       I_ADDR :=IB256

       DATA   :="MyDataBlock".MyRxString[1]

       RET_VAL:=MW100

       DATALEN:=MW102