There is currently no native ASCII command interface built into Automation1, however a similar functionality can be achieved through the TCP/IP socket interface that was added in beta in Automation1 2.5.0 and officially released in Automation1 2.6.0. The TCP/IP socket interface allows Automation1 to directly send and receive TCP/IP packets to other network devices. If you are using a drive-based controller, the controller uses the Ethernet port to communicate. If you are using a PC-based controller, the controller uses Windows-supplied Ethernet adapters to communicate.

RS-232 is not natively supported, however RS-232 to TCP/IP converters have been used with success. We believe that most models will work for this purpose.

ASCII Command Example

AeroScriptAsciiCommands.ascriptlib

AeroScriptAsciiCommandServer.ascript

Usage

  1. Ensure that at least Task 1 and Task 2 are enabled.


  2. Put AeroScriptAsciiCommands.ascriptlib and AeroScriptAsciiCommandServer.ascript on the controller file system.



  3. Open AeroScriptAsciiCommands.ascriptlib in the Develop workspace and compile.



  4. Open AeroScriptAsciiCommandServer.ascript in the Develop workspace and run it on Task 1.



  5. Connect from some external application using the IP address of the controller and port 8000 (#defined in the .ascript program). Tested programs (for example):
    1. PuTTY (use the raw connection type)
    2. Ncat (download the zip file for Windows and run with a command like ncat 192.168.50.234 8000)
    3. telnet (usually already installed on Linux and run with a command like telnet 192.168.50.234 8000)
    4. netcat (can be installed in Linux - sudo apt install netcat - and run with a command like nc 192.168.50.234 8000)

  6. Enter commands directly, pressing Enter after each one. Example output:

    Enable(X)
    %
    Home(X)
    %
    MoveLinear(X, 10, 100)
    %
    Disable(X)
    %
    MoveIncremental(X, 30, 100)
    ! A task error occurred: 57000
    FOO(123)
    ! Unknown command: 'FOO'.
    Enable([X,Y,Z])
    ! Unexpected token ('['), expected axis name.
    MoveLinear(1, 2, 3)
    ! Unexpected number ('1'), expected axis name.
    MoveLinear(X, 10, 20, 30)
    ! Unexpected ',' (','), expected ')'.


Details

This example reads strings from a socket until a “\n” character is seen. The various applications listed above send either “\n” or “\r\n” when you press Enter after entering a command; however, this doesn’t matter because the example strips off all trailing whitespace characters from each string (and whitespace includes “\r” and “\n” characters).

The socket program running on Task 1 uses the library to execute the actual commands (Home(), Enable(), etc.) on Task 2 with a blocking sync() call so that a task error does not cause any problems with the socket connection. The blocking nature means that the Task 1 program waits until the command has finished executing before sending a response to the TCP client. 

A response is either “%” if parsing/executing the command was successful or “! <error message>” if parsing/executing causes an error.

AutoRun Programs

Auto Running programs can be achieved by using the Program Automation box in the Develop workspace. Take the compiled version of the AeroScriptAsciiCommandServer.ascript program (should have a .a1exe file extension) and use the Program Automation window to set the program to “Run”.