I know the 18X is now totally yesteryear but I still have some lying around, and I'm sure others will.
I had difficulty interfacing an i2c pressure sensor with an 18X (firmware v8.8), and read about others on the forum reporting similar problems in the past. I probed the SDA and SCL lines with a scope (oscilloscope) and noticed an unusual blip before the start condition. I then tried the same code on the 18M2 and it gave a much better i2c signal, without any blips.
The sensor's datasheet quoted the i2c address of 0x28, so I tried both 0x28 and 0x50 on both PICAXES. The slave address is actually 0x50 in the hi2csetup command, i.e. 0x28 left-shifted by 1, so this is an important point for those trying to use 3rd party i2c devices.
The i2c sensor only worked with the 18M2, not the 18X, probably because:
1) the Blip before the start condition confused the sensor,
2) and the 18X's i2c actually ran slower at 33kHz, and in the 'absolute maximum' section in the datasheet, it strangely said the minimum i2c speed is 100kHz (and the max is 400kHz as expected). 33kHz could have been too slow.
Attached are the waveforms I have captured from the 18X and 18M2, without the sensor connected (the sensor is currently wired into a pump controller circuit and working).
I had difficulty interfacing an i2c pressure sensor with an 18X (firmware v8.8), and read about others on the forum reporting similar problems in the past. I probed the SDA and SCL lines with a scope (oscilloscope) and noticed an unusual blip before the start condition. I then tried the same code on the 18M2 and it gave a much better i2c signal, without any blips.
The sensor's datasheet quoted the i2c address of 0x28, so I tried both 0x28 and 0x50 on both PICAXES. The slave address is actually 0x50 in the hi2csetup command, i.e. 0x28 left-shifted by 1, so this is an important point for those trying to use 3rd party i2c devices.
The i2c sensor only worked with the 18M2, not the 18X, probably because:
1) the Blip before the start condition confused the sensor,
2) and the 18X's i2c actually ran slower at 33kHz, and in the 'absolute maximum' section in the datasheet, it strangely said the minimum i2c speed is 100kHz (and the max is 400kHz as expected). 33kHz could have been too slow.
Attached are the waveforms I have captured from the 18X and 18M2, without the sensor connected (the sensor is currently wired into a pump controller circuit and working).
Code:
#no_data
hi2csetup i2cmaster, 0x50, i2cslow, i2cbyte
main:
hi2cin (b3, b2) 'no address byte needed
sertxd (#w1, 13, 10)
pause 490
goto main
Attachments
-
6.8 KB Views: 28
-
8.8 KB Views: 26