3.2.3. SET FUNCTION
Is used to set the I/O function on the module.
Byte
Count
Command
Parameter
Host
Command
5
0x10
PORT
ANALOG
DIRECT
PULL-UP
Module
Response
1
0xAA
-
0xEE
-
PORT parameter is the port code that will be accessed. 0 represents Analog
Input, 1 represents Digital I/O, and 2 represents General Purpose I/O.
ANALOG parameter represents 8 bits in 1 port. Each bit is cleared (0) when
used as digital i/o or set (1) when used as analog input. When the bit is set (1),
then DIRECT and PULL-UP parameters for that bit will be ignored. This
parameter only applies for PORT 0.
DIRECT parameter represents 8 bits (or 5 bits on General Purpose I/O) in 1
port. Each bit is cleared (0) when used as input or set (1) when used as output.
PULL-UP parameter represents 8 bits (or 5 bits on General Purpose I/O) in 1
port. Each bit is cleared (0) to put the represented pin on three-state/low
condition, or set (1) to activate its internal pull up resistor.
This setting will be saved in EEPROM so it will not be erased when module is
powered off.
If packet is recognized and correct, module will respond with ACK (0xAA).
If the packet is false/not recognized, module will respond with NACK (0xEE).
Example:
PC
: 0x58 0x05 0x10 0x01 0x00 0xF0 0x0F 0x93
USB Smart I/O
: 0x58 0x01 0xAA 0xFD
will use Digital I/O bit 4-7 as output lines with 0 values, while bit 0-3 as input
lines with active internal pull up resistors.
3.2.4. GET FUNCTION
Is used to read I/O function settings on the module.
Byte Count Command
Parameter
Host
Command
2
0x11
PORT
Module
Response
4
0x11
ANALOG
DIRECT
PULL-UP
1
0xEE
-
PORT parameter is the port code that will be accessed. 0 represents Analog
Input, 1 represents Digital I/O, and 2 represents General Purpose I/O.
ANALOG parameter represents 8 bits in 1 port. Each bit is cleared (0) when
used as digital i/o or set (1) when used as analog input. When the bit is set (1),
then DIRECT and PULL-UP parameters for that bit must be ignored. This
parameter only applies for PORT 0.
DIRECT parameter represents 8 bits (or 5 bits on General Purpose I/O) in 1
port. Each bit is cleared (0) when used as input or set (1) when used as output.
PULL-UP parameter represents 8 bits (or 5 bits on General Purpose I/O) in 1
port. Each bit is cleared (0) if the represented pin is on three-state/low
condition, or set (1) if the internal pull up resistor on the pin is active.
If packet is recognized and correct, module will respond with EEPROM reading
data result.
9