Altera_Forum
Honored Contributor
16 years agoa strange appearance of UART
This is the uart programme in NIOSII IDE Technical Documentation
The output shows in console(see below),but I think it should be shown in seriel port debugger, I try changing property in 'RUN' option ,but cannot make it. I tried one day :( , I hope someone can help me ,thanks !! # include <stdio.h># include <string.h> # include <system.h> int main() { char *msg="detected character't'.\n"; FILE *fp; char prompt=0; printf("please enter characters:\n"); fp=fopen("/dev/uart","r+"); if(fp) { while(prompt!='v') { prompt=getc(fp); if(prompt=='t') { fwrite(msg,strlen(msg),1,fp); } if(ferror(fp)) clearerr(fp); } fprintf(fp,"closing uart file handle.\n"); fclose(fp); } else { printf("fail to open file\n"); } return 0; } It is right which the console shows: nios2-terminal: connected to hardware target using UART on /dev/com1 at 9600 bau d nios2-terminal: (Use the IDE stop button or Ctrl-C to terminate) please enter characters: abct abcv closing uart file handle. BUT I DONNOT KNOW WHY IT SHOWS THERE ,only I KNOW when use JTAG_UART,It will show below console???