Is there a bug or restriction in the HI2CSetup command that means address $00 cant be used? When I use $00 the code seems to reset.
I am trying to use I2C communication to the AS3935 Franklin Lightning module. In the code below, when I set the address=0 for the I2C communication, the code resets and produces the following
If I change the address in the HI2CSETUP to any other number but 0 then I get the following ...
example Arduino code which i assume works.
From the datasheet for the AS3935 inthe section on the I2C addressing. The Break-out-board has the ADD0 and ADD1 to GND.
I am trying to use I2C communication to the AS3935 Franklin Lightning module. In the code below, when I set the address=0 for the I2C communication, the code resets and produces the following
Code:
OK .
OK .
OK .
OK .
OK .
Code:
OK .
ok
tco=255
tco=255
f=0
f=0
f=0
Code:
#picaxe 28x2
#terminal 19200
#SLOT 0
#no_data
#no_table
setfreq EM16
pause 1000
sertxd("OK .",cr,lf)
pause 100
hi2csetup i2cmaster, $00, i2cfast_16, i2cword 'address is zero
pause 100
sertxd("ok",cr,lf)
hi2cin $00, (B0) 'read tuning cap value
sertxd("tco=",#b0,cr,lf)
hi2cout $3C, ($96) ; Sets all registers in default mode
hi2cout $3D, ($96) ; Calibrates automatically the internal RC Oscillators
hi2cout $03, (%00000000) ; set freq div to 16 for tuning
hi2cout $08, (%10000000) ; set LCO to out on INT
pause 100
hi2cin $00,(B0) 'read tuning cap value
sertxd("tco=",#b0,cr,lf)
do
count b.0 , 1000 ,w0
sertxd("f=",#W0,cr,lf)
pause 4000
loop
Code:
#define ADDR 0x00 //chip i2c address
From the datasheet for the AS3935 inthe section on the I2C addressing. The Break-out-board has the ADD0 and ADD1 to GND.
An I²C slave interface is implemented for read/write access to the internal registers and to send direct commands. To enable the I²C as interface,
the Select Interface pin has to be set to the positive voltage supply (SI=VDD). The I2CL is the clock bus, while the I2CD is the data bus. An
external pull-up resistor on the I2CL pin is needed.
The device addresses for the AS3935 in read or write mode are defined by:
0-0-0-0-0-a1-a0-0: write mode device address (DW)
0-0-0-0-0-a1-a0-1: read mode device address (DR)
Where a0 and a1 are defined by the pins 5 (ADD0) and 6 (ADD1).