The Tcl language was designed to be a simple scripting language. Unless you're already familiar with it or have some other reason for using it, it's probably better to use python instead.
See the README file in the lang/tcl directory for more details.
This page describes the Tcl commands implemented by the MatPLC extension; it assumes a working knowledge of Tcl programming and the MatPLC 'C' language programming interface.
Load the module with an explicit load command, or with package require lplc.
The module implements a single new Tcl command, lplc, which has the form:
lplc subcommand [options...]
The following subcommands and options are implemented:
lplc init [-module string] [-array arrayname]
[--PLCoptions]
The default module for Tcl scripts is "TCL". This can be overridden with the -module option.
If an array name is specified, the init command creates an associative array with the specified name, populated as follows:
array(count) | number of points |
array(x,name) | name of point at index x (where 0 <= x <
count)
If the point at index x is not valid (i.e. handle.valid == 0), the name is INVALID. (this should not happen, as the indeces are dictated by the configuration.) |
The --PLC options specified by the plc_init()
routine can be passed on the command line as well. Note that this
list includes --PLCmodule=string
, another
method for overriding the default module.
lplc done
lplc getpt [-name pointname]
Generates a Tcl error if a handle to the named point could not be got.
Note: the getpt subcommand performs a plc_update()
and then a plc_get()
lplc setpt [-name pointname] [-value
value]
Generates a Tcl; error if a handle to the named point could not be got.
note: the setpt subcommand performs a plc_set()
and
then a plc_update()
lplc update [-array arrayname]
Updates the module's copy of the MatPLC data.
If an array name is specified, the array is populated as follows:
array(x,value) |
value of point at index x |
$Date: 2004/12/28 05:32:11 $