
The PORT command can be used to use a subset of the Module's pins as GPIOs or as analog or digital signal lines. PORT commands overwrite previous configurations. For example: If you're using the RS232 interface, a PORT 9 GET command immediately disables the TXD line.
The general syntax of the PORT command is:
PORT n cmd arg1 arg2
Where n is the pin number and cmd is the subcommand. The additonal arguments arg1 and arg2 are optional and currently only used for square wave generation (PWM).
The following subcommands are available:
PWM
Generates square waves. arg1 and arg2 are used to set pulse/pause lengths. The first one (arg1)
determines the pause length in units of 0.5 µs and the latter one (arg2) is
the pulse length, also in 0.5 µs units. Pin 5, 6, 7, 9, 10 and 11 can
be used as PWM outputs simultaneously.
Since all outputs share a common timer, the frequency of each signal
must be equal to the the others. To follow this rule, simply make sure
that the sum of arg1 and arg2 is the same for all outputs.
SET
Drives pin HIGH if it is an output pin
CLR
Drives pin LOW if it is an output pin
GET
Reads digital value (0 or 1) from that pin
ANA
Reads analog value (0...1023) from that pin
ERR_OK (0) if the action was performed without error.
ERR_ARGUMENT (4) if input was rejected.
PORT 2 SET
Makes one LED on the trailer board glow
PORT 7 PWM 1000 1000
Generates symmetric square waves with a period of 1ms
This command exists since version 3.48. The Avisaro module pin numbering scheme can be found here: click. The following list shows all possible pin functions:
Pin1
Can't be used (VBAT)
Pin2
Can be used as GPIO. Pin2 is connected to one LED on the trailer board.
Pin3
Can be used as GPIO. Pin3 is connected to the other LED on the trailer board.
Pin4
Can be used as GPIO. Pin 4 is connected to the key on the trailer board.
Pin5
Can be used as GPIO and PWM output. Pin 5 is connected to DCD on the RS232/RS485 socket.
Pin6
Can be used as GPIO and PWM output. Pin 6 is connected to DSR on the RS232/RS485 socket.
Pin7
Can be used as GPIO and PWM output. Pin7 is connected to DTR on the RS232/RS485 socket.
Pin8
Can be used as GPIO and analog input. Pin 8 is connected to RING on the RS232/RS485 socket.
Pin9
Can be used as GPIO, analog input and PWM output. Pin 9 is connected to TXD on the RS232/RS485 socket.
Pin10
Can be used as GPIO and PWM output. Pin 10 is connected to RXD on the RS232/RS485 socket.
Pin11
Can be used as GPIO and PWM output. Pin 11 is connected to CTS on the RS232/RS485 socket.
Pin12
Can be used as GPIO. Pin 11 is connected to RTS on the RS232/RS485 socket.
Pin13
Can't be used. (GND)
Pin14
Can't be used (RESET)
Pin15
Can be used as input or open-drain output. Pin15 is also used as SCL of the IIC interface.
Pin16
Can be used as input or open-drain output. Pin 16 is also used as SDA of the IIC interface.
Pin17
Can't be used. (Internal SPI)
Pin18
Can't be used. (Internal SPI)
Pin19
Can't be used. (Internal SPI)
Pin20
Can't be used. (Internal SPI)
Pin21
Can't be used. (Internal SPI)
Pin22
Can't be used. (Internal SPI)
Pin23
Can't be used. (Internal SPI)
Pin24
Can't be used. (VCC)