Hi.

Has anyone used a Vishay VCNL4040 proximity sensor? I appear to behaving problems communicating to this
device via I2C. I have tried all weekend with no success. I am using a PIC18F26K22 @ 8MHz.

I've set the minimum registers (as per app note) as follows:

PS_CONF1 0x00000000 0x03 low byte

PS_CONF2 0x00001000 0x03 high byte

PS_CONF3 0x00000000 0x04 low byte

PS_MS 0x00000111 0x04 high byte

For the INT low I chose 0 and the INT high I chose 65535. I have the interrupt deselected any way but pu it in as the app note included it. All I am trying to do is read the PS_DATA_L byte and the PS_DATA_H byte but no go. Just zeros. I am using Picbasic Pro with the ic2write and i2cread command.

This is how I am writing to the registers.

I2CWrite PORTC.4,PORTC.3,%01100000,%00000011,[%00111110,%00001000 ] ' $03 command code
PAUSE 50 I2CWrite PORTC.4,PORTC.3,%01100000,%00000100,[%00000100,%00000111] '$04 command code
PAUSE 50
I2CWrite PORTC.4,PORTC.3,%01100000,%00000110,[%00000000,%00000000] '$06 command code
PAUSE 50
I2CWrite PORTC.4,PORTC.3,%01100000,%00000111,[%11111111,%11111111] '$07 command code
PAUSE 50

Just using "pause 50" to give some time to the prox sensor.



For reading the " PS_DATA_L byte and the PS_DATA_H byte " I did the following:

I2Cwrite PORTC.4,PORTC.3,%01100000,%00001000 '$08 command code
'PAUSE 50
I2Cread PORTC.4,PORTC.3,%01100001,[PS_DATA_L,PS_DATA_H]
PAUSE 50

Now when I read "PS_DATA_L" and " PS_DATA_H" variables I get zero. I have no idea what I am doing wrong. I have
talked to many I2C devices before. I have more info if needed. Thanks.

Please help