Forum Discussion
Dolemy
New Contributor
3 years agoIOWR and IORD Problem (with Image)
Hello! I am having difficulty using the IOWR and IORD functions in NIOS II. I have created a custom Uart Tx IP and I want to communicate with my computer through it. then, I have included it in NI...
EBERLAZARE_I_Intel
Regular Contributor
3 years agoHi,
Can you also provide the C code and your project file? I am trying to understand your C code flow.
Dolemy
New Contributor
3 years agoHere is my C code.
//////////////////
#include "sys/alt_stdio.h"
#include <system.h>
#include <stdio.h>
#include <io.h>
#include <unistd.h>
/*void Uart_Tx(char ch)
{
IOWR(MY_UART_TX_0_BASE,0,0x41);
usleep(1000000);
printf("DATA: %c\n", IORD(MY_UART_TX_0_BASE,0));
}
*/
int main()
{
alt_putstr("Hello from Nios II!\n");
IOWR(MY_UART_TX_0_BASE,0,0xFF);
/* Event loop never exits. */
while (1){
IOWR(MY_UART_TX_0_BASE,0,0x42);
usleep(100000);
printf("DATA: %c\n", IORD(MY_UART_TX_0_BASE,0));
}
return 0;
}
//////////////////