| Line 63... |
Line 63... |
| 63 |
} |
63 |
} |
| 64 |
|
64 |
|
| 65 |
void test_mode() |
65 |
void test_mode() |
| 66 |
{ |
66 |
{ |
| 67 |
lcd_gotoxy(1,1); |
67 |
lcd_gotoxy(1,1); |
| 68 |
printf(lcd_putc,"TEST MODE"); |
68 |
printf(lcd_putc,"\f TEST MODE"); |
| 69 |
} |
69 |
} |
| 70 |
|
70 |
|
| 71 |
void main() { |
71 |
void main() { |
| 72 |
|
72 |
|
| 73 |
setup_adc_ports(NO_ANALOGS|VSS_VDD); |
73 |
setup_adc_ports(NO_ANALOGS|VSS_VDD); |
| Line 86... |
Line 86... |
| 86 |
|
86 |
|
| 87 |
lcd_init(); |
87 |
lcd_init(); |
| 88 |
usb_init(); |
88 |
usb_init(); |
| 89 |
|
89 |
|
| 90 |
lcd_gotoxy(1,1); |
90 |
lcd_gotoxy(1,1); |
| 91 |
printf(lcd_putc,"STOPWATCH01A"); |
91 |
printf(lcd_putc,"\f STOPWATCH01A"); |
| 92 |
lcd_gotoxy(1,2); |
92 |
lcd_gotoxy(1,2); |
| 93 |
printf(lcd_putc," Kaklik 2010 "); |
93 |
printf(lcd_putc," Kaklik 2010 "); |
| 94 |
delay_ms(1000); |
94 |
delay_ms(1000); |
| 95 |
lcd_gotoxy(1,1); |
95 |
lcd_gotoxy(1,1); |
| 96 |
printf(lcd_putc,"\n Waiting for PC... "); |
96 |
printf(lcd_putc,"\f Waiting for PC... "); |
| 97 |
|
97 |
|
| 98 |
while(!usb_cdc_connected()); |
98 |
while(!usb_cdc_connected()); |
| 99 |
lcd_gotoxy(1,1); |
99 |
lcd_gotoxy(1,1); |
| 100 |
printf(lcd_putc,"PC connected..."); |
100 |
printf(lcd_putc,"\f PC connected..."); |
| 101 |
beep(10); |
101 |
beep(10); |
| 102 |
|
102 |
|
| 103 |
if(!input(BUTTON1)) test_mode(); |
103 |
if(!input(BUTTON1)) test_mode(); |
| 104 |
run=0; |
104 |
run=0; |
| 105 |
|
105 |
|
| Line 111... |
Line 111... |
| 111 |
|
111 |
|
| 112 |
while (TRUE) |
112 |
while (TRUE) |
| 113 |
{ |
113 |
{ |
| 114 |
run++; |
114 |
run++; |
| 115 |
lcd_gotoxy(3,1); |
115 |
lcd_gotoxy(3,1); |
| 116 |
printf(lcd_putc,"START"); |
116 |
printf(lcd_putc,"\f START"); |
| 117 |
|
117 |
|
| 118 |
while(input(BUTTON2)); |
118 |
while(input(BUTTON2)); |
| 119 |
time = 0; |
119 |
time = 0; |
| 120 |
set_timer0(0); |
120 |
set_timer0(0); |
| 121 |
position = 0; |
121 |
position = 0; |
| Line 124... |
Line 124... |
| 124 |
clear_interrupt(int_RB); |
124 |
clear_interrupt(int_RB); |
| 125 |
enable_interrupts(INT_RTCC); |
125 |
enable_interrupts(INT_RTCC); |
| 126 |
enable_interrupts(INT_RB); |
126 |
enable_interrupts(INT_RB); |
| 127 |
|
127 |
|
| 128 |
lcd_gotoxy(6,1); |
128 |
lcd_gotoxy(6,1); |
| 129 |
printf(lcd_putc,"STOP"); |
129 |
printf(lcd_putc,"\f STOP"); |
| 130 |
while(state==RUNNING); |
130 |
while(state==RUNNING); |
| 131 |
|
131 |
|
| 132 |
|
132 |
|
| 133 |
printf(usb_cdc_putc, "\n\r %ld %ld %ld %ld %ld", run, section[0], section[1], section[2], section[3]); |
133 |
printf(usb_cdc_putc, "\n\r %ld %ld %ld %ld %ld", run, section[0], section[1], section[2], section[3]); |
| 134 |
} |
134 |
} |