2 gpio pin use, 1 querying gpio pin status, At#gpio=<pin>,2<cr – Rainbow Electronics GM862-QUAD-PY User Manual
Page 78

GM862-QUAD / PY Software User Guide
1vv0300747 Rev. 3 - 10/07/07
Reproduction forbidden w ithout Telit Communications S.p.A. w ritten authorization - All Rights Reserved
page 78 of 96
3.6.2 GPIO pin use
After having set-up the GPIO pin direction you can query the input status of an INPUT pin or set the
output status of an OUTPUT pin.
3.6.2.1 Querying GPIO pin status
To query for the pin status:
•
Send command
AT#GPIO=<pin>,2<cr>
where:
<pin> is the GPIO pin number at which the command applies:
1 – GPIO1
7 – GPIO7
2 – GPIO2
8 – GPIO8
3 – GPIO3
9 – GPIO9
4 – GPIO4
10 – GPIO10
5 – GPIO5
11 – GPIO11
6 – GPIO6
12 – GPIO12
13 – GPIO13
•
wait for response in the format:
#GPIO: <dir>,<stat>
OK
where:
<dir> - GPIO<pin> direction setting
<stat> - status of the pin
0 - LOW
1 - HIGH
NOTE: In case the GPIO pin direction is set to ALTERNATE FUNCTION (2), then the reported
<stat> has no meaning and shall not kept as valid, but shall be threaten as a dummy value.
TIP: The query reports depending on the pin direction:
-
the read pin status in case the direction is input;
-
the previously set pin status in case the direction is output.
In any case, you can know if the pin at the query moment is high or low and the pin direction.
For example:
1- Let's assume you want to query the GPIO3 pin for its status:
command:
AT#GPIO=3,2<cr>
response:
#GPIO: 0,1
OK
In this case, the GPIO3 pin was set in input direction and its status has been measured to be HIGH.