Appendix G: Lua Scripts
X-600M Users Manual
disableDebug()
This function will disable the debug console. The print function will output to the debug console when
debugging is enabled.
clearDebug()
The debug console is an internal buffer that is 20Kbytes big. When the buffer is full, it is erased and
starts over. This function will erase the buffer.
serOpen(ioName)
Open a serial port for read/write. This function only needs to be called on a serial port if the
serClose function has been previously called on the port. By default, the X-600M opens all serial
port I/O.
serClose(ioName)
Close a serial port.
serRead(ioName)
Read from a serial port. The read data is returned in a table of bytes.
serWrite(ioName, data)
Transmit data to a serial port. The data can either be a string, or a table of bytes. The return value
will be less than 0 if an error occurred. Otherwise the return value will be the number of bytes
actually sent.
serGetRXByteCount(ioName)
This function returns the number of bytes available to read from the serial port. It can be used to
check for incoming bytes.
serClearTXBuffer(ioName)
Each serial port has a transmit buffer that the X-600M keeps track of and a transmit buffer built into
the serial port adapter. A call to this function will clear both the X-600M's transmit buffer and the
transmit buffer in the serial adapter.
serClearRXBuffer(ioName)
Each serial port has a receive buffer that the X-600M keeps track of and a receive buffer built into
the serial port adapter. A call to this function will clear both the X-600M's receive buffer and the
receive buffer in the serial adapter.
The following examples show how to use the serial port functions described above.
This first example demonstrates how to write a string to the serial port. The serial port is connected
to a PC where a terminal emulation program has been configured in order to display the output
strings from the X-600M. Remember, the serial port is configured (Baud Rate, etc.) through the I/O
menu and has been named “serialPort1”. This example also demonstrates how to check to make
sure the serial port adapter is physically connected to the X-600M and handle the case where it is
not connected.
counter = 0
-- loop forever
while true do
-- Write the string "Hello" plus the current counter value to the serial
port
Page 134
Xytronix Research & Design, Inc.
Содержание X-600M
Страница 1: ...X 600MTitle Page Goes Here...
Страница 6: ...X 600M Users Manual Page 4 Xytronix Research Design Inc...
Страница 99: ...X 600M Users Manual Setup Pages Xytronix Research Design Inc Page 97...
Страница 116: ...Appendix B Installing New Firmware X 600M Users Manual Page 114 Xytronix Research Design Inc...