Hi all,
I got a question with this spectral engine and found this forum as apt to introduce it.
I hooked this sensor with my PIC16F using I2C communication. I am able to blink the inbuilt LED on the development board. But while reading the raw colour output values I am getting is 0X00 which means the sensor is not reading.
These are the lines from the AS7262 datasheet.
If BANK is set to Mode 0 or Mode 1 then the data is ready after
the 1st integration time. If BANK is set to Mode 2 or Mode 3 then
the data is ready after two integration times. If the interrupt is
enabled (INT = 1) then when the data is ready, the INT line is
pulled low and DATA_RDY is set to 1. The INT line is released
(returns high) when the control register is read. DATA_RDY is
cleared to 0 when any of the sensor registers V, B, G, Y, O & R are
read.
This is my code snippet.
//**-----------------------------------------------------------------------------------------------------------------------**//
//Write for Control Register
AS7262_write_status_check();
AS7262_write_control_reg(0x84);
AS7262_write_status_check();
AS7262_write_control_reg_data(0X7C);
while(RC5==1);
RB1=1;
////**-----------------------------------------------------------------------------------------------------------------------**//
//Read for Control Register
AS7262_read_status_check();
garbage=AS7262_read_control_reg_data();
AS7262_write_status_check();
AS7262_write_control_reg(0x04); // donot know 0x04 or 0x84 works for 0x04
AS7262_read_status_check();
control_Reg=AS7262_read_control_reg_data();
uart_Tx_dat(control_Reg);
while(RC5==0);
RB1=0;
//**-----------------------------------------------------------------------------------------------------------------------**//
// Read for Red High Raw Data
AS7262_write_status_check();
AS7262_write_raw_red_high(0X12);
AS7262_read_status_check();
RedH=AS7262_read_raw_red_high();
uart_Tx_dat(RedH);
if(control_Reg | 0b00000010 == 0)
RB1=0;
AS7262_write_status_check();
AS7262_write_raw_red_high(0X12);
AS7262_read_status_check();
RedH=AS7262_read_raw_red_high();
uart_Tx_dat(RedH);
I found that the second while loop condition is not being satisfied. Can anyone sort out this trouble? Any help will be appreciated