diff --git a/src/main.c b/src/main.c index bde47a1..0452906 100644 --- a/src/main.c +++ b/src/main.c @@ -108,6 +108,8 @@ int main() //time - 36 bits result + uint16_t receivedData; + alt_putstr("KCC Project!\n"); // register the timer irq to be serviced by handle_timer_interrupt() function @@ -115,7 +117,10 @@ int main() while (1) { - SendLong(time); + receivedData=ReceiveData(); + if(receivedData==66){ + SendLong(time); + } PIO_SetBit(LED_PORT, LED_0); delayMs(400); diff --git a/src/uart.c b/src/uart.c index 985a98c..2a42e70 100644 --- a/src/uart.c +++ b/src/uart.c @@ -15,6 +15,11 @@ static void sendByte(char byte) IOWR_ALT_UP_RS232_DATA(UART_0_BASE, byte); } +uint16_t ReceiveData(USART_TypeDef* USARTx){ + + IORD_ALT_UP_RS232_DATA(UART_0_BASE); +} + void sendStrig(char* s) { while(*s)