Community
cancel
Showing results for 
Search instead for 
Did you mean: 
NNuti
Beginner
344 Views

How to receive bits (through RX) using the UART core?

So, I can't use the file pointer way to receive data via RX as is said in the UART core data sheet because the design wont fit in my 35 kB on chip memory (max I can designate).

 

That being said, I've found another way to receive information over RX but I only receive info as bytes and not bits. Is there a way I can recieve an 8 bit sequence and not a packaged byte that I need to decode?

 

Here's the code:

 

 

#include <stdio.h>

#include "altera_avalon_uart_regs.h"

#include "system.h"

#include <string.h>

 

int main()

{

   int incoming_character;

   int uart_status;

   char data = 0;

   IOWR(UART_0_BASE, 2, 0);

   while(1){

      while (!(uart_status = IORD(UART_0_BASE, 2) & 0x80));

      incoming_character = IORD(UART_0_BASE, 0);

 

      IOWR(UART_0_BASE, 1, incoming_character);

   }

 return 0;

}

 

 

Tags (1)
0 Kudos
0 Replies