There are 19 GPIO pins numbered 0 to 18. Additionally there is an special purpose IO pin 19,
which is connected to the onboard LED on the U4B. If you specify a pin number higher than 19,
the OUT command has no effect.
Example:
OUT 5, 1
Sets the value of GPIO pin 5, to 1 (high, means 3.3V).
OUT 3, 0
Sets the value of GPIO pin 3, to 0 (low, means 0.0V).
OUT 19, CL
Sets the LED state to the value of CL. CL is a global variable which is 1 if the last GPS statement
resulted in a successfully completed calibration. So this example switches on the LED if the GPS
calibration was successful.
4.9.7 I2CW, I2CW16 statements
Writes to a device attached to the I2C bus. Some devices have 8-bit registers (such as the
Si5351A and LM75 chips), others have a much larger register space and a 16-bit address format
(such as the I2C serial EEPROM chip). I2CW is for 8-bit devices. I2CW16 is for 16-bit devices.
Syntax:
I2CW <device address expression> <register address expression> <value expression>
I2CW16 <device address expression> <register address expression> <value expression>
Both addresses are expressed as decimal values and are expressions. The value expression is
sent as an 8-bit value (1 byte) which is decimal 0 to 255. Larger numbers are sent modulus 256.
The U4B has three existing devices attached to its I2C bus. You may add additional I2C sensors.
The additional device addresses must not conflict with the existing three devices on the bus.
Existing U4B I2C devices:
Address
Device
160
EEPROM, lower half of 128KByte chip, 16-bit register address
162
EEPROM, upper half of 128KByte chip, 16-bit register address
192
Si5351A (Synthesizer chip), 8-bit register address
144
LM75 (Temperature sensor), 8-bit register address
It should be noted that the I2C bus address is often specified as a 7-bit value; this 7-bit value is put
in the most significant bits of a byte, and the least significant bit is set to 0 for a Write operation or
1 for a Read operation. The <device address> parameter expected by the I2CR/I2CR16 functions
is an 8-bit value which is really the Write operation 8-bit address. Therefore if your device specifies
a 7-bit I2C address, you should multiply this by 2 for use in these functions.
Examples:
I2CW 129 5 48
Writes value 48 to register 5 of I2C device at address 129.
U4B operating manual Rev 1.00
45
Содержание U4B Ultimate4
Страница 54: ...U4B operating manual Rev 1 00 54...