⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 8-bit unipolar successive approximation adc.vhd

📁 含有各类寄存器
💻 VHD
字号:
--8-bit Unipolar Successive Approximation ADC--8-bit unipolar successive approximation analogue to digital converter--demonstrates use of LOOP and WAIT statementsENTITY adcsc8 ISPORT(vin : IN REAL RANGE 0.0 TO +5.0; --unipolar analogue inputdigout : OUT BIT_VECTOR(7 DOWNTO 0); --digital outputclock, sc : IN BIT; busy : OUT BIT); --clock & controlEND adcsc8;ARCHITECTURE behaviour OF adcsc8 ISSIGNAL v_estimate : REAL RANGE 0.0 TO +5.0;BEGINPROCESSCONSTANT v_lsb : REAL := 5.0/256; --least significant bit valueBEGINWAIT UNTIL (sc'EVENT AND sc = '0'); --falling edge on sc starts convv_estimate <= 0.0; --initialise v_estimatedigout <= "00000000"; --clear SAR registerbusy <= '1'; --flag converter busyFOR i IN digout'RANGE LOOP --loop for each output bitWAIT UNTIL (clock'EVENT AND clock = '1');v_estimate <= v_estimate + (REAL(2**i))*v_lsb;digout(i) <= '1';WAIT UNTIL (clock'EVENT AND clock = '1');IF v_estimate >= vin THENv_estimate <= v_estimate - (REAL(2**i))*v_lsb;digout(i) <= '0';END IF;END LOOP;busy <= '0'; --flag end of conversionEND PROCESS;END behaviour;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -