Altera_Forum
Honored Contributor
7 years agoHow to read the Qsys ADC component data register in C directly
I have a Qsys design with NIOS2 C program. The program will read the Altera ADC component of the Qsys system (Max10 on-chip ADC) as each data point becomes ready. The simplest scenario. No 'sample train' or sequencer required. Just check for new ADC value and read the value in the data register. I have the ADC configured in Qsys for dedicated input on ANIN, channel 0.
Based on my understanding of a similar enquiry here in another thread, http://www.alteraforum.com/forum/showthread.php?t=57979 I am wondering if ADC read is as simple as 'knowing the ADC data register address to read from, and reading it using a pointer'. The pages I am reading look to suggest that, to read a Qsys IP register address, we can simply do the following: For example, let's say my ADC value register in Qsys is at mem location 0x5000. step 1: initialize a pointer to the data address of ADC register as - " int *adc_data = 0x5000; " step 2: Read data using - " ADC_value = adc_data[0]; " When I 'build' this is get a caution that "initialization makes pointer from integer without a cast [-Wint-conversion]". I'm not sure how to interpret the message, or my mistake, but it looks like I don't have it right yet. I'm hoping someone can help me understand the message in context, and provide a simple example if possible. Thanks,