5.5.3 Set Digital Input and Read Port (|I,<hex16>)
Format:
|I,<hex16>
Command |I configures the pin as digital input and reads the input level
of the pin in a single command execution. Command |I reads multiple
digital I/O values. It expects one input parameter of digital I/O ports to read. The
input parameter is the digital I/O pin bitmap in the 16-bit hex format. The following
table provides details about the I/O pin bitmap format. The response to command
|I is also a bitmap. If the corresponding pin to read is high, then
the bit in the response is set; otherwise, the bit is cleared.
| Bitmap | RNBD451 Pins |
|---|---|
| 0001 | GPIO_PIN_RA0 |
| 0002 | GPIO_PIN_RA1 |
| 0004 | Reserved |
| 0008 | Reserved |
| 0010 | GPIO_PIN_RA10 |
| 0020 | Reserved |
| 0040 | Reserved |
| 0080 | GPIO_PIN_RB8 |
| 0100 | GPIO_PIN_RB10 |
| 0200 | GPIO_PIN_RB11 |
| 0400 | GPIO_PIN_RB12 |
| 0800 | GPIO_PIN_RB13 |
| Example: | |I,0003
|
// Read digital I/O GPIO_PIN_RA0 and GPIO_PIN_RA1 // If the return value is 0002, then GPIO_PIN_RA0 is low and GPIO_PIN_RA1 is high |
| Response: | AOK | // Success |
Err | // Syntax error, invalid parameter |
