Step Comments

The array below summarizes the programming steps in the example:

Step Number

Step Description

0

Initial state of function

Wait for change to 1 of Start_4 bit to go to step 5.

5

If no command is in progress on the serial port, a command is sent to change the serial port from Modbus mode to character mode.

Go to step 10.

10

Read status of serial port.

  • If there is an error on the serial port then

    • Error_4 is at -2.

    • Go to step 65.

  • If there is no error on the serial port,

    • And character mode is active, then go to step 15.

    • And no character mode active, then test the status of change to character mode on 1000 cycles. If, after 1000 cycles, the modem has not changed, then Error_4 is at -1, and go to step 65.

15

Sending a dial command to the modem via the PRINT_CHAR block and waiting for the response via INPUT_CHAR.

Go to step 20.

20

If the result of PRINT_CHAR is conclusive then go to step 25 otherwise go to step 65 with Error_4 at -3.

25

If the result of INPUT_CHAR is conclusive then go to step 30 otherwise go to step 65 with Error_4 at -4.

30

If the modem responds then go to step 35 otherwise go to step 65 with Error_4 at -5.

35

Initialization of OUT_IN_MBUS block parameters.

Go to step 40.

40

  • Call of OUT_IN_MBUS block.

  • If the bit Active_4 is at 0,

    • And if the bit Flag_Error_4 is at 0, then go to step 45.

    • And if the bit Flag_Error_4 is at 1, then go to step 45 with Error_4 at -6.

45

Sending a disconnection command to the modem using the PRINT_CHAR block.

Go to step 50.

50

If the result of PRINT_CHAR is conclusive then go to step 55 otherwise go to step 65 with Error_4 at 1.

55

If no command is in progress on the serial port, a command is sent to change the serial port from character mode to Modbus mode.

Go to step 60.

60

Read status of serial port.

  • If there is an error on the serial port then

    • Error_4 is at 3.

    • Go to step 65.

  • If there is no error on the serial port,

    • And go to Modbus mode, then go to step 65.

    • And no Modbus mode, then test the status of change to character mode on 1000 cycles. If, after 1000 cycles, the modem has not changed, then Error_4 is at 2, and go to step 65.

65

Return to step 0 (initial function state) and bit Start_4 at 0.