I'm doing something wrong in interfacing a PICAXE 18-X to an infrared distance sensor. Can anyone help?
1. The sensor is a HVW Technologies "I2C-IR" device (http://www.hvwtech.com/products_view.asp?ProductID=665) which has an i2C interface.
2. I'm connecting to a PICAXE 18X using a PICAXE EXPERIMENTER BOARD (AXE090). It has a breadboard section, and places for 8, 18, and 24 pin devices.
3. Power is 3 AA batteries, so 4.5V
4. There are four lines between the board and the device: +ve, GND, data and clk. The i2c lines are connected to the 18X as follows: Data to "Output 1" (pin 7), and Clock to "Output 4" (pin 10). The i2C lines have 2.2K pull-up resistors to the +ve line.
5. The code in question looks like this:
6. The only value I get in b0 is "255". Something is going wrong somewhere, but I'm not sure where.
Any advice would be great!
Thanks,
Chris
1. The sensor is a HVW Technologies "I2C-IR" device (http://www.hvwtech.com/products_view.asp?ProductID=665) which has an i2C interface.
2. I'm connecting to a PICAXE 18X using a PICAXE EXPERIMENTER BOARD (AXE090). It has a breadboard section, and places for 8, 18, and 24 pin devices.
3. Power is 3 AA batteries, so 4.5V
4. There are four lines between the board and the device: +ve, GND, data and clk. The i2c lines are connected to the 18X as follows: Data to "Output 1" (pin 7), and Clock to "Output 4" (pin 10). The i2C lines have 2.2K pull-up resistors to the +ve line.
5. The code in question looks like this:
Code:
i2cslave %01000000, i2cslow, i2cbyte
i2cread 1, (b0)
Any advice would be great!
Thanks,
Chris
Attachments
-
852.6 KB Views: 27
Last edited: