一区二区三区三上|欧美在线视频五区|国产午夜无码在线观看视频|亚洲国产裸体网站|无码成年人影视|亚洲AV亚洲AV|成人开心激情五月|欧美性爱内射视频|超碰人人干人人上|一区二区无码三区亚洲人区久久精品

0
  • 聊天消息
  • 系統(tǒng)消息
  • 評論與回復
登錄后你可以
  • 下載海量資料
  • 學習在線課程
  • 觀看技術(shù)視頻
  • 寫文章/發(fā)帖/加入社區(qū)
會員中心
創(chuàng)作中心

完善資料讓更多小伙伴認識你,還能領取20積分哦,立即完善>

3天內(nèi)不再提示

FPGA上可以用一個比較器實現(xiàn)ADC的功能?2

jf_78858299 ? 來源:硬禾學堂 ? 作者:蘇老師 ? 2023-04-25 11:19 ? 次閱讀
加入交流群
微信小助手二維碼

掃碼添加小助手

加入工程師交流群

數(shù)字低通濾波器模塊,做平滑濾波

//*********************************************************************
//
//  'Box' Average 
//
//  Standard Mean Average Calculation
//   Can be modeled as FIR Low-Pass Filter where 
//   all coefficients are equal to '1'.
//
//*********************************************************************


module box_ave (
  clk,
  rstn,
  sample,
  raw_data_in,
  ave_data_out,
    data_out_valid);


parameter 
ADC_WIDTH = 8,        // ADC Convertor Bit Precision
LPF_DEPTH_BITS = 4;         // 2^LPF_DEPTH_BITS is decimation rate of averager


//input ports
input  clk;                                // sample rate clock
input  rstn;                              // async reset, asserted low
input  sample;                        // raw_data_in is good on rising edge, 
input  [ADC_WIDTH-1:0]  raw_data_in;    // raw_data input


//output ports
output [ADC_WIDTH-1:0]  ave_data_out;    // ave data output
output data_out_valid;                      // ave_data_out is valid, single pulse


reg [ADC_WIDTH-1:0]  ave_data_out;    
//**********************************************************************
//
//  Internal Wire & Reg Signals
//
//**********************************************************************
reg [ADC_WIDTH+LPF_DEPTH_BITS-1:0]      accum;          // accumulator
reg [LPF_DEPTH_BITS-1:0]                count;          // decimation count
reg [ADC_WIDTH-1:0]            raw_data_d1;    // pipeline register


reg sample_d1, sample_d2;                               // pipeline registers
reg result_valid;                                       // accumulator result 'valid'
wire accumulate;                                        // sample rising edge detected
wire latch_result;                                      // latch accumulator result


//***********************************************************************
//
//  Rising Edge Detection and data alignment pipelines
//
//***********************************************************************
always @(posedge clk or negedge rstn)
begin
  if( ~rstn ) begin
    sample_d1 <= 0;  
    sample_d2 <= 0;
        raw_data_d1 <= 0;
    result_valid <= 0;
  end else begin
    sample_d1 <= sample;                // capture 'sample' input
    sample_d2 <= sample_d1;             // delay for edge detection
    raw_data_d1 <= raw_data_in;       // pipeline 
    result_valid <= latch_result;    // pipeline for alignment with result
  end
end


assign    accumulate = sample_d1 && !sample_d2;      // 'sample' rising_edge detect
assign    latch_result = accumulate && (count == 0);  // latch accum. per decimation count


//***********************************************************************
//
//  Accumulator Depth counter
//
//***********************************************************************
always @(posedge clk or negedge rstn)
begin
  if( ~rstn ) begin
    count <= 0;    
  end else begin
      if (accumulate)  count <= count + 1;         // incr. count per each sample
  end
end




//***********************************************************************
//
//  Accumulator
//
//***********************************************************************
always @(posedge clk or negedge rstn)
begin
  if( ~rstn ) begin
    accum <= 0;  
  end else begin
        if (accumulate)
            if(count == 0)                      // reset accumulator
            accum <= raw_data_d1;           // prime with first value
            else
                accum <= accum + raw_data_d1;   // accumulate
  end  
end

//***********************************************************************
//
//  Latch Result
//
//  ave = (summation of 'n' samples)/'n'  is right shift when 'n' is power of two
//
//***********************************************************************
always @(posedge clk or negedge rstn)
begin
  if( ~rstn ) begin
        ave_data_out <= 0;
    end else if (latch_result) begin            // at end of decimation period...
        ave_data_out <= accum >> LPF_DEPTH_BITS;    // ... save accumulator/n result
    end
end


assign data_out_valid = result_valid;       // output assignment


endmodule

FPGA的小朋友不妨可以試一下,只需要搭配一顆比較器、一個電阻R、一個電容C,只需要FPGA的兩根管腳,你就可以擁有ADC的功能了。

聲明:本文內(nèi)容及配圖由入駐作者撰寫或者入駐合作網(wǎng)站授權(quán)轉(zhuǎn)載。文章觀點僅代表作者本人,不代表電子發(fā)燒友網(wǎng)立場。文章及其配圖僅供工程師學習之用,如有內(nèi)容侵權(quán)或者其他違規(guī)問題,請聯(lián)系本站處理。 舉報投訴
  • FPGA
    +關(guān)注

    關(guān)注

    1645

    文章

    22033

    瀏覽量

    617753
  • 芯片
    +關(guān)注

    關(guān)注

    459

    文章

    52452

    瀏覽量

    439951
  • adc
    adc
    +關(guān)注

    關(guān)注

    99

    文章

    6686

    瀏覽量

    549011
收藏 人收藏
加入交流群
微信小助手二維碼

