Subversion Repositories svnkaklik

Rev

Rev 228 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 228 Rev 229
Line 1... Line 1...
1
//********* Robot Camerus pro IstRobot 2007 ************
1
//********* Robot Camerus pro IstRobot 2007 ************
2
//"$Id: camerus.c 228 2007-04-08 21:36:13Z kakl $"
2
//"$Id: camerus.c 229 2007-04-09 11:41:19Z kakl $"
3
//*****************************************************
3
//*****************************************************
4
 
4
 
5
#include ".\camerus.h"
5
#include ".\camerus.h"
6
 
6
 
7
#USE FAST_IO (C)     // Brana C je ve FAST_IO modu, aby slo rychle cist z kamery
7
#USE FAST_IO (C)     // Brana C je ve FAST_IO modu, aby slo rychle cist z kamery
Line 219... Line 219...
219
 
219
 
220
   NightRider(1);    // Aby se poznalo, ze byl RESET
220
   NightRider(1);    // Aby se poznalo, ze byl RESET
221
                     // taky se musi pockat, nez se rozjede kamera, nez se do ni zacnou posilat prikazy
221
                     // taky se musi pockat, nez se rozjede kamera, nez se do ni zacnou posilat prikazy
222
 
222
 
223
   //... Nastaveni sonaru ...
223
   //... Nastaveni sonaru ...
224
   i2c_start();     
224
   i2c_start();
225
   i2c_write(0xE0);
225
   i2c_write(0xE0);
226
   i2c_write(0x02);  // dosah
226
   i2c_write(0x02);  // dosah
227
   i2c_write(0x02);  // 86mm
227
   i2c_write(0x03);  // n*43mm
228
   i2c_stop();
228
   i2c_stop();
229
   i2c_start();     
229
   i2c_start();
230
   i2c_write(0xE0);
230
   i2c_write(0xE0);
231
   i2c_write(0x01);  // zesileni
231
   i2c_write(0x01);  // zesileni
232
   i2c_write(0x00);
232
   i2c_write(0x01);  // male, pro eliminaci echa z minuleho mereni
233
   i2c_stop();
233
   i2c_stop();
-
 
234
   
-
 
235
// pro ladeni sonaru
-
 
236
/*
-
 
237
   while(true)
-
 
238
   {
-
 
239
         i2c_start();     // Sonar Ping
-
 
240
      i2c_write(0xE0);
-
 
241
      i2c_write(0x0);
-
 
242
      i2c_write(0x51);  // 50 mereni v palcich, 51 mereni v cm, 52 v us
-
 
243
      i2c_stop();
-
 
244
      delay_ms(100);
-
 
245
      i2c_start();     // Odraz ze sonaru
-
 
246
      i2c_write(0xE0);
-
 
247
      i2c_write(0x3);
-
 
248
      i2c_stop();
-
 
249
      i2c_start();
-
 
250
      i2c_write(0xE1);
-
 
251
      cas=i2c_read(0);
-
 
252
      i2c_stop();
-
 
253
      disp(cas);
-
 
254
   }
-
 
255
*/
234
 
256
 
235
   //... Nastaveni kamery ...
257
   //... Nastaveni kamery ...
236
   i2c_start();      // Soft RESET kamery
258
   i2c_start();      // Soft RESET kamery
237
   i2c_write(0xC0);        // Pro single slave musi mit vsechny zapisy adresu C0h
259
   i2c_write(0xC0);        // Pro single slave musi mit vsechny zapisy adresu C0h
238
   i2c_write(0x12);        // Adresa registru COMH
260
   i2c_write(0x12);        // Adresa registru COMH