Subversion Repositories svnkaklik

Compare Revisions

Ignore whitespace Rev 199 → Rev 254

/programy/PIC_C/PICcam/873/camerus.c
1,6 → 1,8
#include ".\camerus.h"
 
#define CAMERA_ADR 0xC4
 
 
void main()
{
setup_adc_ports(NO_ANALOGS);
11,7 → 13,7
 
output_high(PIN_C0);
output_low(PIN_C6);
 
Delay_ms(200);
output_low(PIN_C0);
Delay_ms(200);
18,7 → 20,7
output_high(PIN_C0);
 
i2c_start(); // Reset
i2c_write(0xC0);
i2c_write(CAMERA_ADR);
i2c_write(0x12);
i2c_write(0x80 | 0x24);
i2c_stop();
25,34 → 27,34
 
// **** Write data => Adr($13) = 0x05 ****
// This will tri-state the Y and UV busses on the OV6620, which
// will allow re-programming of the mega8 to proceed at startup
// will allow re-programming of the atmega8 to proceed at startup
// if needed.
 
i2c_start();
i2c_write(0xC0);
i2c_start();
i2c_write(CAMERA_ADR);
i2c_write(0x13);
i2c_write(0x05);
i2c_stop();
 
Delay_ms(250);
 
//**** Write data => Adr($3F) = 0x42 ****
// This will turn on the external clock for the mega8 to use.
// This will turn on the external clock for the atmega8 to use.
 
i2c_start();
i2c_write(0xC0);
i2c_start();
i2c_write(CAMERA_ADR);
i2c_write(0x3F);
i2c_write(0x42);
i2c_stop();
 
// Wait for a short amount of time for the external clock
// to stabilize
// to stabilize
 
Delay_ms(250);
 
 
output_low(PIN_C0);
 
// turn on the mega8 by releasing the reset line
output_high(PIN_C6);