Avisaro Online Documentation - Wiki
Impressum Kontakt Sitemap

I/O, PWM, Analog Ports

If a pin is not used for data transmittion, it can be used as an input, output, pulse width modulation (PWM) or analog pin. This feature is available for the WLAN and Logger Module.

Command Interface vrs. Basic Scripting

Those pins can be controlled using Basic Scripting (described in this article) or the Command Interface (described Mehr here). Choose basic scripting option if the Avisaro Module should perform stand alone functions.

Setting and querying I/O ports

To set an I/O port, use the 'put' command (Mehr more). To read an I/O port, use the 'get' command (Mehr more). There is also the 'setleds' (Mehr more) and the 'key' (Mehr more)  command. Do not use those commands- they are there for compability reason only.

There is no need to declare a port as input or output port. By performing a put command, this port is declared as an output port. By performing a get, this port is declared as an input port. By default, a port is an input port.

This script listing is a simple example of how to use I/O ports within Basic. The script turns and off Pin 2 . It reads in Pin4 and sets Pin 3 the same :

      ' Script to set and read ports
' for demonstration purpose

let in = 0        ' declare variable in
      do
         put -202, #1   'pin 2: on
             'pin 2 is often the red led
                        'sleep 1 second
   sleep 1000
         put -202, #0   'pin 2: off
         sleep 1000
         get -204, in
         put -203, in   ' set pin 3 same as
              ' input pin 4  
loop

 

Details

  • There is no need to declare a port as I/O port. Simply use the port.
  • A new port command overwrites a previous configuration. Thus, if a pin was used for data communication, a port command can interrupt this functionality
  • Make sure to follow the electrical rules pins (Mehr more)

Pin layout

I/O, PWM, Analog Ports

If a pin is not used for data transmittion, this pin can be used as a input, output, pulse width modulation (PWM) or analog pin as described here:

No I/O

Name

 

Name

I/O No
1 P

VBAT

20070920_Layout_Blockschaltbild_320

VCC (3.3V)

P 24
2 I/O

GPIO

n.c.

- 23
3 I/O

GPIO

n.c.

- 22
4 I/O

GPIO

n.c.

- 21
5 I/O

GPIO, PWM

n.c.

- 20
6 I/O

GPIO, PWM

n.c.

- 19
7 I/O

GPIO, PWM

n.c.

- 18
8 I/O

GPIO, ADC

n.c.

- 17
9 I/O

GPIO, PWM, ADC

I/O (open drain)

I/O 16
10 I/O

GPIO, PWM

I/O (open drain)

15
11 I/O 

GPIO, PWM

Reset

I 14
12 I/O

GPIO 

GND

P 13

'I/O': pin is input or output or pwm or analog input (ADC), 'p' power, 'n.c.': do not connect, leave open