# HG changeset patch # User Malte Bayer # Date 1322746879 -3600 # Node ID ba4f69250592f5ad53a04a7bfa67c70e630f65e0 # Parent d4235895fdbc2ef17141a27bae2852ab6fc886f8 shark: fixed uart bug diff -r d4235895fdbc -r ba4f69250592 carrerashark/Makefile --- a/carrerashark/Makefile Thu Dec 01 14:17:21 2011 +0100 +++ b/carrerashark/Makefile Thu Dec 01 14:41:19 2011 +0100 @@ -9,7 +9,7 @@ F_CPU = 8000000 -BAUD=38400 +BAUD=115200 ISP_BAUD = 115200 #SRC = main.c seriald.c driver/ADC.c driver/clock.c driver/timer.c diff -r d4235895fdbc -r ba4f69250592 carrerashark/main.c --- a/carrerashark/main.c Thu Dec 01 14:17:21 2011 +0100 +++ b/carrerashark/main.c Thu Dec 01 14:41:19 2011 +0100 @@ -110,7 +110,9 @@ int main(void) { uint8_t i; - unsigned char s[30]; + unsigned char s[10]; + uint16_t tmp; + uint16_t cycle[11]; // setup data bit timer TCCR2 = (1< 5) { + tmp = data; + data = 0; if (data_len == 13) { // sync to first packet - i = 1; - RS232_puts("\n"); PORTD ^= _BV(PD5); - } else if (i!=0) i++; - if (i>0) { - itoa( data, s, 16); - data = 0; - RS232_puts("0x"); - RS232_puts( s ); - RS232_putc(' '); + for (i=0; i<10;i++ ) { + // output previous cycle data + itoa( cycle[i], s, 16); + RS232_putc('0'); + RS232_putc('x'); + RS232_puts( s ); + RS232_putc(' '); + } + RS232_putc('\n'); + i = 0; + PORTD ^= _BV(PD5); } + cycle[i] = tmp; + i++; } //if (i==10) for (;;); }