Back to top

Changing variable values over Telnet to AKD BASIC program

This application note details how to pass values via Workbench terminal, Hyper terminal, or some other method

( i.e. high level programming language, etc. ) via Telnet commands.

Setting variable values in the AKD BASIC program using Telnet commands

When using Workbench terminal, Hyper terminal, or sending Telnet commands over the Ethernet port from a high programming language like C++, C#, Visual Basic, etc. there is not a method to set a variable value. For example, a=1000 or a 1000 does not fit within the Telnet list of host commands. If you use the following command over Telnet MOVE.TARGETPOS 4567 then this is set externally relative to the workings of the running program.

However, the AKD has 24 user parameters that can serve as holding registers where you can set the values over Telnet but use the values in your program.

For example in the AKD BASIC program:

dim targetposition as integer

targetposition=USER.INT1

From the host:

USER.INT1 4567

This allows you to point to/set a variable indirectly.

To see this real-time, the following program is running and the value of the variable is printed to the console.

image

Using Workbench terminal as the Telnet Host, I set the USER.INT1 to a value of 4567.

image

From the Workbench Help, note the range of values and the default value. Also note that if one of the parameters’ values are set and a Save to Device in Workbench or a DRV.NVSAVE is executed, the default value on power cycle will change from 0 to whatever value was set at the time of the NVSAVE.

image

An important final note is that depending on the number of values required to be sent from the host, this method is limited to the 24 USER.INTx parameters. For applications requiring more than that, it will be required to have MODBUS TCP protocol capabilities on the host PC, controller, PLC, HMI, etc. as there are 1000 registers available ( 5000 to 5999 ) available for passing values to the BASIC program’s variables from a host.