
AUXOPEN is a generic function that can be used to enable I/O interfaces which normally are disabled. AUXOPEN takes six arguments, opens the interface and sets the LASTERR (
more) variable after invocation. The first argument is a pre-defined handle number that refers to the interface. The other five arguments are interface-specific configuration parameters.
Syntax
1. Handle number
2. Baud Rate/Frequency
3. Other parameter
| Parameter |
2. RS232 |
I2C Master |
2. CAN |
SPI Master on Pins 9,10,11,12 |
future use |
|
1. |
-4 |
-5 |
-8 |
-10 | |
|
2. |
Baud rate |
Baud rate |
Baud rate |
Clock frequency in Hz from 140 kHz up to 18 Mhz |
|
|
3. |
Parity |
Bus Address |
Filter |
Clock polarity, 0 or 1 0 = Clock is active high 1 = Cock is active low |
|
|
4. |
# of Stop bits |
0 = master |
Filter |
Clock phase, 0 or 1 0 = Data is sampled on first closk edge 1 = Data is sampled on second clock edge |
|
|
5. |
# of Data bits |
not used |
Mode |
Slave Select polarity, 0 or 1 0 = SS is sctive low 1 = SS is active high |
|
|
6. |
Flow Cntrl |
not used |
not used |
Slave Select mode, 0 or 1 0 = SS toggles once per frame 1 = SS toggles for every byte |
Details of the AUXOPEN command when used with RS232/485/422:
Handle number
-4 refers to RS232
2. Baud Rate
For all three interfaces, UART#3, IIC master or CAN2, this argument defines the baud rate in bits per second.
3. Parity, Slave Address or CAN Filter argument
This argument defines the type of parity that shall be used. One of the three ASCII values E,O, or N must be provided to set the parity type. E means even, O means odd and N means no parity. You can use the ASC function to convert a character into that value.
4. Stop Bits or CAN Filter argument
This argument defines the number of stop bits for the connection. Allowed values are 1 and 2.
5. Bits per Character or special CAN features
This argument defines character width for the connection. Allowed character widths are 5, 6, 7 and 8.
6. Flow control method
This argument defines the type of handshake for the connection. One of the ASCII values N, H, or S must be provided to set the handshake type. N means no handshake, H means hardware handshake (RTS/CTS) and S means software hadshake (XON/XOFF). You can use the ASC function to convert a character into that value
1. Handle number
-8 opens the secondary CAN Interface
2. Baud Rate
For all three interfaces, UART#3, IIC master or CAN2, this argument defines the baud rate in bits per second.
3. Parity, Slave Address or CAN Filter argument
This is the first argument of the message acceptance filter (lower ID).
4. Stop Bits or CAN Filter argument
This is the second message acceptance filter value (upper ID).
5. Bits per Character or special CAN features
This argument can 0, 1 or 2. 0 means normal operation. When 1, the CAN interface uses a proprietary flow control mechanism by sending out certain messages when its input FIFO becomes too full. When 2, the CAN interface operates in "sniffing" mode, that is, it only receives but does not send anything.
6. Flow control method
This value is unused and shall be zero.
Details of the AUXOPEN command when used with I2C:
1. Handle number
2. Baud Rate
3. Parity, Slave Address or CAN Filter argument
5. Bits per Character or special CAN features
This value is not used and shall be zero.
6. Flow control method
This value is unused and shall be zero.
outmode -2
let a$ = "hello"
auxopen -4, 115200, ASC("N"), 1, 8, ASC("N")
if LASTERR = 0 then
print "AUX UART open!"
put -4, a$
else
print "failed to open AUX UART"
end if
Because I/O lines of the Avisaro module are shared among multiple interfaces, enabling an auxiliary port will (in many cases) disable other functionality. Please see the hardware manual for functions that interfere with others. Once activated, an auxiliary port can not be disabled programmatically. If called more than once, AUXOPEN opens den auxiliary port again and again. This is roughly the same as resetting the port.
Note on SPI master: SPI master uses 8-bit frames and works like a bi-directional synchronous shift register. Bytes are actively clocked in and out when an ouput command (such as PUT) is executed. Incoming bytes are stored into a FIFO buffer. This buffer can be read with an input command (such as GET). If e.g. 200 bytes are clocked out, simultaneous incoming 200 bytes are buffered.