TOC PREV NEXT INDEX

LinuxCNC.org


Handbook Working with iosh


Tcl command extensions for EMC IO

The following information has been extracted from iosh.cc. For examples of the correct usage, look at the tcl scripts in emc/tcl/scripts.

To use the iosh commands, use the following at the start of the script:

#!/bin/sh
# the next line restarts using iosh \
exec plat/nonrealtime/bin/iosh "$0" "$@"


Using iosh:

iosh {<script>} {-- -ini <ini file>}

With filename, it opens NML buffers to the EMC IO, runs the script, closes the buffers, and quits.

Without filename, it runs interactively.

With -- -ini <inifile>, uses inifile instead of emc.ini. Note that the two dashes prevents Tcl from looking at the remaining args, which would otherwise trigger a Tcl error that it doesn't understand what -ini means.


EMC IO commands:

emc_io_connect
emc_io_disconnect

Open or close the NML buffers to the command in, status out, and error out. Returns 0 if OK, or -1 if not.


emc_io_read_command

Peek the NML command buffer. Returns 0 if OK, -1 if not.


emc_io_get_command

Puts the command string, e.g., "emc_aux_estop_off", or "none". Returns 0.


emc_io_get_command_type

Puts the command NML number. Returns 0.


emc_io_get_serial_number

Puts the command serial number. Returns 0.


emc_io_write_status

Write the EMC_IO_STAT structure out to NML. Returns 0 if OK, -1 if error.


emc_io_write_error

Write the error string to the error NML buffer. Returns 0 if OK, -1 if error.


emc_io_status_heartbeat <number>
emc_io_status_echo_serial_number <number>
emc_io_status_status done | exec | error
emc_io_status_estop on | off
emc_io_status_mist on | off
emc_io_status_flood on | off
emc_io_status_lube on | off
emc_io_status_lube_level ok | low
emc_io_status_spindle_speed <speed>
emc_io_status_spindle_enabled on | off
emc_io_status_spindle_direction <pos> <neg> 0
emc_io_status_spindle_increasing <pos> <neg> 0
emc_io_status_spindle_brake on | off
emc_io_status_tool_prepped <number>
emc_io_status_tool_in_spindle <number>

IO status, sets associated field in the NML status structure


IO commands:

inb <address>

Reads and returns the byte at <address>. If address begins with 0x, it's interpreted as a hex number, otherwise it's decimal.


outb <address> <value>

Writes the byte <value> to <address>. If address or value begins with 0x, it's interpreted as a hex number, otherwise it's decimal. Returns nothing.


inw <address>

Reads and returns the short at <address>. If address begins with 0x, it's interpreted as a hex number, otherwise it's decimal.


outw <address> <value>

Writes the short <value> to <address>. If address or value begins with 0x, it's interpreted as a hex number, otherwise it's decimal. Returns nothing.


inl <address>

Reads and returns the long at <address>. If address begins with 0x, it's interpreted as a hex number, otherwise it's decimal.


outl <address> <value>

Writes the long <value> to <address>. If address or value begins with 0x, it's interpreted as a hex number, otherwise it's decimal. Returns nothing.




TOC PREV NEXT INDEX