| jacqueskleynhans 
 
 
 Joined: 10 Apr 2008
 Posts: 109
 Location: Cape Town, South Africa
 
 
			    
 
 | 
			
				| Will this work ?? (While loop related) |  
				|  Posted: Thu Oct 21, 2010 3:11 pm |   |  
				| 
 |  
				| Hi Guys, Can really test this code because I am @ home, only in the lab tomorrow. Just wondering if the while would cause inf loop. I am sending about 50 commands like this one But instead of adding a delay after the i2c stop i would rather check to see whether the device is still busy. ANy tips or comments ? 	  | Code: |  	  | write(OV5620_WRITE_ADDR, 0x12, 0x80); | 
 
 
 
  	  | Code: |  	  | int8 write(int8 cmd1,int8 cmd2,int8 cmd3) {
 while(!camera_ready());
 {
 i2c_start();
 i2c_write(int8 cmd1);
 i2c_write(int8 cmd2);
 i2c_write(int8 cmd3);
 i2c_stop();
 }
 }
 | 
 
 
  	  | Code: |  	  | int1 camera_ready() {
 int1 ack;
 i2c_start();            // If the write command is acknowledged,
 ack = i2c_write(0x60);  // then the device is ready.
 i2c_stop();
 return !ack;
 }
 
 | 
 
 Thanks.
 _________________
 "THE ONLY EASY DAY WAS YESTERDAY"
 |  |