11-15-2011 02:46 PM
Hi,Well it looks very stupid question for many people, but I am new to nios. I have used count binary templet to test my board and it is working fine.I can see the leds blinking and I can see the programm is running in console window. In one document I have seen I can read values from console window.What function should I use to read the data from console window (any key press from keyboard ).I am very new to microcontroller programing,so can some one sugest me to read some documents. Thanks in advance, Sarat
11-15-2011 03:39 PM
Yeah, all documents are good to read, depending on your interest, you can start with "intros" "tutorials" then end up with Handbooks for NIOSII or SW devniosii handbook n2cpu_nii5v1 (http://www.altera.com/literature/hb/nios2/n2cpu_nii5v1.pdf) niosii software handbook n2sw_nii5v2 (http://www.altera.com/literature/hb/nios2/n2sw_nii5v2.pdf) tt_qsys_intro (http://www.altera.com/literature/tt/tt_qsys_intro.pdf) but I guess you'll first begin with the manuals of your board. To answer your question, you can use a JTAG uart or real uart that you open on console window with "nios2-terminal" (see tutorials for more details). That makes you receive with NIOSII what you type on the console.
11-16-2011 08:54 AM
Hi,Thank you for your reply, I am just using scanf or getchar for reading from console.I am getting one error says "undefined refference to scanf".I strongly belive it is not the way to deal with microcontrollers.I have seen my ALT_STDIN_DEV is JTAG_UART in system.h file.so what I think is I have to use some built in function for altera devices (for example for displaying LEDs there is a function IOWR_ALTERA_AVALON_PIO_DATA( PIO_LED_BASE, dis ); ) . Where can I get information about these functions ? Can you please post me if you have some example programs (any example works on nios ). sarat
11-17-2011 09:34 AM
Hi,once you got the getchar() working, the rest is about c programming. About PIO's, I assume you already have a PIO component on your system (from the SOPC Library\peripherals\Microcontroller Peripherals), then you would just be writing on its base address and the PIOs would take the binary value of what you write. A good doc to start with if you still didn't look at: http://www.altera.com/literature/tt/tt_my_first_nios_sw.pdf (http://www.altera.com/literature/tt/tt_my_first_nios_sw.pdf)