Subversion Repositories svnkaklik

Compare Revisions

Ignore whitespace Rev 151 → Rev 152

/roboti/istrobot/camerus/SW/876/camerus.c
33,6 → 33,8
 
output_high(LED);
 
delay_ms(200);
 
i2c_start(); // Reset
i2c_write(0xC0);
i2c_write(0x12);
45,11 → 47,13
i2c_write(0b01000001);
i2c_stop();
 
 
i2c_start(); // Contrast
i2c_write(0xC0);
i2c_write(0x05);
i2c_write(0xFF);
i2c_write(0xA0);
i2c_stop();
/*
 
i2c_start(); // Brightness
i2c_write(0xC0);
57,7 → 61,6
i2c_write(0x80);
i2c_stop();
 
/*
i2c_start(); // Band Filter
i2c_write(0xC0);
i2c_write(0x2D);
83,34 → 86,48
i2c_stop();
 
output_low(LED);
delay_ms(100);
 
/*
i2c_start(); // BW + freeze AGC/AEC
i2c_write(0xC0);
i2c_write(0x28);
i2c_write(0b01010001);
i2c_stop();
*/
output_high(LED);
delay_ms(100);
output_low(LED);
 
cas=128;
 
while(true)
{
while(!input(HREF));
// delay_cycles(4);
set_timer0(0);
while(input(HREF))
{
if(!input(PIX))
{
cas=get_timer0();
break;
}
if(!input(PIX))
if(!input(PIX))
{
cas=get_timer0();
cas=255-cas;
break;
};
};
 
cas=255-cas;
set_adc_channel(MODRA);
Delay_ms(1);
offset=read_adc();
output_high(SERVO);
delay_us(900);
delay_us(1000);
delay_us(offset);
delay_us(offset);
delay_us(cas);
delay_us(cas);
delay_us(cas);
output_LOW(SERVO);
// delay_us(cas);
output_low(SERVO);
set_pwm1_duty(cas);
set_pwm2_duty(255-cas);
};