51,23 → 51,6 |
} |
} |
|
void test_mode() //Testovaci mod stopek |
{ |
printf(lcd_putc,"\f TEST MODE"); |
lcd_gotoxy(1,2); |
printf(lcd_putc,"ESC"); |
while(input(BUTTON1)) // testuje dokud nekdo nezmackne tlacitlo |
{ |
lcd_gotoxy(5,2); |
delay_ms(100); |
printf(lcd_putc,"%x ",input_b()); |
} |
} |
void send_measuring() |
{ |
printf(usb_cdc_putc, "\n\r %5lu %5lu %5lu %5lu %5lu", run, section[0], section[1], section[2], section[3]); |
} //*0.000010667 |
|
void main() |
{ |
setup_adc_ports(NO_ANALOGS|VSS_VDD); |
93,14 → 76,19 |
lcd_gotoxy(1,2); |
printf(lcd_putc," Kaklik 2010"); |
delay_ms(1000); |
lcd_gotoxy(1,1); |
printf(lcd_putc,"\f Waiting for PC... "); |
|
while (TRUE) |
{ |
|
printf(lcd_putc,"\fWaiting for PC... "); |
lcd_gotoxy(1,2); |
printf(lcd_putc,"TEST"); |
|
while(!usb_cdc_connected()) if(!input(BUTTON1)) test_mode(); // pockej nez se pripoji seriovy port PC |
|
lcd_gotoxy(1,1); |
printf(lcd_putc,"sensors:"); |
while(!usb_cdc_connected()) // pockej nez se pripoji seriovy port PC |
{ |
lcd_gotoxy(10,2); |
printf(lcd_putc," %x",input_b()); |
delay_ms(100); |
} |
printf(lcd_putc,"\f PC connected..."); |
beep(10); |
|
109,9 → 97,9 |
section[1] = 0; |
section[2] = 0; |
section[3] = 0; |
|
while (TRUE) |
{ |
|
while(usb_cdc_connected()) // pockej nez se pripoji seriovy port PC |
{ |
run++; |
printf(lcd_putc,"\f\nSTART"); |
|
123,7 → 111,8 |
set_timer0(0); |
while((input(STOP1)) && (input(BUTTON2))) |
section[0] = (time << 16) + get_timer0(); |
|
send_measuring(); |
// odesli namerene hodnoty |
printf(usb_cdc_putc, "\n\r %5lu %5.0f %5lu %5lu %5lu", run, section[0]/15.625, section[1], section[2], section[3]); |
} |
} |
} |