搜索
bottom↓
回复: 5

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

[复制链接]

出0入0汤圆

发表于 2012-7-23 23:25:51 | 显示全部楼层 |阅读模式

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

阿莫论坛20周年了!感谢大家的支持与爱护!!

曾经有一段真挚的爱情摆在我的面前,我没有珍惜,现在想起来,还好我没有珍惜……

出0入17汤圆

发表于 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

出0入0汤圆

 楼主| 发表于 2012-7-24 13:22:01 | 显示全部楼层
恩,看到了。谢谢
不过 ,手册上的OSC-EN在epm240管脚中没发现。

出0入0汤圆

 楼主| 发表于 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[1:0] : 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[1:0] led;

wire osc_w, oscena_w, clk_w;
wire [1:0] 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[1:0] ct_out;

reg [1:0] 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
module  altufm_osc0_altufm_osc_1p3
        (
        osc,
        oscena) /* synthesis synthesis_clearbox=1 */;
        output   osc;
        input   oscena;

        wire  wire_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 [25:0] count;
reg clk;

initial
begin
count = 0;
end

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

endmodule

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

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

出0入0汤圆

 楼主| 发表于 2012-7-24 22:38:13 | 显示全部楼层
EPM240的 OSC管脚是哪个?

出0入0汤圆

 楼主| 发表于 2012-7-24 23:07:48 | 显示全部楼层
2楼你好。我今天查阅了其它书籍,发现 EPM240有2个时钟,在使用megewizard 时候,供我们选择的只有两个时钟,3.33M 5.56M。
我生产后的文件,还不会使用,现在至少已经知道了,内部时钟是怎么会事情的,上面的疑问 我应该可以不用管了。应该就是一个产生时钟的程序,当然能学会自己看懂就最好了。
回帖提示: 反政府言论将被立即封锁ID 在按“提交”前,请自问一下:我这样表达会给举报吗,会给自己惹麻烦吗? 另外:尽量不要使用Mark、顶等没有意义的回复。不得大量使用大字体和彩色字。【本论坛不允许直接上传手机拍摄图片,浪费大家下载带宽和论坛服务器空间,请压缩后(图片小于1兆)才上传。压缩方法可以在微信里面发给自己(不要勾选“原图),然后下载,就能得到压缩后的图片。注意:要连续压缩2次才能满足要求!!】。另外,手机版只能上传图片,要上传附件需要切换到电脑版(不需要使用电脑,手机上切换到电脑版就行,页面底部)。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|Archiver|amobbs.com 阿莫电子技术论坛 ( 粤ICP备2022115958号, 版权所有:东莞阿莫电子贸易商行 创办于2004年 (公安交互式论坛备案:44190002001997 ) )

GMT+8, 2024-8-27 12:59

© Since 2004 www.amobbs.com, 原www.ourdev.cn, 原www.ouravr.com

快速回复 返回顶部 返回列表