zhang2008wen 发表于 2012-7-23 23:25:51

EPM240在没有外界 时钟情况下,如何产生一个方波呢?


EPM240在没有外界 时钟情况下,如何产生一个方波呢,一般的开发板上都有一个时钟源,然后将时钟分频得要我们需要的频率。现在问题是 我的 线路板没事外部时钟。那么如何内部产生一个方波呢?
线路板 一个晶振都没有,只能利用EPM240自己的内部时钟了。哪个高人指导下。

Nuker 发表于 2012-7-24 00:13:17

AN 496: Using the Internal Oscillator in MAX II and MAX V CPLDs (ver 2.0, Jan 2011, 612 KB)
http://www.altera.com.cn/literature/an/an496.pdf
只能3.3-5.6Mhz

zhang2008wen 发表于 2012-7-24 13:22:01

恩,看到了。谢谢
不过 ,手册上的OSC-EN在epm240管脚中没发现。

zhang2008wen 发表于 2012-7-24 22:32:04

/************************************************************************************************************************************************************************************************
Using Internal Oscillator in MAX V
Jan 2010
************************************************************************************************************************************************************************************************/
// Top Level module
`timescale 1 ps / 1 ps
module int_osc (pb0, led , osc, clk);

/**********************************************************************************************************
pb0                 : To control the enable signal of the internal oscillator, assigned to pin M9
osc                 : Output from internal oscillator, assigned to pin M4
clk                 : osc/(2^21), assigned to pin P2
led : Blinking leds to demostrate the functionality of internal oscillator, assigned to pin R1 and P4
**********************************************************************************************************/

/* Input is push button switch and outputs are leds */
input pb0;
output clk, osc;
output led;

wire osc_w, oscena_w, clk_w;
wire led_w;
assign oscena_w =(pb0);      // Enable the oscillator
assign osc = osc_w;
assign clk= clk_w;
assign led=~led_w;
counter cntr (.ct_out(led_w),.clk(clk_w));
altufm_osc0_altufm_osc_1p3 ufm (.osc(osc_w), .oscena(oscena_w));
reduced_osc rosc (.osc(osc_w), .clk(clk_w));

endmodule

/***********************************************************************************************************************************************************************************************
Module for displaying running LED pattern
**************************************************************************************************************************/
module counter (clk, ct_out);

/* Input is the output of the reduced oscillator module
* Outputs are the blinking LEDs*/

input clk;
output ct_out;

reg ct_out;

initial
begin
ct_out= 0;
end

always @ (posedge clk) begin
        ct_out <= ct_out + 1'b1;

end

endmodule
       
/**************************************************************************************************************************************************/
/* Megafunction for Internal oscillator */

`timescale 1 ps / 1 ps
//synopsys translate_on
modulealtufm_osc0_altufm_osc_1p3
        (
        osc,
        oscena) /* synthesis synthesis_clearbox=1 */;
        output   osc;
        input   oscena;

        wirewire_maxv_ufm_block1_osc;

        maxv_ufm   maxv_ufm_block1
        (
        .arclk(1'b0),
        .ardin(1'b0),
        .arshft(1'b0),
        .bgpbusy(),
        .busy(),
        .drclk(1'b0),
        .drdout(),
        .drshft(1'b0),
        .osc(wire_maxv_ufm_block1_osc),
        .oscena(oscena)
        `ifdef FORMAL_VERIFICATION
        `else
        // synopsys translate_off
        `endif
        ,
        .drdin(1'b0),
        .erase(1'b0),
        .program(1'b0)
        `ifdef FORMAL_VERIFICATION
        `else
        // synopsys translate_on
        `endif
        // synopsys translate_off
        ,
        .ctrl_bgpbusy(),
        .devclrn(),
        .devpor(),
        .sbdin(),
        .sbdout()
        // synopsys translate_on
        );
        defparam
                maxv_ufm_block1.address_width = 9,
                maxv_ufm_block1.osc_sim_setting = 500000,
                maxv_ufm_block1.lpm_type = "maxv_ufm";
        assign
                osc = wire_maxv_ufm_block1_osc;
endmodule //altufm_osc0_altufm_osc_1p3
//VALID FILE

/****************************************************************************************************************************
Module to reduce the frequency of internal oscillator
****************************************************************************************************************************/
module reduced_osc (osc, clk);

input osc;               // Output of internal osc
output clk;            // Reduced frequency clock

reg count;
reg clk;

initial
begin
count = 0;
end

always @ (posedge osc) begin
count <= count + 1;
clk <= count;
end

endmodule

/***************************************************************************************************************************/

官方代码 中间的模块 modulealtufm_osc0_altufm_osc_1p3   是什么作用呀,

zhang2008wen 发表于 2012-7-24 22:38:13

EPM240的 OSC管脚是哪个?

zhang2008wen 发表于 2012-7-24 23:07:48

2楼你好。我今天查阅了其它书籍,发现 EPM240有2个时钟,在使用megewizard 时候,供我们选择的只有两个时钟,3.33M 5.56M。
我生产后的文件,还不会使用,现在至少已经知道了,内部时钟是怎么会事情的,上面的疑问 我应该可以不用管了。应该就是一个产生时钟的程序,当然能学会自己看懂就最好了。
页: [1]
查看完整版本: EPM240在没有外界 时钟情况下,如何产生一个方波呢?