Skip to content
Snippets Groups Projects
main.c 751 B
Newer Older
#include "myorca_uart.h"

// Main must be the first function body in this file
int main(void)
{
  static int data1 = 20;
  static int data2 = 5;
  static int result;

  result = data1 * data2;

  // Store the value in a6
  asm volatile("mv a6,%0\n\t"
               "rdtime a5"
    :
    : "r" (result)
    : "a6");


  uart_printf("M\r\n");

  unsigned int uart_send_fifo_count = uart_get_send_fifo_count();

  unsigned int uart_read_fifo_count = 0;
  while (1) {
    wait(1000);
    uart_read_fifo_count = uart_get_read_fifo_count();
    if (uart_read_fifo_count > 0) {
      char read_value = uart_read_char();
      uart_printf("Received value from Uart: (");
      uart_printc(read_value);
      uart_printf(").\r\n");
    }
  }

  return 0;
}