Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12599 Discussions

Reading ADC and writing to DAC from Nios C program - examples?

Honored Contributor II

Hi. First of all, thank you to Intel and Altera FPGA for the impressively extensive documentation, training lessons, and examples. :) 


I am just getting started with Altera/Intel FPGA system, but I've now completed a number of the available demos, and have successfully read from buttons and controlled leds from within running NIOS2 C program, on my Max10.50 Dev. Kit. 


I have added an ADC, and now need to read ADC data to a variable in the C code. 


Although I have found just about everything else documented or covered in online training, nothing comes up when i search for examples that include the Eclipse code for simply reading from ADC. It would be great to know i have all the right elements and include files in place, read/write syntax, etc., to do a simple 1 channel read to variable, either from interrupt, or by loop in main until ADC is not 'busy'. 


The customer training - AD conversion in the Max10 Device - - is top notch, and comes with a very helpful video walk through, to the point where ADC vales are printed to the LCD live. They skip over the compiling and any NIOS2 code required, and go straight to the finished demo showing display values. So the part they skipped over, the code for the NIOS is what i am interested in. Is there possibly a project folder for the above training, with Eclipse project?  


To summarize, i am wondering if there is C coding example (Eclipse project with .h etc.), that reads ADC value to a C variable, and or, writes a C variable to a DAC, or if anyone has an example handy to share.  



0 Kudos
0 Replies