Send and receive characters from serial ports and cards
Name | Type | Opt | Description |
---|---|---|---|
symbol a-z | symbol | opt | Specifies the serial port to be used by the serial object. If alphabetic shortcuts are used, specifies the first logical serial port in the computer, and - are used to specify additional ports. |
symbol portname | symbol | If actual portnames are used, the symbol is the name given by the Operating System to your port. The serial object (see above) can be used to create a list of available portnames and alphabetic shortcuts. If the port chosen is currently in use or unavailable when the serial object is instantiated, an error message will be displayed and the object will not function. If no port is specified, the default port is . | to the|
baud-rate | int | opt | An optional argument may be used after the port name or alphabetic shortcut to specify the baud rate of the serial port (the default rate is 4800 baud). Any value is allowable (although not all ports can be set to all baud rates). Some common rates are 300, 600, 1200, 1800, 2400, 3600, 7200, 9600, 19200, 38400, 57600 and 115200. |
data-bits | int | opt | After the baud rate, the next arguments specifies the number of data bits for the serial port (the default is 8 data bits). Other possible values are 5, 6 and 7. |
stop-bits | int | opt | The next argument specifies the number of stop bits for the serial port. The default is 1. Other possible values are 1.5 (Windows only) and 2. |
serial-port-parity | int or symbol | opt | The next argument specifies the parity for the serial port (the default is no parity, specified by | or ).Other possible values are , (odd), , and (odd).
bang | Sends each character received on the serial port since the last serial object's left outlet as an integer in the order that the characters were received. Before output data is sent, the message , followed by a number specifying the number of bytes received is sent out the right outlet of the serial object. | message out the|
int | input (0 through 255) [int] |
Sends the number out the serial port accessed by the serial object. Numbers outside the range 0-255 are wrapped to that range using a modulo operator. After the data is sent, the message , followed by a number specifying the number of bytes sent is sent out the right outlet of the serial object. |
float | input (0 through 255) [float] |
Converted to | .
list | input-list (0 through 255) [list] |
Sends each number in the list out the serial port, in order. Numbers outside the range 0-255 are wrapped to that range using a modulo operator. After the data is sent, the message serial object. | , followed by a number specifying the number of bytes sent is sent out the right outlet of the
break | Sends a break command to the serial port used by the serial object. After the break has completed, the message is sent out the object's right outlet. | |
close | Closes an open serial connection, permitting use of the serial port by other applications. | |
getport | Sends the name or shortcut of the currently open serial port out the serial object's right outlet, prepended by the word . | |
port | serial-port (shortcut or portname) [list] |
The word port, followed by a symbol, specifies the serial port to be used by the object. If alphabetic shortcuts are used, a specifies the first logical serial port in the computer. b - z specify additional ports. If actual portnames are used, the symbol is the name given by the operating system to your port. See the print message, above, for a way to list available portnames and alphabetic shortcuts. If the port chosen is currently in use or unavailable when the port message is sent, an error message will be displayed and the object will revert to its previously chosen port, or won't function if there was none. |
Sends a list of available serial ports to the Max window, along with their alphabetic shortcuts. The message | ... is also sent from the object's right outlet, with a list of available ports.||
open | Opens a new serial connection. | |
refresh | Refreshes the list of known/available serial ports. See the | message for additional information.|
reset | (Mac only) Resets the currently open serial port using the Basic Stamp initialization sequence. |
Name | Type | g/s | Description |
---|---|---|---|
autoopen | int | Toggles automatically opening the serial port. | |
baud | int | Sets the port's baud rate. | |
bufsize | int | Sets the input buffer size used by the serial object. | |
chunk | int | Sets the data chunk size (data list length) for output. | |
databits | int | Sets the number of data bits (acceptable values are 5, 6, 7, or 8). | |
drain | int | (Mac only) Toggles drain enable. When enabled, communication waits until all data has been transmitted to the terminal when writing. The default value is 0 (disabled). | |
dtr | int | Enables or disables the DTR (data terminal ready) function of the serial port used by the serial object. | |
parity | int | Sets the parity for the port. The options are: 0: no parity 1: odd 2: even |
|
serport | int | Used by the object Inspector only. Users should use the | message.|
stopbits | int | Sets the number of stop bits used when communicating with the serial port. | |
xonxoff | int | Enables Xon/Xoff serial flow control. |
Name | Description |
---|---|
match | Look for a series of arguments, output it as a list whenever an input matches |
spell | Convert input to ASCII codes |
vdp | Control a videodisk player through a serial port |
Max Comm Tutorial 2: Serial Communication | Max Comm Tutorial 2: Serial Communication |