掃碼添加小助手

加入工程師交流群

    評論

    相關(guān)推薦
    熱點推薦

    fpga開發(fā)板使用教程之在K7Ibert實現(xiàn)基本的GTX測試

    測試,而且基本可以達到不用敲代碼就可以完成測試的目的。 下面按步驟,實現(xiàn)。重點的地方我
    發(fā)表于 12-31 15:36 ?8600次閱讀

    ADC實現(xiàn)IO掛多個按鍵

    有時候做設計時,我們會遇到外部按鍵比較多,IO口不夠用的情況。這時大部分人會考慮通過其它芯片擴展IO,或者直接換一個IO口足夠的MCU。其實,還有方法可以
    發(fā)表于 09-01 13:25 ?3418次閱讀

    如何用STM32F407實現(xiàn)可編程的模擬比較功能

    STM32F407沒有獨立的模擬比較端口,如何能實現(xiàn)可編程的模擬比較
    發(fā)表于 11-28 14:00

    STM32F303VCT6比較只有三可以用

    STM32F303VCT6共有7比較,為何只有COMP1、COMP2、COMP7這三可以用
    發(fā)表于 02-13 07:13

    基于Ginkgo 2ADC實現(xiàn)虛擬示波器功能

    模塊,調(diào)用ADC_Init()函數(shù)即可,詳細調(diào)用方法請參考程序源碼。2、開定時實現(xiàn)定時讀取
    發(fā)表于 02-21 11:38

    怎么利用FPGA和CPLD數(shù)字邏輯實現(xiàn)ADC?

    數(shù)字系統(tǒng)的設計人員擅長在其印制電路板FPGA和CPLD將各種處理、存儲和標準的功能元件粘
    發(fā)表于 08-19 06:15

    如何利用FPGA實現(xiàn)高頻率ADC?

    數(shù)字系統(tǒng)的設計人員擅長在其印制電路板FPGA和CPLD將各種處理、存儲和標準的功能元件粘
    發(fā)表于 09-19 06:18

    可以用FPGA做些什么

    我剛買了新的NEXYS4 DDR板,我已經(jīng)安裝并使用了Vivado套件。我的問題是我可以用FPGA做些什么?我是名計算機/電氣學生,我之所以采用這種邏輯與實驗課是因為我已經(jīng)參加了我學校提供的常規(guī)
    發(fā)表于 05-05 07:28

    可以用STM32實現(xiàn)什么?為什么使用STM32而不是8051

    你問,如何系統(tǒng)地入門學習STM32?本身就是錯誤的問題。假如你會使用8051 , 會寫C語言,那么STM32本身并不需要刻意的學習。你要考慮的是, 我可以用STM32實現(xiàn)
    發(fā)表于 02-25 06:43

    matlab來實現(xiàn)fpga功能的設計

    matlab來實現(xiàn)fpga功能的設計 摘要:System Generator for DSP是Xilinx公司開發(fā)的基于Matlab的DSP開發(fā)工具?熗?時也是
    發(fā)表于 01-16 18:10 ?1.2w次閱讀
    <b class='flag-5'>用</b>matlab來<b class='flag-5'>實現(xiàn)</b><b class='flag-5'>fpga</b><b class='flag-5'>功能</b>的設計

    基于FPGA和CPLD數(shù)字邏輯實現(xiàn)ADC技術(shù)

    基于FPGA和CPLD數(shù)字邏輯實現(xiàn)ADC技術(shù) 數(shù)字系統(tǒng)的設計人員擅長在其印制電路板FPGA
    發(fā)表于 05-25 09:39 ?1615次閱讀
    基于<b class='flag-5'>FPGA</b>和CPLD數(shù)字邏輯<b class='flag-5'>實現(xiàn)</b><b class='flag-5'>ADC</b>技術(shù)

    基于fpga和cpld低頻/最小邏輯ADC實現(xiàn)

    數(shù)字系統(tǒng)的設計人員擅長在其印制電路板FPGA和CPLD將各種處理、存儲和標準的功能元件粘
    發(fā)表于 04-26 11:53 ?1592次閱讀
    基于<b class='flag-5'>fpga</b>和cpld低頻/最小邏輯<b class='flag-5'>ADC</b><b class='flag-5'>實現(xiàn)</b>

    編寫可以用GRUB來引導的簡單x86內(nèi)核

    我們將從零開始,動手編寫可以用GRUB來引導的簡單x86內(nèi)核,該內(nèi)核會在屏幕打印條信息,然后——掛起!
    的頭像 發(fā)表于 01-21 09:12 ?7932次閱讀

    如何制作簡易的Sigma Delta ADC?

    本文為備戰(zhàn)電賽的案例之,涉及到的知識技能: FPGA的使用 ADC的原理及構(gòu)成 PWM的產(chǎn)生 比較的應用 數(shù)字濾波
    的頭像 發(fā)表于 04-01 10:27 ?5050次閱讀
    如何制作<b class='flag-5'>一</b><b class='flag-5'>個</b>簡易的Sigma Delta <b class='flag-5'>ADC</b>?

    FPGA可以用比較實現(xiàn)ADC功能?1

    多數(shù)FPGA芯片沒有ADC功能,而些應用則需要用到ADC
    的頭像 發(fā)表于 04-25 11:18 ?4909次閱讀
    <b class='flag-5'>FPGA</b><b class='flag-5'>上</b><b class='flag-5'>可以用</b><b class='flag-5'>一</b><b class='flag-5'>個</b><b class='flag-5'>比較</b><b class='flag-5'>器</b><b class='flag-5'>實現(xiàn)</b><b class='flag-5'>ADC</b>的<b class='flag-5'>功能</b>?1