Nios® V Processor Software Developer Handbook

ID 743810
Date 7/08/2024
Public
Document Table of Contents

7.6.2. General Access to Character Mode Devices

Accessing a character-mode device other than stdin, stdout, or stderr is as easy as opening and writing to a file.

Writing Characters to a UART Called uart1

#include <stdio.h>
#include <string.h>
int main (void)
{
char* msg = "hello world";
FILE* fp;
fp = fopen ("/dev/uart1", "w");
if (fp!=NULL)
{
fprintf(fp, "%s",msg);
fclose (fp);
}
return 0;
}