Hi again,
I changed my C code because it wasn't working good, so far my transmit/receive work's fine, the next step is to get the received message and compare it with a list of responses. but I couldn't do it. any ideas please??
# define RRDY 0x80
typedef volatile struct {
char send;
char rece;
int lenS;
int lenR;
}message;
void uart_receive_data(void)
{
int count=0;
message mess;
alt_u8 status;
status= IORD_ALTERA_AVALON_UART_STATUS(UART_BASE);
while((status & RRDY)==RRDY ) // check if reception ready
{
mess.rece=IORD_ALTERA_AVALON_UART_RXDATA(UART_BASE);//receive character
printf("%c",mess.rece); //print the character received
status= IORD_ALTERA_AVALON_UART_STATUS(UART_BASE); //update status register
count++;
}
}