Subversion Repositories svnkaklik

Rev

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

Rev 199 Rev 251
Line 1... Line 1...
1
#include ".\camerus.h"
1
#include ".\camerus.h"
2
 
2
 
-
 
3
#define  CAMERA_ADR   0xC4
-
 
4
 
3
 
5
 
4
void main()
6
void main()
5
{
7
{
6
   setup_adc_ports(NO_ANALOGS);
8
   setup_adc_ports(NO_ANALOGS);
7
   setup_adc(ADC_OFF);
9
   setup_adc(ADC_OFF);
Line 16... Line 18...
16
   output_low(PIN_C0);
18
   output_low(PIN_C0);
17
   Delay_ms(200);
19
   Delay_ms(200);
18
   output_high(PIN_C0);
20
   output_high(PIN_C0);
19
 
21
 
20
   i2c_start();      // Reset
22
   i2c_start();      // Reset
21
   i2c_write(0xC0);
23
   i2c_write(CAMERA_ADR);
22
   i2c_write(0x12);
24
   i2c_write(0x12);
23
   i2c_write(0x80 | 0x24);
25
   i2c_write(0x80 | 0x24);
24
   i2c_stop();
26
   i2c_stop();
25
 
27
 
26
// **** Write data => Adr($13) = 0x05 ****
28
// **** Write data => Adr($13) = 0x05 ****
27
// This will tri-state the Y and UV busses on the OV6620, which
29
// This will tri-state the Y and UV busses on the OV6620, which
28
// will allow re-programming of the mega8 to proceed at startup
30
// will allow re-programming of the atmega8 to proceed at startup
29
// if needed.
31
// if needed.
30
 
32
 
31
   i2c_start();      
33
   i2c_start();
32
   i2c_write(0xC0);
34
   i2c_write(CAMERA_ADR);
33
   i2c_write(0x13);
35
   i2c_write(0x13);
34
   i2c_write(0x05);
36
   i2c_write(0x05);
35
   i2c_stop();
37
   i2c_stop();
36
   
38
 
37
   Delay_ms(250);
39
   Delay_ms(250);
38
 
40
 
39
//**** Write data => Adr($3F) = 0x42 ****
41
//**** Write data => Adr($3F) = 0x42 ****
40
// This will turn on the external clock for the mega8 to use.
42
// This will turn on the external clock for the atmega8 to use.
41
 
43
 
42
   i2c_start();     
44
   i2c_start();
43
   i2c_write(0xC0);
45
   i2c_write(CAMERA_ADR);
44
   i2c_write(0x3F);
46
   i2c_write(0x3F);
45
   i2c_write(0x42);
47
   i2c_write(0x42);
46
   i2c_stop();
48
   i2c_stop();
47
   
49
 
48
// Wait for a short amount of time for the external clock
50
// Wait for a short amount of time for the external clock