Subversion Repositories svnkaklik

Rev

Rev 251 | Go to most recent revision | 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
   i2c_start();      // Reset
16
   i2c_write(0xC0);
17
   i2c_write(0x12);
18
   i2c_write(0x80 | 0x24);
19
   i2c_stop();
20
 
21
// **** Write data => Adr($13) = 0x05 ****
22
// This will tri-state the Y and UV busses on the OV6620, which
23
// will allow re-programming of the mega8 to proceed at startup
24
// if needed.
25
 
26
   i2c_start();      
27
   i2c_write(0xC0);
28
   i2c_write(0x13);
29
   i2c_write(0x05);
30
   i2c_stop();
31
 
32
   Delay_ms(250);
33
 
34
//**** Write data => Adr($3F) = 0x42 ****
35
// This will turn on the external clock for the mega8 to use.
36
 
37
   i2c_start();     
38
   i2c_write(0xC0);
39
   i2c_write(0x3F);
40
   i2c_write(0x42);
41
   i2c_stop();
42
 
43
// Wait for a short amount of time for the external clock
44
// to stabilize   
45
 
46
   Delay_ms(250);
47
 
48
 
49
   output_low(PIN_C0);
50
 
51
// turn on the mega8 by releasing the reset line
52
   output_high(PIN_C6);
53
 
54
   while(true);
55
}