Avisaro Online Documentation - Wiki
Impressum Kontakt Sitemap

AUXOPEN

Description

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 (Mehr 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

auxopen <handle number> <Baud Rate> <3. parameter> <4. parameter>
 

1. Handle number

-4   : refers to RS232 Port 2 of the Avisaro 2.0
-5   : opens the I2C interface in master mode
-8   : opens the secondary CAN interface
-10 : SPI (as Master) using the SPI lines 9,10,11, and 12
 

2. Baud Rate/Frequency

Defines the Baud Rate in bit/s or Hz.

 

3. Other parameter

The other parameter depends on the interface (handle number) selected:
           
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
bits/s

Baud rate
bits/s

Baud rate
bits/s

Clock frequency in Hz
from 140 kHz up to 18 Mhz
 

3.

Parity
("N","O","E")

 Bus Address

 Filter
(lower ID)

Clock polarity, 0 or 1
0 = Clock is active high
1 = Cock is active low
 

4.

 # of Stop bits
(1,2)

 0 = master
1 = slave

 Filter
(upper ID)

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
(6, 7, 8) 

 not used
( 0 )

 Mode
(0, 1, 2)

Slave Select polarity, 0 or 1
0 = SS is sctive low
1 = SS is active high
 

6.

 Flow Cntrl
("N", "H","S")

not used
( 0 )

 not used
( 0 )

Slave Select mode, 0 or 1
0 = SS toggles once per frame
1 = SS toggles for every byte
 

 

AUXOPEN - Using 2nd RS232

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 

AUXOPEN - Using 2nd CAN

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. 

AUXOPEN - Using I2C Master or Slave

Details of the AUXOPEN command when used with I2C:

1. Handle number

-5 opens the IIC interface .
 

2. Baud Rate

This argument defines the baud rate in bits per second. If I2C is configured as slave, enter a 0.

 
3. Parity, Slave Address or CAN Filter argument

This is the address of the slave where the master should talk to.
 
4. Stop Bits or CAN Filter argument
This value is not used and shall be zero.


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.

Example (RS232)

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

Remarks

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.