Subversion Repositories svnkaklik

Rev

Details | Last modification | View Log

Rev Author Line No. Line
199 kaklik 1
#include ".\camerus.h"
2
 
3
 
4
void main()
5
{
6
   setup_adc_ports(NO_ANALOGS);
7
   setup_adc(ADC_OFF);
8
   setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
9
   setup_timer_1(T1_DISABLED);
10
   setup_timer_2(T2_DISABLED,0,1);
11
 
12
   output_high(PIN_C0);
13
   output_low(PIN_C6);
14
 
15
   Delay_ms(200);
16
   output_low(PIN_C0);
17
   Delay_ms(200);
18
   output_high(PIN_C0);
19
 
20
   i2c_start();      // Reset
21
   i2c_write(0xC0);
22
   i2c_write(0x12);
23
   i2c_write(0x80 | 0x24);
24
   i2c_stop();
25
 
26
// **** Write data => Adr($13) = 0x05 ****
27
// 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
29
// if needed.
30
 
31
   i2c_start();      
32
   i2c_write(0xC0);
33
   i2c_write(0x13);
34
   i2c_write(0x05);
35
   i2c_stop();
36
 
37
   Delay_ms(250);
38
 
39
//**** Write data => Adr($3F) = 0x42 ****
40
// This will turn on the external clock for the mega8 to use.
41
 
42
   i2c_start();     
43
   i2c_write(0xC0);
44
   i2c_write(0x3F);
45
   i2c_write(0x42);
46
   i2c_stop();
47
 
48
// Wait for a short amount of time for the external clock
49
// to stabilize   
50
 
51
   Delay_ms(250);
52
 
53
 
54
   output_low(PIN_C0);
55
 
56
// turn on the mega8 by releasing the reset line
57
   output_high(PIN_C6);
58
 
59
   while(true);
60
}