Arrow DECA User Manual page 87

Table of Contents

Advertisement

IOWR(MODULAR_ADC_0_SEQUENCER_CSR_BASE, 0x00, 0x00); // Continued ADC
IOWR(MODULAR_ADC_0_SEQUENCER_CSR_BASE, 0x00, 0x01); // run
IOWR(MODULAR_ADC_1_SEQUENCER_CSR_BASE, 0x00, 0x00); // Continued ADC
IOWR(MODULAR_ADC_1_SEQUENCER_CSR_BASE, 0x00, 0x01); // run
The following statements reads the ADC value.
value_0 = IORD(MODULAR_ADC_0_SAMPLE_STORE_CSR_BASE, Slot) & 0xFFF; // 12-bit data
value_1 = IORD(MODULAR_ADC_1_SAMPLE_STORE_CSR_BASE, Slot) & 0xFFF; // 12-bit data
The following statements calculate the input and output voltage values.
Vo_0 = (float)value_0/4095.0*2.5; // 0~4095 mapping to 0~2.5V
Vin_0 = 5.0* Vo_0 - 6.25;
Vo_1 = (float)value_1/4095.0*2.5; // 0~4095 mapping to 0~2.5V
Vin_1 = 5.0* Vo_1 - 6.25;
 Demonstration Source Code
 Project directory: SMA_ADC_NIOS
 Bit stream: DECA.sof
 Demonstration Batch File
 Demo batch file folder: SMA_ADC_NIOS\demo_batch
 Batch file: test.bat
 FPGA configure file: DECA.sof
 Nios II program: adc_demo.elf
 Demonstration Setup
 Please make sure Quartus II and USB-Blaster II driver are installed on the host PC.
 Connect the USB cable from the USB-Blaster II port (J10) on the DECA board to the host PC.
DECA User Manual
86
www.terasic.com
May 22, 2015

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents