/roboti/istrobot/camerus/SW/876/camerus.PJT |
---|
10,7 → 10,7 |
LinkerScript= |
[Target Data] |
FileList=C:\dokumenty\svn\Kaklik\roboti\istrobot\camerus\876\camerus.c |
FileList=C:\dokumenty\svn\Kaklik\roboti\istrobot\camerus\SW\876\camerus.c |
BuildTool=C-COMPILER |
OptionString=+FM |
AdditionalOptionString= |
31,11 → 31,12 |
0=0000 camerus.c 0 0 796 451 3 0 |
[Opened Files] |
1=C:\dokumenty\svn\Kaklik\roboti\istrobot\camerus\876\camerus.c |
2=C:\dokumenty\svn\Kaklik\roboti\istrobot\camerus\876\camerus.h |
3=C:\Program Files\PICC\devices\16F876A.h |
4= |
1=C:\dokumenty\svn\Kaklik\roboti\istrobot\camerus\SW\876\camerus.c |
2=C:\dokumenty\svn\Kaklik\roboti\istrobot\camerus\SW\876\camerus.lst |
3=C:\dokumenty\svn\Kaklik\roboti\istrobot\camerus\SW\876\camerus.h |
4=C:\Program Files\PICC\devices\16F876A.h |
5= |
6= |
[Units] |
Count=1 |
1=C:\dokumenty\svn\Kaklik\roboti\istrobot\camerus\876\camerus.c (main) |
1=C:\dokumenty\svn\Kaklik\roboti\istrobot\camerus\SW\876\camerus.c (main) |
/roboti/istrobot/camerus/SW/876/camerus.c |
---|
1,10 → 1,11 |
#include ".\camerus.h" |
#use fast_io (C) |
#USE FAST_IO (C) |
#define LED PIN_C0 |
#define HREF PIN_C5 |
#define PIX PIN_C6 |
#define SERVO PIN_B7 |
void main() |
{ |
14,13 → 15,13 |
setup_adc(ADC_CLOCK_INTERNAL); |
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); |
setup_timer_1(T1_DISABLED); |
setup_timer_2(T2_DIV_BY_16,62,1); |
setup_timer_2(T2_DIV_BY_16,255,1); |
setup_ccp1(CCP_PWM); // RC1 |
setup_ccp2(CCP_PWM); // RC2 |
setup_comparator(NC_NC_NC_NC); |
setup_vref(FALSE); |
set_tris_c(0x11111000); |
set_tris_c(0b11111000); |
output_high(LED); |
79,8 → 80,21 |
{ |
while(!input(HREF)); |
set_timer0(0); |
while(input(PIX)); |
set_pwm1_duty(get_timer0()); |
delay_ms(1); |
while(input(HREF)) |
{ |
if(!input(PIX)) |
{ |
cas=get_timer0(); |
break; |
} |
}; |
output_high(SERVO); |
delay_us(1000); |
delay_us(cas); |
delay_us(cas); |
delay_us(cas); |
output_LOW(SERVO); |
set_pwm1_duty(cas); |
set_pwm2_duty(255-cas); |
}; |
} |