All Functions Modules Pages
sio

Functions

NUMBER sio.init ()
 Loads and starts the module. More...
 
NIL sio.baud (NUMBER baud)
 Sets the port baud rate (speed). More...
 
NIL sio.available ()
 Gets the number of bytes (characters) available for reading from the SIO port. More...
 
NUMBER sio.read ()
 Receives an ASCII char. More...
 
NIL sio.write (NUMBER data)
 Sends an ASCII char. More...
 
NIL sio.print (STRING msg)
 Sends a message. More...
 
NIL sio.putstring (STRING data, NUMBER len)
 Converts a message to ASCII, and sends it. More...
 
NUMBER sio.term ()
 Closes the port and stops the module. More...
 

Detailed Description

Serial In Out (SIO) port.

Function Documentation

NUMBER sio.init ( )

Loads and starts the module.

Note
You only need to call this function once.
Returns
1 if the module was started successfully, 0 otherwise.
NIL sio.baud ( NUMBER  baud)

Sets the port baud rate (speed).

Parameters
baudThe port baud rate.
Note
There is no predetermined baud rate, should be changed to match the connected device.
Returns
Nothing.
NIL sio.available ( )

Gets the number of bytes (characters) available for reading from the SIO port.

Note
Data are treated who have already arrived and is stored in the reception buffer SIO (Size: 1024 bytes).
Returns
The number of bytes in buffer or 0.
NUMBER sio.read ( )

Receives an ASCII char.

Returns
A number between 0 and 255, or -1 if nothing is in buffer.
NIL sio.write ( NUMBER  data)

Sends an ASCII char.

Parameters
dataThe data to send (0-255).
Returns
Nothing.
NIL sio.print ( STRING  msg)

Sends a message.

Parameters
msgThe message to send.
Returns
Nothing.
NIL sio.putstring ( STRING  data,
NUMBER  len 
)

Converts a message to ASCII, and sends it.

Parameters
dataThe data to send.
lenThe len of the data to send.
Returns
Nothing.
NUMBER sio.term ( )

Closes the port and stops the module.

Returns
1 if the module was stoped successfully, 0 otherwise.