Pin configurations
Devices support both analog input and digital I/O line modes on several configurable pins.
The following table provides typical parameters for the pin configuration commands (D0 - D9, P0 - P2).
Pin command parameter | Description |
---|---|
0 | Unmonitored digital input |
1 | Reserved for pin-specific alternate functionality |
2 | Analog input (A/D pins) or PWM output (PWM pins) |
3 | Digital input, monitored |
4 | Digital output, low |
5 | Digital output, high |
6-9 | Alternate functionality, where applicable |
The following table provides the pin configurations when you set the configuration command for a particular pin.
Device pin name | Device pin number | Configuration command |
---|---|---|
DIO12 | 5 |
P2 |
PWM0 / RSSI / DIO10 | 7 |
P0 |
PWM1 / DIO11 | 8 |
P1 |
DTR / SLEEP_RQ / DIO8 |
10 |
D8 |
DIO4 | 24 |
D4 |
CTS / DIO7 |
25 |
D7 |
ON/SLEEP / DIO9 | 26 |
D9 |
ASSOC / AD5 / DIO5 | 15 |
D5 |
RTS / DIO6 |
29 |
D6 |
AD3 / DIO3 | 30 |
D3 |
AD2 / DIO2 | 31 |
D2 |
AD1 / DIO1 | 32 |
D1 |
AD0 / DIO0 / Commissioning Pushbutton | 33 |
D0 |
Use the PR command to enable internal pull up/down resistors for each digital input. Use the PD command to determine the direction of the internal pull up/down resistor.
Queried sampling
You can use the IS command to query the current state of all digital input and ADC lines on the device. If no inputs are defined, the command returns with an ERROR.
If you send the IS command from Command mode, then the device returns a carriage return delimited list containing the following fields.
Field | Name | Description |
---|---|---|
1 | Sample sets | Number of sample sets in the packet. Always set to 1. |
2 | Digital channel mask |
Indicates which digital I/O lines have sampling enabled. Each bit corresponds to one digital I/O line on the device.
For example, a digital channel mask of 0x002F means DIO0,1,2,3, and 5 are enabled as digital I/O. |
1 | Analog channel mask |
Indicates which lines have analog inputs enabled for sampling. Each bit in the analog channel mask corresponds to one analog input channel.
|
Variable | Sampled data set |
If you enable any digital I/O lines, the first two bytes of the data set indicate the state of all enabled digital I/O. Only digital channels that you enable in the Digital channel mask bytes have any meaning in the sample set. If do not enable any digital I/O on the device, it omits these two bytes. Following the digital I/O data (if there is any), each enabled analog channel returns two bytes. The data starts with AIN0 and continues sequentially for each enabled analog input channel up to AIN5. |
If you issue the IS command using a a local or remote AT Command API frame, then the device returns an AT Command Response (0x88) frame with the I/O data included in the command data portion of the packet.
Example | Sample AT response |
---|---|
0x01 | [1 sample set] |
0x0C0C | [Digital Inputs: DIO 2, 3, 10, 11 enabled] |
0x03 | [Analog Inputs: A/D 0, 1 enabled] |
0x0408 | [Digital input states: DIO 3, 10 high, DIO 2, 11 low] |
0x03D0 | [Analog input: ADIO 0 = 0x3D0] |
0x0124 | [Analog input: ADIO 1 =0x120] |