Author Topic: always 255 output on the sensor (pixart ir camera)  (Read 7039 times)

Offline exosubstance

  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
hi its my first post here, i've recently been working with the pixart sensor inside the wii remote however i can't seem to produce the appropriate results..

I'm using a pic18f4455 to interface with the wii sensor directly. The problem is the mcu is always returning 255 even with the sensor not attached.

Is there a way to test if the sensor is acknowledging the signal? or is it possible to test if the sensor itself is working? because it might also be a problem that the sensor itself is broken.

btw im using pullup resistors to the 3.3v and i2c buses.

im using the ff codes for initialization:

Code: [Select]
int8 p0,p1,p2,p3;
int8 SLAVE_DEVICE_ADDRESS = 0xB0
// Setup IR Sensivity
//00 00 00 00 00 00 90 00 41     40 00 //max
// p0=0x72; p1=0x20; p2=0x1F; p3=0x03; // Sensitivity 1
   p0=0xC8; p1=0x36; p2=0x35; p3=0x03; // 2
// p0=0xAA; p1=0x64; p2=0x63; p3=0x03; // 3
// p0=0x96; p1=0xB4; p2=0xB3; p3=0x04; // 4
// p0=0x96; p1=0xFE; p3=0xFE; p3=0x05; // 5
i2c_start();
i2c_write(SLAVE_DEVICE_ADDRESS); i2c_write(0x30); i2c_write(0x01);
i2c_stop();
delay_ms(100);

i2c_start();
i2c_write(SLAVE_DEVICE_ADDRESS);
i2c_write(0x00); i2c_write(0x02);
i2c_write(0x00); i2c_write(0x00);
i2c_write(0x71); i2c_write(0x01);
i2c_write(0x00); i2c_write(p0);
i2c_stop();
delay_ms(100);

i2c_start();
i2c_write(SLAVE_DEVICE_ADDRESS);
i2c_write(0x07); i2c_write(0x00);i2c_write(p1);
i2c_stop();
delay_ms(100);


i2c_start();
i2c_write(SLAVE_DEVICE_ADDRESS);
i2c_write(0x1A); i2c_write(p2);i2c_write(p3);
i2c_stop();
delay_ms(100);


i2c_start();
i2c_write(SLAVE_DEVICE_ADDRESS);
i2c_write(0x33); i2c_write(0x03);
i2c_stop();
delay_ms(100);

i2c_start();
i2c_write(SLAVE_DEVICE_ADDRESS); i2c_write(0x30); i2c_write(0x08);
i2c_stop();
delay_ms(100);

i hope some of you guys who have worked with PIC mcu's can help me..

thanks



Offline vpan7877

  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Reply #1 on: November 22, 2010, 08:18:42 PM
Did you get it working? I'm having a similar issue using the PIC16f877A. If you got it working I would be interested to have a look at your code.

~vpan7877