Vai al contenuto

Manage digital outputs on receiving a command string

Home Forum Programmazione IEC 61131 (LogicLab) Manage digital outputs on receiving a command string

Stai visualizzando 5 post - dal 1 a 5 (di 5 totali)
  • Autore
    Post
  • #35284
    Kostas
    Partecipante

    After to have succesfully tested the program that sends a string on digital input state change (As reported in this post), now I need to add at the same program a new feature.

    I would like to manage two digital outputs by sending a string command to the SlimLine, the two commands are composed of 4 ascii characters, as reported.

    “1111”: This command activates outputs 0 and 1, output 0 remain active, output 1 resets after 5 seconds.
    “0000”: This command reset the output 0.

    Can someone post an example for this ?

    #37420
    Sergio Bertana
    Amministratore del forum

    Starting from the SendDIStatus program described in the post you quoted (The sorce code is available), I have developed a new program DIOManage that reaches the requirements.

    The two sections, send string on DI change, and set DO on command receive, are now splitted in two function blocks, both written in ST (Structured text) language. A LD (Ladder) program opens the serial communication port, sets the communication mode and executes the two FBs.

    I retain this solution more clear, the LD program is easy to understand and by debugging the program it’s more easy to be focused, each FB executes its own function, one FB sends the string on inputs change and the other FB manages the received command. Here the program printout and the source code.

    #37421
    Kostas
    Partecipante

    I tried the DIOManage program and it is working fine. Thank you!
    Since the SlimLine has an Ethernet port, we would like to change the program to communicate via the Ethernet port. Is this possible ?

    #37422
    Sergio Bertana
    Amministratore del forum

    It’s very simple to use the Ethernet to communicate instead of the serial line. The only think is need to do, it’s to change the FName in the Sysfopen function, defining TCPSKT instead of COMx.

    After opening the TCP/IP connection it’s necessary to define the socket options by using the SysSktListen FB. For more information please refer to the SlimLine system IEC61131-3 programming Manual, you can download it from the download section at the bottom of the SlimLine CPU web page.

    Here you can see the printout and the source code of a new program called EthDIOManage, the only differences between this and the previous is in the Communication ladder program.

    How you can see this program accepts a TCP/IP connection on port 1000 (You can change the port on the SysSktListen FB). When inputs change theirs status it is sent over the TCP connection, when a command is received from the TCP connection the outputs are managed according it.

    To test the program, it’s necessary simply to open a TCP/IP client connection on port 1000, to do this you can use any Telnet client for example our Toolly utility. Here a screenshot with the program test report using Toolly.

    #38570
    Sergio Bertana
    Amministratore del forum

    Post a link to this topic (Is in italian, but the source code is easy to understand) that is an enhancement of this topic. The program linked in this topic added to the program linked in the new topic are a useful startup to write own communication program.

Stai visualizzando 5 post - dal 1 a 5 (di 5 totali)
  • Devi essere connesso per rispondere a questo topic.