{"id":121,"date":"2021-07-23T23:23:58","date_gmt":"2021-07-23T15:23:58","guid":{"rendered":"http:\/\/www.hellofpga.com\/?p=121"},"modified":"2025-05-11T00:35:35","modified_gmt":"2025-05-10T16:35:35","slug":"04_pl_beep","status":"publish","type":"post","link":"http:\/\/www.hellofpga.com\/index.php\/2021\/07\/23\/04_pl_beep\/","title":{"rendered":"\u57fa\u4e8eEBAZ4205 \u7684FPGA\u5b9e\u9a8c\u5341\u00a0 \u57fa\u4e8eZYNQ PL\u8d44\u6e90\u7684\u65e0\u7f18\u8702\u9e23\u5668\u7684\u6f14\u793a"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\u672c\u6587\u4ecb\u7ecd\u5728EBAZ4205\u5e73\u53f0\u4e0a\u7528PL\u7684\u8d44\u6e90\u9a71\u52a8\u65e0\u6e90\u8702\u9e23\u5668<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u5b9e\u9a8c\u5185\u5bb9\u9002\u7528\u4e8e\u5e02\u9762\u4e0a\u529f\u80fd\u6b63\u5e38\u7684EBAZ4205\u7684\u677f\u5b50<\/strong><\/li>\n\n\n\n<li><strong>\u672c\u6b21\u5b9e\u9a8c\u9700\u8981\u8fde\u63a5\u672c\u7ad9\u70b9\u7684EBAZ4205\u8f6c\u63a5\u677f<\/strong><\/li>\n\n\n\n<li><strong>\u672c\u6b21\u5b9e\u9a8c\u9ed8\u8ba4EBAZ4205\u4e3b\u677f\u4e0a\u5df2\u710a\u63a550M\u6709\u6e90\u6676\u632f<\/strong>\n<ul class=\"wp-block-list\">\n<li>\u5982\u4e3b\u677f\u6ca1\u6709\u710a\u63a5\u6676\u632f\u53ef\u6839\u636e\u4e0b\u6587\u7684\u65b9\u6cd5\u4e3aPL\u7aef\u63d0\u4f9b\u65f6\u949f<a href=\"http:\/\/www.hellofpga.com\/index.php\/2021\/08\/07\/zynq_ps_clk_to_pl\/\" target=\"_blank\" rel=\"noreferrer noopener\">EBAZ4205 ZYNQ \u901a\u8fc7 PS\u90e8\u5206\u6765\u4e3aPL\u903b\u8f91\u63d0\u4f9b\u65f6\u949f\uff08\u6ca1\u6709\u710a\u63a5PL\u6676\u632f\u7684\u677f\u5b50\u53ef\u7528\u6b64\u65b9\u6cd5\uff09<\/a><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>\u672c\u6587\u5728 vivado2018.3\u7248\u672c\u4e0a\u6f14\u793a<\/strong><\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">\u5de5\u7a0b\u521b\u5efa\u7684\u8fc7\u7a0b\u53ef\u4ee5\u53c2\u8003\u5b9e\u9a8c\u4e00\u4e2d\u7684\u5185\u5bb9\uff0c\u8fd9\u91cc\u4e0d\u8be6\u7ec6\u63cf\u8ff0\u4e86\u3002<a href=\"http:\/\/www.hellofpga.com\/index.php\/2021\/07\/17\/zynqplled\/\" target=\"_blank\" rel=\"noreferrer noopener\">\u57fa\u4e8eEBAZ4205 \u7684FPGA\u5b9e\u9a8c\u4e00 \u7528ZYNQ\u7684PL\u8d44\u6e90\u70b9\u4eae\u4e00\u4e2aLED (\u5b8c\u6574\u56fe\u6587)<\/a> (\u82af\u7247\u578b\u53f7\u9009XC7Z010CLG400-1)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>1.)\u7535\u8def\u90e8\u5206<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"766\" height=\"352\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/11\/image.png\" alt=\"\" class=\"wp-image-384\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/11\/image.png 766w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/11\/image-300x138.png 300w\" sizes=\"auto, (max-width: 706px) 89vw, (max-width: 767px) 82vw, 740px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u65e0\u6e90\u8702\u9e23\u5668\u7684\u9a71\u52a8\u90e8\u5206\u5982\u4e0a\u56fe\u6240\u793a\uff0c\u5f53\u4e09\u6781\u7ba1\u5bfc\u901a\u65f6\uff0c\u8702\u9e23\u5668\u4e0a\u6d41\u8fc7\u7535\u6d41\uff0c\u5f53\u4e09\u6781\u7ba1\u5173\u95ed\uff0c\u8702\u9e23\u5668\u4e0a\u7535\u6d41\u505c\u6b62\u6d41\u8fc7\u3002  <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u8702\u9e23\u5668\u7684\u9a71\u52a8\u90e8\u5206\u8fde\u63a5\u5230EBAZ4205 \u7684D18\u7ba1\u811a<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>2\uff09\u65e0\u6e90\u8702\u9e23\u5668\u7b80\u5355\u4ecb\u7ecd<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u65e0\u6e90\u8702\u9e23\u5668\u4e0d\u50cf\u6709\u6e90\u8702\u9e23\u5668\u90a3\u6837\u53ea\u8981\u901a\u4e0a\u7535\u5c31\u4f1a\u53d1\u51fa\u58f0\u97f3\uff0c\u65e0\u6e90\u8702\u9e23\u5668\u5185\u90e8\u6ca1\u6709\u632f\u8361\u9a71\u52a8\u5355\u5143\uff0c\u9700\u8981\u4ee5\u4e00\u5b9a\u7684\u632f\u8361\u9891\u7387\u53bb\u9a71\u52a8\u8702\u9e23\u5668\uff0c\u8ba9\u8702\u9e23\u5668\u4ee5\u7279\u5b9a\u7684\u9891\u7387\u8fdb\u884c\u53d1\u58f0\uff0c \u7f3a\u70b9\u662f\u9a71\u52a8\u65b9\u5f0f\u7a0d\u590d\u6742\uff0c\u4f18\u70b9\u5c31\u662f\u53ef\u4ee5\u53d1\u51fa\u4e0d\u540c\u97f3\u8c03\u7684\u58f0\u97f3\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4ee5\u4e0b\u4e3a\u67e5\u8d44\u6599\u5f97\u77e5\u7684\u6bcf\u4e2a\u4e50\u8c03\u5bf9\u5e94\u7684\u9891\u7387\u3002&nbsp; &nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/bbs.elecfans.com\/data\/attachment\/forum\/201701\/14\/211109okhwaq6sgkq4fvsk.jpg.thumb.jpg\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><br><\/strong>\u6839\u636e\u6bcf\u4e2a\u97f3\u8c03\u7684\u9891\u7387\u503c\uff0c\u53ef\u4ee5\u8ba1\u7b97\u5f97\u51faPWM\u53d1\u9001\u6a21\u5757\u7684\u9884\u91cd\u88c5\u503c\uff0c\u4ee5\u4e0b\u4e3a\u8ba1\u7b97\u5f97\u51fa\u7684\u97f3\u8c03\u9891\u7387\u4e0e\u5bf9\u5e94PWM\u53d1\u9001\u6a21\u5757\u8f93\u51fa\u76f8\u5e94\u9891\u7387\u7684\u9884\u91cd\u88c5\u503c\u3002\uff08\u5bf9\u5e94\u7684\u662f50M\u65f6\u949f\u4e0b\u7684\u503c\uff09<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u8ba1\u7b97\u4e3e\u4f8b  50M\u9891\u7387\u4e0b  1S\u7684\u632f\u8361\u6b21\u6570\u662f 50_000_000\u6b21\uff0c \u800c261.6hz\u7684\u5468\u671f\u662f1\u79d2\u5faa\u73af261.6\u6b21\uff0c\u90a3\u4e48\u572850M\u9891\u7387\u4e0b 261.6hz\u7684\u4e00\u4e2a\u5468\u671f\u76f8\u5f53\u4e8e\u632f\u836150_000_000\/261.6=191_131 \u5373\u4e0b\u56fe\u4e2d\u7684\u9884\u91cd\u88c5\u503c<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/bbs.elecfans.com\/data\/attachment\/forum\/201701\/14\/211110u8dkmpvsp8kd2dk3.jpg.thumb.jpg\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u56e0\u4e3a\u9a71\u52a8\u8702\u9e23\u5668PWM \u7684\u5360\u7a7a\u6bd4\u662f50%\uff0c\u6240\u4ee5\u9ad8\u7535\u5e73\u4f4e\u7535\u5e73\u5404\u5360\u4e00\u534a\uff0c\u6240\u4ee5\u9ad8\u4f4e\u7535\u5e73\u7684\u9884\u88c5\u5468\u671f\u5206\u522b\u4e3a \u6574\u4e2a\u5468\u671f\u7684\u4e00\u534a,\u5373\u5b8c\u6574\u9884\u88c5\u503c\/2\uff0c \u4e5f\u53ef\u4ee5\u7528\u53f3\u79fb\u4e00\u4f4d\u6765\u66ff\u4ee3<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">3\uff09 \u4ee3\u7801\u5b9e\u73b0<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">`timescale 1ns \/ 1ps\nmodule BEEP_MODULE(\n    input clk,\/\/50m \u6ce2\u5f62\n    output reg beep\n);\n\nparameter D0=191130;\nparameter RE=170241;\nparameter MI=151698;\nparameter FA=143183;\nparameter SO=127550;\nparameter LA=113635;\nparameter XI=101234;\n\n\/\/PWM \u53d1\u58f0\u6a21\u5757\uff0c\u7528\u6765\u4ea7\u751f\u7279\u5b9a\u7684PWM\u6ce2\u5f62\nreg [16:0]beep_pwm_count;\nreg [16:0]beep_pwm;\nalways@(posedge clk)\n    if(beep_pwm_count&gt;=beep_pwm)begin\n        beep_pwm_count&lt;=17'd0;\n        beep&lt;=~beep;\n     end\n    else beep_pwm_count&lt;=beep_pwm_count+1'b1;\n\nreg [2:0]voice_mode;    \nparameter T500_MS = 26'd25_000_000 ; \nreg [24:0]time_count;\/\/\n\n\n\/\/\u521d\u59cb\u5316\u5bc4\u5b58\u5668\u7528\ninitial begin\n    voice_mode&lt;=3'd0;\n    time_count&lt;=25'd0;\nend\n\n\/\/0.5\u79d2\u5b9a\u65f6\u5668\uff0c\u6bcf0.5\u79d2\u6539\u53d8\u4e00\u6b21\u58f0\u8c03\uff0c\u901a\u8fc7voice_mode\u6765\u8c03\u6574\u97f3\u8c03\n always@(posedge clk)\n     if(time_count&gt;=T500_MS)begin\n         time_count&lt;=25'd0;\n         if(voice_mode&gt;=3'd6)voice_mode&lt;=3'd0;\n         else voice_mode&lt;=voice_mode+1'b1;\n     end\n     else time_count&lt;=time_count+1'b1;\n \n \/\/\u5c06\u5f53\u524dvoice_mode\u5bf9\u5e94\u7684\u97f3\u8c03\u503c\u8d4b\u7ed9 beep_pwm\u5bc4\u5b58\u5668    \n \/\/\u5411\u53f3\u79fb\u52a8\u4e00\u4f4d\u7684\u4f5c\u7528\u662f\uff0c\u9884\u8bbe\u503c\u662f\u5b9e\u9645\u6ce2\u957f\u7684\u4e00\u534a\n always@(posedge clk)\n    case(voice_mode)\n        3'd0:beep_pwm&lt;=D0&gt;&gt;1;\n        3'd1:beep_pwm&lt;=RE&gt;&gt;1;\n        3'd2:beep_pwm&lt;=MI&gt;&gt;1; \n        3'd3:beep_pwm&lt;=FA&gt;&gt;1;\n        3'd4:beep_pwm&lt;=SO&gt;&gt;1;\n        3'd5:beep_pwm&lt;=LA&gt;&gt;1; \n        3'd6:beep_pwm&lt;=XI&gt;&gt;1;  \n    endcase\n\nendmodule\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u672c\u7ae0\u8282\u7684\u5de5\u7a0b\uff1a<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u672c\u6587\u7684\u5b8c\u6574\u5de5\u7a0b\u4e0b\u8f7d\uff1a<a href=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/11\/04_PL_BEEP.zip\">04_PL_BEEP<\/a><\/strong><\/li>\n\n\n\n<li><strong>VIVADO\u7684\u7248\u672c\uff1a2018.3<\/strong><\/li>\n\n\n\n<li><strong>\u5de5\u7a0b\u9002\u7528\u4e3b\u677f: EBAZ4205\u4e3b\u677f+\u8f6c\u63a5\u677f<\/strong><\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u6587\u4ecb\u7ecd\u5728EBAZ4205\u5e73\u53f0\u4e0a\u7528PL\u7684\u8d44\u6e90\u9a71\u52a8\u65e0\u6e90\u8702\u9e23\u5668<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-121","post","type-post","status-publish","format-standard","hentry","category-ebaz4205"],"views":904,"_links":{"self":[{"href":"http:\/\/www.hellofpga.com\/index.php\/wp-json\/wp\/v2\/posts\/121","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.hellofpga.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.hellofpga.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.hellofpga.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.hellofpga.com\/index.php\/wp-json\/wp\/v2\/comments?post=121"}],"version-history":[{"count":9,"href":"http:\/\/www.hellofpga.com\/index.php\/wp-json\/wp\/v2\/posts\/121\/revisions"}],"predecessor-version":[{"id":9767,"href":"http:\/\/www.hellofpga.com\/index.php\/wp-json\/wp\/v2\/posts\/121\/revisions\/9767"}],"wp:attachment":[{"href":"http:\/\/www.hellofpga.com\/index.php\/wp-json\/wp\/v2\/media?parent=121"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.hellofpga.com\/index.php\/wp-json\/wp\/v2\/categories?post=121"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.hellofpga.com\/index.php\/wp-json\/wp\/v2\/tags?post=121"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}