{"id":546,"date":"2022-03-08T20:19:24","date_gmt":"2022-03-08T12:19:24","guid":{"rendered":"http:\/\/www.hellofpga.com\/?p=546"},"modified":"2024-02-03T22:46:54","modified_gmt":"2024-02-03T14:46:54","slug":"ps_lcd_io_spi","status":"publish","type":"post","link":"http:\/\/www.hellofpga.com\/index.php\/2022\/03\/08\/ps_lcd_io_spi\/","title":{"rendered":"EBAZ4205 \u7b2c\u5341\u4e2a\u5de5\u7a0b \u7528zynq\u7684PS IO\u8d44\u6e90\u53bb\u6a21\u62dfSPI\u534f\u8bae\u6765\u70b9\u4eae\u5f69\u8272LCD\u5c4f(\u7d2b\u8272\u677f\u5b50)"},"content":{"rendered":"\n<p>\u548c\u7b2c\u5341\u4e09\u4e2a\u5de5\u7a0b\u6709\u6240\u4e0d\u540c\uff0c\u7b2c\u5341\u4e09\u4e2a\u5de5\u7a0b\u662f\u7528\u786c\u4ef6SPI \u53bb\u70b9\u4eaeLCD \u5c4f\uff0c\u8fd9\u91cc\u662f\u7528IO\u7684\u65b9\u5f0f\u53bb\u6a21\u62df\u70b9\u4eaeLCD\u5c4f\u5e55\uff0c \u8fc7\u7a0b\u4f1a\u5199\u7684\u6bd4\u8f83\u8be6\u7ec6\u3002<\/p>\n\n\n\n<p class=\"has-vivid-red-color has-text-color has-medium-font-size\"><strong>\u7b2c\u5341\u4e09\u4e2a\u5de5\u7a0b\u786c\u4ef6SPI\u7684\u517c\u5bb9\u6027\u95ee\u9898\u5df2\u7ecf\u89e3\u51b3\u4e86\uff0c\u786c\u4ef6SPI\u7684\u65b9\u6848\u6267\u884c\u6548\u7387\u66f4\u9ad8\uff0c\u901f\u7387\u66f4\u5feb\uff0c\u5982\u679c\u8981\u7528\u786c\u4ef6SPI\u7684\u53ef\u4ee5\u53c2\u8003\u5de5\u7a0b\u5341\u4e09<\/strong>  20220505<\/p>\n\n\n\n<p><s>\u4e3a\u4ec0\u4e48\u6709\u4e86\u786c\u4ef6SPI \u5de5\u7a0b\u8fd8\u8981\u7528\u8fd9\u4e2a\u6a21\u62df\u7684\u65b9\u5f0f\u53bb\u70b9\u4eae\u5c4f\u5e55\u5462\uff1f \u56e0\u4e3a\u672c\u8f6c\u63a5\u677f\u4f7f\u7528\u7684\u5c4f\u5e55\u7684SPI\u63a5\u53e3\u4e0a\u5e76\u672a\u5f15\u51faCS\u811a(\u5c4f\u5e55\u5382\u5546\u7684\u73b0\u6210DEMO\u4e5f\u662f\u6ca1\u6709\u62c9\u51faCS\u811a\u7684)\uff0c\u6b63\u5e38\u4f7f\u7528\u7684\u65f6\u5019\uff0c\u6216\u8005\u7528\u5176\u4ed6MCU\u7684\u786c\u4ef6SPI \u53bb\u9a71\u52a8\u7684\u65f6\u5019\u6ca1\u6709\u78b0\u5230\u95ee\u9898\uff0c\u4f46\u662f\u6211\u81ea\u5df1\u5728\u505a\u9879\u76ee\u7684\u65f6\u5019\u9047\u5230\u4e86\uff0c\u5f53ZYNQ\u70b9\u4eae\u5c4f\u5e55\u540e\u957f\u65f6\u95f4\u4e0d\u53bb\u64cd\u4f5c\u5c4f\u5e55\u7684\u65f6\u5019 \uff0c\u518d\u53bb\u70b9\u4eae\u5c4f\u5e55\u4f1a\u51fa\u73b0\u5c4f\u5e55\u6b7b\u673a\u4e0d\u542c\u6307\u4ee4\u7684\u60c5\u51b5\uff0c\u6000\u7591\u662f\u56e0\u4e3a\u6ca1\u6709CS\u4fe1\u53f7\uff0c\u65e0\u6cd5\u4f5c\u4f4d\u6821\u51c6\uff0c\u7136\u540eZYNQ\u7684\u786c\u4ef6SPI\u6709\u53ef\u80fd\u5728\u957f\u65f6\u95f4\u4e0d\u8c03\u7528\u60c5\u51b5\u4e0b\uff0c\u5bf9\u603b\u7ebf\u8fdb\u884c\u4e86\u91ca\u653e\uff0c\u5bfc\u81f4\u4e4b\u540e\u6536\u5230\u7684\u6570\u636e\u5c4f\u5e55\u90fd\u662f\u9519\u4f4d\u7684\u60c5\u51b5\u3002 \u6240\u4ee5\u4e3a\u4e86\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\uff0c\u7279\u5730\u5199\u4e86\u7528IO\u53e3\u6a21\u62df\u7684\u65b9\u5f0f\u53bb\u9a71\u52a8\u5c4f\u5e55\u7684\u6559\u7a0b\uff0c\u7ecf\u8fc7\u6d4b\u8bd5\uff0c<strong>\u5728\u6269\u5c55\u677f\u4e0b\uff0c\u6b64\u65b9\u6cd5\u6bd4\u786c\u4ef6SPI\u53bb\u70b9\u4eae\u5c4f\u5e55\u66f4\u7a33\u5b9a<\/strong> <\/s><\/p>\n\n\n\n<p>\u4ee5\u4e0b\u90e8\u5206\u5185\u5bb9\u548c\u7b2c\u4e03\u4e2a\u5de5\u7a0b\u96f7\u540c\uff0c \u53ef\u9009\u62e9\u6027\u770b<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">1.\u786c\u4ef6\u4ecb\u7ecd<\/h2>\n\n\n\n<p>\u8f6c\u63a5\u677f\u90e8\u5206\u786c\u4ef6LCD \u63a5\u53e3\u5982\u4e0b\u56fe\u6240\u793a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"291\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-59-1024x291.png\" alt=\"\" class=\"wp-image-310\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-59-1024x291.png 1024w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-59-300x85.png 300w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-59-768x218.png 768w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-59.png 1452w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n\n\n\n<p>BL \u8d1f\u8d23\u63a7\u5236\u80cc\u5149\uff0c\u9ad8\uff1a\u5c4f\u5e55\u70b9\u4eae\uff0c \u4f4e\uff1a\u5c4f\u5e55\u7184\u706d<\/p>\n\n\n\n<p>CS \u7247\u9009\u4fe1\u53f7  \u5e76\u672a\u5f15\u51fa\uff0c \u8fd9\u91cc\u76f4\u63a5\u63a5GND \u4e86\uff0c\u4e00\u76f4\u4f7f\u80fd<\/p>\n\n\n\n<p>SCL \u65f6\u949f<\/p>\n\n\n\n<p>SDA \u6570\u636e<\/p>\n\n\n\n<p>D\/C \u6570\u636e\/\u547d\u4ee4\u6307\u793a<\/p>\n\n\n\n<p>RES \u5c4f\u5e55\u590d\u4f4d<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">2.\u9a71\u52a8\u601d\u8def<\/h2>\n\n\n\n<p>\u5c4f\u5e55\u672c\u8eab\u662f\u8fde\u63a5\u5230ZYNQ\u7684PL\u8d44\u6e90\u4e0a\uff0c\u70b9\u4eae\u5c4f\u5e55\u53ef\u4ee5\u7528\u7eaffpga\u53bb\u9a71\u52a8SPI\u7684\u65b9\u5f0f\u70b9\u4eae\uff0c\u4e5f\u53ef\u4ee5\u7528PS\u8d44\u6e90\u53bb\u70b9\u4eae\uff0c\u4e3a\u4e86\u65b9\u4fbf\u6f14\u793a\uff0c\u8fd9\u91cc\u91c7\u7528PS\u8d44\u6e90\u53bb\u5b9e\u73b0<\/p>\n\n\n\n<p>\u672c\u6587\u7528ZYNQ\u7684IO\u53e3\u53bb\u6a21\u62df\u786c\u4ef6SPI \uff0c\u6765\u9a71\u52a8LCD\u5c4f\uff0c IO\u53e3\u5219\u662fPS\u7aef\u901a\u8fc7EMIO\u7684\u65b9\u5f0f\u6620\u5c04\u5230PL\u63a5\u53e3\u4e0a<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">3.\u521b\u5efa\u5de5\u7a0b<\/h2>\n\n\n\n<p>1\uff09\u65b0\u5efa\u4e00\u4e2a\u9879\u76ee\uff0c\u82af\u7247\u578b\u53f7\u9009\u62e9 XC7Z010CLG400-1<\/p>\n\n\n\n<p>2) \u521b\u5efa\u4e00\u4e2aBLOCK\u8bbe\u8ba1\uff0c\u5e76\u6dfb\u52a0ZYNQ7 PROCESSING SYSTEM\u6a21\u5757\uff0c\u8f6f\u4ef6\u81ea\u52a8\u751f\u6210\u4e86\u4e00\u4e2a zynq\u7684block \u5982\u4e0b\u56fe\u6240\u793a\uff0c\u63a5\u4e0b\u6765\u8981\u505a\u4e00\u4e9b\u76f8\u5e94\u7684\u8bbe\u7f6e\uff0c\u53cc\u51fb\u4e0b\u56fe\u4e2d\u7684ZYNQ\u6838<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-3.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>3\uff09\u5728ZYNQ\u4e2d\u8bbe\u7f6e\u65f6\u949f\u529f\u80fd\uff1a<\/p>\n\n\n\n<p>\u627e\u5230 \u8bbe\u7f6e\u9879\u76ee\u4e2d\u7684 Clock Configuration \u9009\u9879\uff0c \u5728PL Fabric Clocks \u8bbe\u7f6e\u81ea\u5df1\u9700\u8981\u7684\u65f6\u949f\u9891\u7387\uff0c\u8fd9\u91cc\u4e00\u5171\u67094\u79cd\u9891\u7387\u53ef\u4ee5\u8bbe\u7f6e \u7c7b\u4f3c\u4e8e\u6211\u4eec\u7684PLL\u529f\u80fd\u3002\u8fd9\u91cc\u6211\u4eec\u8bbe\u7f6e50M\u65f6\u949f<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"960\" height=\"583\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-50.png\" alt=\"\" class=\"wp-image-264\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-50.png 960w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-50-300x182.png 300w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-50-768x466.png 768w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n\n\n\n<p>4\uff09\u5728zynq\u4e2d\u8bbe\u7f6eDDR\u529f\u80fd\uff1a<\/p>\n\n\n\n<p>\u4f9d\u6b21\u5728\u5f39\u7a97\u91cc\u627e\u5230DDR Configuration\u2192DDR Controller Configuration\u2192DDR3\uff0c\u5728Memory Part\u4e0b\u62c9\u83dc\u5355\u4e2d\u6839\u636e\u81ea\u5df1\u677f\u5b50\u4e0a\u7684DDR\u6765\u9009\u62e9\u76f8\u5e94\u7684DDR3\uff0c\u672c\u5b9e\u9a8c\u6240\u7528\u5230\u578b\u53f7\uff1aMT41K128M16JT 125\uff0c\u6570\u636e\u4f4d\u5bbd\u9009\u62e916bit \u6700\u540e\u70b9\u51fb\u201cOK\u201d,\u5982\u4e0b\u56fe\u6240\u793a\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"977\" height=\"493\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-5.png\" alt=\"\" class=\"wp-image-188\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-5.png 977w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-5-300x151.png 300w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-5-768x388.png 768w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n\n\n\n<p>5\uff09EMIO\u7684\u8bbe\u7f6e\uff0c\u5c4f\u5e55\u9a71\u52a8\u9664\u4e86\u65f6\u949f\u4fe1\u53f7\uff0c\u6570\u636e\u4fe1\u53f7\u4ee5\u5916\uff0c\u8fd8\u67093\u4e2a\u989d\u5916\u7684GPIO\u53e3\u6765\u5206\u522b\u63a7\u5236\u80cc\u5149BL \uff0c\u590d\u4f4dRES\u548c D\/C\u4fe1\u53f7\uff0c\u6240\u4ee5\u8fd9\u91cc\u5171\u589e\u52a05\u4e2aGPIO\u53e3\uff0c\u8fd9\u91ccGPIO\u8d44\u6e90\u9009\u62e9EMIO GPIO \u4f4d\u5bbdWidth\u9009\u62e95\uff08\u56e0\u4e3a\u662f5\u4e2aIO\u53e3\uff09<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"831\" height=\"589\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2022\/03\/image.png\" alt=\"\" class=\"wp-image-550\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2022\/03\/image.png 831w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2022\/03\/image-300x213.png 300w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2022\/03\/image-768x544.png 768w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>6\uff09\u5b8c\u6210\u4e0a\u8ff0\u64cd\u4f5c\u540e\uff0c \u70b9\u51fb\u201cRun Block Automation\u201d\u5982\u4e0b\u56fe\u6240\u793a\u3002\u5728\u5f39\u51fa\u7684\u9009\u9879\u4e2d\u4fdd\u6301\u9ed8\u8ba4\uff0c\u70b9\u51fb\u201cOK\u201d\uff0c\u5373\u53ef\u5b8c\u6210\u5bf9ZYNQ7 Processing System\u7684\u914d\u7f6e\uff0c\u5e76\u7528\u9f20\u6807\u8fde\u63a5FCLK_CLK\u548c M_AXI_GP0_ACLK\uff0c\u5f97\u5230\u4e0b\u56fe<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"617\" height=\"290\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2022\/03\/image-2.png\" alt=\"\" class=\"wp-image-553\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2022\/03\/image-2.png 617w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2022\/03\/image-2-300x141.png 300w\" sizes=\"auto, (max-width: 617px) 100vw, 617px\" \/><\/figure>\n\n\n\n<p>\u5728\u4e0a\u56fe\u4e2d\u5206\u522b\u70b9\u51fbIO\u53e3\u8fdb\u884c\u4ee5\u4e0b\u64cd\u4f5c\uff1a<\/p>\n\n\n\n<p>\u53f3\u952eGPIO_0\u9009\u62e9Make External<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"673\" height=\"282\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2022\/03\/image-1.png\" alt=\"\" class=\"wp-image-552\" style=\"width:673px;height:282px\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2022\/03\/image-1.png 673w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2022\/03\/image-1-300x126.png 300w\" sizes=\"auto, (max-width: 673px) 100vw, 673px\" \/><\/figure>\n\n\n\n<p>7\uff09source\u2192Design Source \uff0c\u53f3\u952e\u6211\u4eec\u521b\u5efa\u7684BLOCK\u5de5\u7a0b\uff0c\u70b9\u51fbcreate HDL wrapper\uff0c\u6253\u5305BLOCK\u6587\u4ef6\u5e76\u751f\u6210.v\u4ee3\u7801<\/p>\n\n\n\n<p>8) \u70b9\u51fb\u7eff\u8272\u7bad\u5934RUN \u5bf9\u4ee3\u7801\u8fdb\u884c\u7f16\u8bd1<\/p>\n\n\n\n<p>9) \u70b9\u51fbRTL \u4e2d\u7684SCHEMATIC , \u5e76\u9009\u62e9\u53f3\u8fb9\u51fa\u73b0\u7684 IO Ports \u6765\u589e\u52a0SPI\u7684\u7ba1\u811a\u5b9a\u4e49(\u8fd9\u4e00\u6b65\u4e5f\u53ef\u4ee5\u5728\u7ea6\u675f\u6587\u4ef6\u4e2d\u5b9a\u4e49, \u53ef\u770b\u4e4b\u524d\u7684\u4f8b\u5b50)<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"411\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-69-1024x411.png\" alt=\"\" class=\"wp-image-324\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-69-1024x411.png 1024w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-69-300x120.png 300w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-69-768x308.png 768w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-69.png 1436w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n\n\n\n<p>\u4fee\u6539GPIO \u7ba1\u811a\u5b9a\u4e49 \u548cSPI\u7ba1\u811a\u5b9a\u4e49,\u5982\u4e0b\u56fe\u6240\u793a ,\u4fee\u6539\u540e\u4fdd\u5b58(\u5982\u5f39\u51fa \u7a97\u53e3\u9700\u8981,\u5219\u5728\u7a97\u53e3\u4e2d\u8f93\u5165\u7ea6\u675f\u6587\u4ef6\u540d,\u7136\u540e\u4fdd\u5b58)<\/p>\n\n\n\n<p>BL T20<\/p>\n\n\n\n<p>D\/C R18<\/p>\n\n\n\n<p>SCL R19<\/p>\n\n\n\n<p>SDA P20<\/p>\n\n\n\n<p>RES N17<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"192\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2022\/03\/image-3-1024x192.png\" alt=\"\" class=\"wp-image-554\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2022\/03\/image-3-1024x192.png 1024w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2022\/03\/image-3-300x56.png 300w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2022\/03\/image-3-768x144.png 768w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2022\/03\/image-3.png 1291w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n\n\n\n<p>10) \u751f\u6210bit\u6587\u4ef6 :\u6309\u4e0bGenerate Bitstream \u5b8c\u6210\u7efc\u5408\u4ee5\u53ca\u751f\u6210bit\u6587\u4ef6<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"303\" height=\"203\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-18.png\" alt=\"\" class=\"wp-image-204\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-18.png 303w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-18-300x201.png 300w\" sizes=\"auto, (max-width: 303px) 100vw, 303px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">5.SDK\u7a0b\u5e8f\u7f16\u5199<\/h2>\n\n\n\n<p>1\uff09File\u2192Export\u2192Export hardware\u2026\uff0c\u5728\u5f39\u51fa\u7684\u5bf9\u8bdd\u6846\u4e2d\u52fe\u9009\u201cinclude bitstream\u201d\uff0c\u70b9\u51fb\u201cOK\u201d\u786e\u8ba4\uff0c\u5982\u4e0b\u56fe\u6240\u793a\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"462\" height=\"541\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-20.png\" alt=\"\" class=\"wp-image-207\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-20.png 462w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-20-256x300.png 256w\" sizes=\"auto, (max-width: 462px) 100vw, 462px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"332\" height=\"252\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-24.png\" alt=\"\" class=\"wp-image-211\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-24.png 332w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-24-300x228.png 300w\" sizes=\"auto, (max-width: 332px) 100vw, 332px\" \/><\/figure>\n\n\n\n<p>2\uff09File\u2192Lauch SDK\uff0c\u5728\u5f39\u51fa\u7684\u5bf9\u8bdd\u6846\u4e2d\uff0c\u4fdd\u5b58\u9ed8\u8ba4\uff0c\u70b9\u51fb\u201cOK\u201d\uff0c\u5982\u4e0b\u56fe\u6240\u793a\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"361\" height=\"285\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-21.png\" alt=\"\" class=\"wp-image-212\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-21.png 361w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-21-300x237.png 300w\" sizes=\"auto, (max-width: 361px) 100vw, 361px\" \/><\/figure>\n\n\n\n<p>\u7cfb\u7edf\u5c06\u81ea\u52a8\u6253\u5f00SDK\u5f00\u53d1\u73af\u5883<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"998\" height=\"748\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-22.png\" alt=\"\" class=\"wp-image-213\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-22.png 998w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-22-300x225.png 300w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-22-768x576.png 768w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n\n\n\n<p>3\uff09\u65b0\u5efa\u4e00\u4e2a\u5de5\u7a0b file\u2192new\u2192Application Project\uff0c\u6765\u65b0\u5efa\u4e00\u4e2a\u201cApplication Project\u201d\uff0c\u5982\u4e0b\u56fe\u6240\u793a\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"624\" height=\"546\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-23.png\" alt=\"\" class=\"wp-image-214\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-23.png 624w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-23-300x263.png 300w\" sizes=\"auto, (max-width: 624px) 100vw, 624px\" \/><\/figure>\n\n\n\n<p>4\uff09\u5728\u65b0\u5efa\u5de5\u7a0b\u540d\u4e2d\u8f93\u5165\u81ea\u5df1\u7684\u5de5\u7a0b\u540d\u79f0\uff0c\u70b9\u51fbNEXT<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"502\" height=\"251\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-75.png\" alt=\"\" class=\"wp-image-332\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-75.png 502w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-75-300x150.png 300w\" sizes=\"auto, (max-width: 502px) 100vw, 502px\" \/><\/figure>\n\n\n\n<p>5)\u9009\u62e9\u4e00\u4e2a\u7a7a\u5de5\u7a0b,\u70b9\u51fb\u5b8c\u6210<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"421\" height=\"194\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-73.png\" alt=\"\" class=\"wp-image-330\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-73.png 421w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-73-300x138.png 300w\" sizes=\"auto, (max-width: 421px) 100vw, 421px\" \/><\/figure>\n\n\n\n<p>6) \u5728\u7a7a\u5de5\u7a0b\u4e2d\u521b\u5efa\u6211\u4eec\u81ea\u5df1\u7684\u4ee3\u7801<\/p>\n\n\n\n<p>\u5c55\u5f00\u6211\u4eec\u521b\u5efa\u7684\u5de5\u7a0b,\u5728src\u76ee\u5f55\u4e0a\u53f3\u952e\uff0c\u9009\u62e9New-&gt;Source File\uff0c\u5982\u4e0b\u56fe\u6240\u793a\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"362\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-76.png\" alt=\"\" class=\"wp-image-333\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-76.png 640w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-76-300x170.png 300w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/figure>\n\n\n\n<p>\u5728\u5f39\u51fa\u7684\u7a97\u53e3\u4e2d\u521b\u5efa\u4e00\u4e2amain.c\u6587\u4ef6<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"528\" height=\"422\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-77.png\" alt=\"\" class=\"wp-image-334\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-77.png 528w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-77-300x240.png 300w\" sizes=\"auto, (max-width: 528px) 100vw, 528px\" \/><\/figure>\n\n\n\n<p>6\uff09\u4e66\u5199\u81ea\u5df1\u7684\u4ee3\u7801<\/p>\n\n\n\n<p>6.1<strong>\u5c0f\u8d34\u58eb\uff1a<\/strong><\/p>\n\n\n\n<p>\u5728\u521d\u6b21\u5199PS\u90e8\u5206\u7684\u4ee3\u7801\u65f6\uff0c\u5982GPIO\u4ee3\u7801 \u4e0d\u77e5\u9053\u600e\u4e48\u5199\u7684\u60c5\u51b5\u4e0b\uff0c\u5176\u5b9e\u53ef\u4ee5\u901a\u8fc7\u6253\u5f00 BSP\u5de5\u7a0b\u4e0b\u7684 system.mss\u6587\u4ef6\uff0c \u7136\u540e\u5728\u53f3\u8fb9\u5bfc\u5165\u9700\u8981\u7684\u53c2\u8003\u4f8b\u7a0b\uff0c \u7136\u540e\u5c06\u4f8b\u7a0b\u4e2d\u81ea\u5df1\u9700\u8981\u7684\u90e8\u5206\uff08\u5982GPIO\u521d\u59cb\u5316\uff0c\u6216\u8005SPI\u7684\u5199\u548c\u8bfb\u4ee3\u7801COPY\u5230\u81ea\u5df1\u5de5\u7a0b\u7684main\u51fd\u6570\u4e2d\uff09<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"528\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-78-1024x528.png\" alt=\"\" class=\"wp-image-341\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-78-1024x528.png 1024w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-78-300x155.png 300w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-78-768x396.png 768w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-78.png 1149w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n\n\n\n<p>6.2\u5b9a\u4e49GPIO\u90e8\u5206<\/p>\n\n\n\n<p>\u4e0b\u9762\u8fdb\u5165\u6b63\u9898\uff0c \u6211\u4eec\u8981\u70b9\u4eae\u5c4f\u5e55\uff0c \u5c4f\u5e55\u8fd9\u91cc\u7528\u4e865\u4e2aGPIO \u90fd\u662f\u7528\u4e86ZYNQ PS\u7aef\u7684EMIO\u8d44\u6e90\uff0c EMIO\u7684GPIO\u8d44\u6e90\u662f\u4ece54\u5f00\u59cb\u7684\uff0c \u6240\u4ee5\u6211\u4eec\u6839\u636eFPGA\u7ba1\u811a\u7ea6\u675f\u4e2d\u7684 GPIO 0-4 \u5206\u522b\u5bf9\u5e94 EMIO\u768454-55-56-57-58\uff0c\u5982\u4e0b\u56fe\u5bf9GPIO\u8fdb\u884c\u5b9a\u4e49<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">#define EMIO_LCD_BL    \t54\n#define EMIO_LCD_CD  \t55\n#define EMIO_LCD_RES \t56\n#define EMIO_LCD_SCL    57\n#define EMIO_LCD_SDA \t58<\/pre>\n\n\n\n<p>6.3\u5bf9GPIO\u90e8\u5206\u8fdb\u884c\u521d\u59cb\u5316<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">void Lcd_Gpio_Init(void){\n\tXGpioPs_Config *ConfigPtr;\n\n\tConfigPtr = XGpioPs_LookupConfig(GPIO_DEVICE_ID);\n\tXGpioPs_CfgInitialize(&amp;Gpio, ConfigPtr,ConfigPtr-&gt;BaseAddr);\n\n\tXGpioPs_SetDirectionPin(&amp;Gpio, EMIO_LCD_BL, 1);\n\tXGpioPs_SetOutputEnablePin(&amp;Gpio, EMIO_LCD_BL, 1);\n\tXGpioPs_WritePin(&amp;Gpio, EMIO_LCD_BL, 0);\n\n\tXGpioPs_SetDirectionPin(&amp;Gpio, EMIO_LCD_CD, 1);\n\tXGpioPs_SetOutputEnablePin(&amp;Gpio, EMIO_LCD_CD, 1);\n\tXGpioPs_WritePin(&amp;Gpio, EMIO_LCD_CD, 0);\n\n\tXGpioPs_SetDirectionPin(&amp;Gpio, EMIO_LCD_RES, 1);\n\tXGpioPs_SetOutputEnablePin(&amp;Gpio, EMIO_LCD_RES, 1);\n\tXGpioPs_WritePin(&amp;Gpio, EMIO_LCD_RES, 0);\n\n\tXGpioPs_SetDirectionPin(&amp;Gpio, EMIO_LCD_SCL, 1);\n\tXGpioPs_SetOutputEnablePin(&amp;Gpio, EMIO_LCD_SCL, 1);\n\tXGpioPs_WritePin(&amp;Gpio, EMIO_LCD_RES, 0);\n\n\n\tXGpioPs_SetDirectionPin(&amp;Gpio, EMIO_LCD_SDA, 1);\n\tXGpioPs_SetOutputEnablePin(&amp;Gpio, EMIO_LCD_SDA, 1);\n\tXGpioPs_WritePin(&amp;Gpio, EMIO_LCD_RES, 0);\n}<\/pre>\n\n\n\n<p>\u5148\u5b9a\u4e49\u4e00\u4e2aXgpioPs \u7684\u7ed3\u6784\u4f53\u6307\u9488\uff0c \u8fd9\u4e2a\u6307\u9488\u7684\u5185\u5bb9\u5305\u62ecgpio\u5206\u914d\u7684ID\u548c\u57fa\u5730\u5740\uff0c\u8fd9\u4e9b\u4fe1\u606f\u901a\u5e38\u5728xparameter.h\u5934\u6587\u4ef6\u4e2d\uff0c \u53ef\u4ee5\u901a\u8fc7\u4f7f\u7528XGpioPs_LookupConfig\u51fd\u6570\uff0c\u5b83\u80fd\u591f\u5728\u914d\u7f6e\u4fe1\u606f\u4e2d\u627e\u5230\u5bf9\u5e94ID\u7684\u914d\u7f6e\u4fe1\u606f<\/p>\n\n\n\n<p>ConfigPtr=XGpioPs_LookupConfig(GPIO_DEVICE_ID); \u5c31\u76f8\u5f53\u4e8e\u628a\u83b7\u5f97\u5230\u7684\u4fe1\u606f\u8d4b\u4e88\u7ed9\u4e4b\u524d\u5b9a\u4e49\u7684ConfigPtr\u7ed3\u6784\u4f53<\/p>\n\n\n\n<p>\u6700\u7ec8\u518d\u7528 XGpioPs_CfgInitialize \u51fd\u6570\u6765\u521d\u59cb\u5316GPIO<\/p>\n\n\n\n<p>GPIO\u7684\u4f7f\u7528 \uff08EMIO_LCD_BL\u4e3a\u4e4b\u524d\u5b9a\u4e49\u7684 EMIO 54 \u7684\u7ba1\u811a\uff09<\/p>\n\n\n\n<p>XGpioPs_SetDirectionPin(&amp;Gpio, EMIO_LCD_BL, 1);\/\/\u8bbe\u7f6e\u6210\u8f93\u51fa\u6a21\u5f0f<\/p>\n\n\n\n<p>XGpioPs_SetOutputEnablePin(&amp;Gpio, EMIO_LCD_BL, 1);\/\/\u6253\u5f00\u8f93\u51fa\u4f7f\u80fd<br><\/p>\n\n\n\n<p>XGpioPs_WritePin(&amp;Gpio, EMIO_LCD_BL, 0);\/\/ 0\u7f6e\u4f4e<\/p>\n\n\n\n<p>XGpioPs_WritePin(&amp;Gpio, EMIO_LCD_BL, 1);\/\/ 1\u62c9\u9ad8<\/p>\n\n\n\n<p><strong>\u4e3a\u4e86\u7b80\u5316\u4ee3\u7801\u7684\u7f16\u5199 \u8fd9\u91cc\u7528 define \u6765\u7b80\u5316\u62c9\u9ad8\u62c9\u4f4e\u7684\u64cd\u4f5c<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#define LCD_SDA_HIGH XGpioPs_WritePin(&amp;Gpio, EMIO_LCD_SDA, 1)\n#define LCD_SDA_LOW  XGpioPs_WritePin(&amp;Gpio, EMIO_LCD_SDA, 0)\n\n#define LCD_SCL_HIGH XGpioPs_WritePin(&amp;Gpio, EMIO_LCD_SCL, 1)\n#define LCD_SCL_LOW  XGpioPs_WritePin(&amp;Gpio, EMIO_LCD_SCL, 0)\n\n#define LCD_BLK_HIGH XGpioPs_WritePin(&amp;Gpio, EMIO_LCD_BLK, 1)\n#define LCD_BLK_LOW  XGpioPs_WritePin(&amp;Gpio, EMIO_LCD_BLK, 0)\n\n#define LCD_CD_HIGH XGpioPs_WritePin(&amp;Gpio, EMIO_LCD_CD, 1)\n#define LCD_CD_LOW  XGpioPs_WritePin(&amp;Gpio, EMIO_LCD_CD, 0)\n\n#define LCD_RES_HIGH XGpioPs_WritePin(&amp;Gpio, EMIO_LCD_RES, 1)\n#define LCD_RES_LOW  XGpioPs_WritePin(&amp;Gpio, EMIO_LCD_RES, 0)<\/code><\/pre>\n\n\n\n<p>IO\u6a21\u62dfSPI \u90e8\u5206\u4ee3\u7801\u7f16\u5199<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>void delay_spi_nop(){\n\tvolatile int Delay;\n\tfor (Delay = 0; Delay &lt; 1; Delay++);\n}\n\nvoid spi_send(unsigned char dat){\n\tunsigned char i;\n\tfor(i=0;i&lt;8;i++){\n\t\tLCD_SCL_LOW;\n\t\tdelay_spi_nop();\n\t\tif(dat&amp;0x80)LCD_SDA_HIGH;\n\t\telse LCD_SDA_LOW;\n\t\tdelay_spi_nop();\n\t\tLCD_SCL_HIGH;\n\t\tdelay_spi_nop();\n\t\tdat=dat&lt;&lt;1;\n\t}\n}<\/code><\/pre>\n\n\n\n<p>delay_spi_nop()\u51fd\u6570\u4e2d\u7684\u4e00\u6b21\u5faa\u73af\uff0c\u53ea\u662f\u4e3a\u4e86\u4ea7\u751f\u4e00\u4e2a\u77ed\u6682\u7684\u5ef6\u65f6\uff0c \u7c7b\u4f3c\u5355\u7247\u673a\u7684_nop_()\uff1b\u51fd\u6570\uff0c\u53ea\u662f\u5728 zynq sdk\u7684\u5e93\u4e2d\u6682\u65f6\u6ca1\u627e\u5230\u8fd9\u4e2a\u51fd\u6570<\/p>\n\n\n\n<p>7\uff09\u5c06\u4ee3\u7801\u6574\u5408\u540e\u5982\u4e0b\uff0c\u4e0b\u9762\u662f\u5b8c\u6574\u7684\u5c4f\u5e55\u9a71\u52a8\u4ee3\u7801\uff0c\u5c06\u4ee3\u7801\u590d\u5236\u5230main.c\u4e2d<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">#include \"xparameters.h\"\n#include \"xgpiops.h\"\n#include \"xstatus.h\"\n#include \"xplatform_info.h\"\n\n#include &lt;xil_printf.h&gt;\n\n#define WHITE         \t 0xFFFF\n#define BLACK         \t 0x0000\n#define BLUE         \t 0x001F\n#define BRED             0XF81F\n#define GRED \t\t \t 0XFFE0\n#define GBLUE\t\t \t 0X07FF\n#define RED           \t 0xF800\n#define MAGENTA       \t 0xF81F\n#define GREEN         \t 0x07E0\n#define CYAN          \t 0x7FFF\n#define YELLOW        \t 0xFFE0\n#define BROWN \t         0XBC40\n#define BRRED \t\t \t 0XFC07\n#define GRAY  \t\t \t 0X8430\n\n#define EMIO_LCD_BLK    54\n#define EMIO_LCD_CD  \t55\n#define EMIO_LCD_RES \t56\n#define EMIO_LCD_SCL    57\n#define EMIO_LCD_SDA \t58\n\n#define GPIO_DEVICE_ID  \tXPAR_XGPIOPS_0_DEVICE_ID\n#define SPI_DEVICE_ID\t\tXPAR_XSPIPS_0_DEVICE_ID\nXGpioPs Gpio;\t\/* The driver instance for GPIO Device. *\/\n\n\n#define LCD_SDA_HIGH XGpioPs_WritePin(&amp;Gpio, EMIO_LCD_SDA, 1)\n#define LCD_SDA_LOW  XGpioPs_WritePin(&amp;Gpio, EMIO_LCD_SDA, 0)\n\n#define LCD_SCL_HIGH XGpioPs_WritePin(&amp;Gpio, EMIO_LCD_SCL, 1)\n#define LCD_SCL_LOW  XGpioPs_WritePin(&amp;Gpio, EMIO_LCD_SCL, 0)\n\n#define LCD_BLK_HIGH XGpioPs_WritePin(&amp;Gpio, EMIO_LCD_BLK, 1)\n#define LCD_BLK_LOW  XGpioPs_WritePin(&amp;Gpio, EMIO_LCD_BLK, 0)\n\n#define LCD_CD_HIGH XGpioPs_WritePin(&amp;Gpio, EMIO_LCD_CD, 1)\n#define LCD_CD_LOW  XGpioPs_WritePin(&amp;Gpio, EMIO_LCD_CD, 0)\n\n#define LCD_RES_HIGH XGpioPs_WritePin(&amp;Gpio, EMIO_LCD_RES, 1)\n#define LCD_RES_LOW  XGpioPs_WritePin(&amp;Gpio, EMIO_LCD_RES, 0)\n\n\nvoid delay_spi_nop(){\n\tvolatile int Delay;\n\tfor (Delay = 0; Delay &lt; 1; Delay++);\n}\n\nvoid spi_send(unsigned char dat){\n\tunsigned char i;\n\tfor(i=0;i&lt;8;i++){\n\t\tLCD_SCL_LOW;\n\t\tdelay_spi_nop();\n\t\tif(dat&amp;0x80)LCD_SDA_HIGH;\n\t\telse LCD_SDA_LOW;\n\t\tdelay_spi_nop();\n\t\tLCD_SCL_HIGH;\n\t\tdelay_spi_nop();\n\t\tdat=dat&lt;&lt;1;\n\t}\n}\n\n\nvoid Lcd_Gpio_Init(void){\n\tXGpioPs_Config *ConfigPtr;\n\n\tConfigPtr = XGpioPs_LookupConfig(GPIO_DEVICE_ID);\n\tXGpioPs_CfgInitialize(&amp;Gpio, ConfigPtr,ConfigPtr-&gt;BaseAddr);\n\n\tXGpioPs_SetDirectionPin(&amp;Gpio, EMIO_LCD_BLK, 1);\n\tXGpioPs_SetOutputEnablePin(&amp;Gpio, EMIO_LCD_BLK, 1);\n\tXGpioPs_WritePin(&amp;Gpio, EMIO_LCD_BLK, 0);\n\n\tXGpioPs_SetDirectionPin(&amp;Gpio, EMIO_LCD_CD, 1);\n\tXGpioPs_SetOutputEnablePin(&amp;Gpio, EMIO_LCD_CD, 1);\n\tXGpioPs_WritePin(&amp;Gpio, EMIO_LCD_CD, 1);\n\n\tXGpioPs_SetDirectionPin(&amp;Gpio, EMIO_LCD_RES, 1);\n\tXGpioPs_SetOutputEnablePin(&amp;Gpio, EMIO_LCD_RES, 1);\n\tXGpioPs_WritePin(&amp;Gpio, EMIO_LCD_RES, 1);\n\n\tXGpioPs_SetDirectionPin(&amp;Gpio, EMIO_LCD_SCL, 1);\n\tXGpioPs_SetOutputEnablePin(&amp;Gpio, EMIO_LCD_SCL, 1);\n\tXGpioPs_WritePin(&amp;Gpio, EMIO_LCD_SCL, 1);\n\n\n\tXGpioPs_SetDirectionPin(&amp;Gpio, EMIO_LCD_SDA, 1);\n\tXGpioPs_SetOutputEnablePin(&amp;Gpio, EMIO_LCD_SDA, 1);\n\tXGpioPs_WritePin(&amp;Gpio, EMIO_LCD_SDA, 1);\n}\n\n\nvoid delay(unsigned int i){\n\tvolatile int Delay;\n\tvolatile int k;\n\tfor(k=0;k&lt;i;k++)\n\tfor (Delay = 0; Delay &lt; 10000; Delay++);\n}\n\nvoid LCD_WR_DATA8(u8 dat){\n\tLCD_CD_HIGH;\n\tspi_send(dat);\n}\n\nvoid LCD_WR_REG(u8 dat){\n\tLCD_CD_LOW;\n\tspi_send(dat);\n}\n\nvoid Lcd_Init(void){\n  LCD_RES_HIGH;\n  delay(500);\n  LCD_RES_LOW;\n  delay(500);\n  LCD_RES_HIGH;\n  delay(500);\n  LCD_WR_REG(0x36);\n  LCD_WR_DATA8(0x00);\n  LCD_WR_REG(0x3A);\n  LCD_WR_DATA8(0x05);\n  LCD_WR_REG(0xB2);\n  LCD_WR_DATA8(0x0C);\n  LCD_WR_DATA8(0x0C);\n  LCD_WR_DATA8(0x00);\n  LCD_WR_DATA8(0x33);\n  LCD_WR_DATA8(0x33);\n  LCD_WR_REG(0xB7);\n  LCD_WR_DATA8(0x35);\n  LCD_WR_REG(0xBB);\n  LCD_WR_DATA8(0x19);\n  LCD_WR_REG(0xC0);\n  LCD_WR_DATA8(0x2C);\n  LCD_WR_REG(0xC2);\n  LCD_WR_DATA8(0x01);\n  LCD_WR_REG(0xC3);\n  LCD_WR_DATA8(0x12);\n  LCD_WR_REG(0xC4);\n  LCD_WR_DATA8(0x20);\n  LCD_WR_REG(0xC6);\n  LCD_WR_DATA8(0x0F);\n  LCD_WR_REG(0xD0);\n  LCD_WR_DATA8(0xA4);\n  LCD_WR_DATA8(0xA1);\n  LCD_WR_REG(0xE0);\n  LCD_WR_DATA8(0xD0);\n  LCD_WR_DATA8(0x04);\n  LCD_WR_DATA8(0x0D);\n  LCD_WR_DATA8(0x11);\n  LCD_WR_DATA8(0x13);\n  LCD_WR_DATA8(0x2B);\n  LCD_WR_DATA8(0x3F);\n  LCD_WR_DATA8(0x54);\n  LCD_WR_DATA8(0x4C);\n  LCD_WR_DATA8(0x18);\n  LCD_WR_DATA8(0x0D);\n  LCD_WR_DATA8(0x0B);\n  LCD_WR_DATA8(0x1F);\n  LCD_WR_DATA8(0x23);\n  LCD_WR_REG(0xE1);\n  LCD_WR_DATA8(0xD0);\n  LCD_WR_DATA8(0x04);\n  LCD_WR_DATA8(0x0C);\n  LCD_WR_DATA8(0x11);\n  LCD_WR_DATA8(0x13);\n  LCD_WR_DATA8(0x2C);\n  LCD_WR_DATA8(0x3F);\n  LCD_WR_DATA8(0x44);\n  LCD_WR_DATA8(0x51);\n  LCD_WR_DATA8(0x2F);\n  LCD_WR_DATA8(0x1F);\n  LCD_WR_DATA8(0x1F);\n  LCD_WR_DATA8(0x20);\n  LCD_WR_DATA8(0x23);\n  LCD_WR_REG(0x21);\n  LCD_WR_REG(0x11);\n  LCD_WR_REG(0x29);\n\n  LCD_BLK_HIGH;\n  }\n\n\n\n\n void LCD_WR_DATA(u16 dat)\n{\n\tu8 spi_dat;\n\tLCD_CD_HIGH;\n    spi_dat=dat&gt;&gt;8;\n\tspi_send(spi_dat);\n    spi_dat=dat;\n\tspi_send(spi_dat);\n}\n\nvoid Address_set(unsigned int x1,unsigned int y1,unsigned int x2,unsigned int y2)\n{\n   LCD_WR_REG(0x2a);\n   LCD_WR_DATA8(x1&gt;&gt;8);\n   LCD_WR_DATA8(x1);\n   LCD_WR_DATA8(x2&gt;&gt;8);\n   LCD_WR_DATA8(x2);\n   LCD_WR_REG(0x2b);\n   LCD_WR_DATA8(y1&gt;&gt;8);\n   LCD_WR_DATA8(y1);\n   LCD_WR_DATA8(y2&gt;&gt;8);\n   LCD_WR_DATA8(y2);\n   LCD_WR_REG(0x2C);\n}\n\n\n\nvoid LCD_Test()\n{\n    unsigned int i,j;\n    Address_set(0,0,240-1,240-1);\n\n    for(i=0;i&lt;240;i++){\n\n    \tif(i&gt;=0&amp;&amp;i&lt;60)\n    \t\tfor (j=0;j&lt;240;j++)LCD_WR_DATA(WHITE);\n\n    \telse if(i&gt;=60&amp;&amp;i&lt;120)\n    \t\tfor (j=0;j&lt;240;j++)LCD_WR_DATA(RED);\n\n    \telse if(i&gt;=120&amp;&amp;i&lt;180)\n    \t\tfor (j=0;j&lt;240;j++)LCD_WR_DATA(GREEN);\n\n    \telse if(i&gt;=180&amp;&amp;i&lt;240)\n    \t\tfor (j=0;j&lt;240;j++)LCD_WR_DATA(BLUE);\n    }\n}\n\n\n\nint main(void)\n{\n\tLcd_Gpio_Init();\n\n\tLcd_Init();\n\tLCD_Test();\n\n\twhile(1){\n\t\t\n\t};\n\n\treturn XST_SUCCESS;\n}\n<\/pre>\n\n\n\n<p>8\uff09\u7528\u4e4b\u524d\u751f\u6210\u7684\u4e8c\u8fdb\u5236\u6587\u4ef6\u5bf9FPGA\u8fdb\u884c\u7f16\u7a0b\uff0c<code>Xilinx Tools<\/code>&nbsp;-&gt;&nbsp;<code>Program FPGA<\/code>&nbsp;\u7136\u540e\u70b9\u51fb \u201cProgram\u201d<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"307\" height=\"252\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-57.png\" alt=\"\" class=\"wp-image-293\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-57.png 307w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-57-300x246.png 300w\" sizes=\"auto, (max-width: 307px) 100vw, 307px\" \/><\/figure>\n\n\n\n<p>9\uff09\u5f53FPGA\u7f16\u7a0b\u6210\u529f\u540e\uff0c\u6211\u4eec\u9700\u8981\u521d\u59cb\u5316zynq\u4e2d\u7684\u5904\u7406\u5668\uff0c\u53f3\u952e\u70b9\u51fb\u521a\u624d\u521b\u5efa\u7684\u7a7a\u5de5\u7a0b\uff0c\u9009\u62e9<code>Run As<\/code>&nbsp;-&gt;&nbsp;<code>Launch on Hardware (System Debugger)<\/code>&nbsp;\u6216\u8005 Launch on Hardware (GDB).<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"703\" height=\"501\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-79.png\" alt=\"\" class=\"wp-image-347\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-79.png 703w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-79-300x214.png 300w\" sizes=\"auto, (max-width: 703px) 100vw, 703px\" \/><\/figure>\n\n\n\n<p>\u7ecf\u8fc7\u4e0a\u8ff0\u64cd\u4f5c\uff0c\u5c4f\u5e55\u5c31\u88ab\u6210\u529f\u70b9\u4eae\u4e86\uff0c \u6b63\u5e38\u663e\u793a 4\u8272\u5f69\u6761\u7eb9\uff0c\u5982\u4e0b\u56fe\u6240\u793a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"415\" height=\"552\" src=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-80.png\" alt=\"\" class=\"wp-image-348\" srcset=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-80.png 415w, http:\/\/www.hellofpga.com\/wp-content\/uploads\/2021\/08\/image-80-226x300.png 226w\" sizes=\"auto, (max-width: 415px) 100vw, 415px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">\u4ee3\u7801\u89e3\u91ca<\/h2>\n\n\n\n<p>\u4ee5\u4e0a\u662f\u5b8c\u6574\u7684\u5de5\u7a0b\u56fe\u6587\u521b\u5efa\u8fc7\u7a0b\uff0c \u9664\u4e86\u4e0a\u9762\u63d0\u5230\u7684GPIO\u4ee3\u7801\u5916\uff0c\u4e0b\u9762\u7b80\u5355\u4ecb\u7ecd\u4e0b \u5de5\u7a0b\u4e2d\u7684\u5176\u4f59\u7684\u4e00\u4e9b\u51fd\u6570\u4ee3\u7801<\/p>\n\n\n\n<p>1\uff09\u5173\u4e8e\u989c\u8272<\/p>\n\n\n\n<p>\u5c4f\u5e55\u672c\u8eab\u662f16\u8272 \u4e5f\u5c31\u662fRGB565\u7684\u989c\u8272\u9a71\u52a8\u65b9\u5f0f \uff0c\u6240\u4ee5\u8fd9\u91cc\u53ef\u4ee5\u7528 16\u5b57\u8282\u6765\u5b9a\u4e49\u4e0d\u540c\u7684\u989c\u8272\uff0c\u5982\u7a0b\u5e8f\u4e2d\u7684\u7ea2\u7eff\u84dd\u767d\uff0c\u4ee5\u53ca\u4e0b\u9762\u6807\u6ce8\u7684\u5176\u4ed6\u989c\u8272\uff0c \u5f53\u7136\u4e5f\u53ef\u4ee5\u6839\u636eRGB\u7684\u989c\u8272\u7ec4\u5408\u6765\u5408\u6210\u81ea\u5df1\u9700\u8981\u7684\u989c\u8272<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">#define WHITE         \t 0xFFFF\n#define BLACK         \t 0x0000\n#define BLUE         \t 0x001F\n#define BRED             0XF81F\n#define GRED \t\t 0XFFE0\n#define GBLUE\t\t 0X07FF\n#define RED           \t 0xF800\n#define MAGENTA       \t 0xF81F\n#define GREEN         \t 0x07E0\n#define CYAN          \t 0x7FFF\n#define YELLOW        \t 0xFFE0\n#define BROWN \t         0XBC40\n#define BRRED \t\t 0XFC07\n#define GRAY  \t\t 0X8430<\/pre>\n\n\n\n<p id=\"block-406e7490-888d-46bd-9c00-0bb3cd759e6e\">2)\u5173\u4e8e\u5f69\u8272\u6761\u7eb9 \uff0c\u5982\u4e0b\u4ee3\u7801\uff0c0-60\u884c\u663e\u793a\u767d\u8272\uff0c60-120\u663e\u793a\u7ea2\u8272\uff0c120-180\u663e\u793a\u7eff\u8272\uff0c180-240\u663e\u793a\u84dd\u8272<\/p>\n\n\n\n<p>Address_set(0,0,240-1,240-1); \u76f8\u5f53\u4e8e\u662f\u5b9a\u4e49\u4e00\u5757\u77e9\u5f62\u533a\u57df\uff0c0\uff0c0\uff0c240\uff0c240\u5206\u522b\u662f\u8fd9\u4e2a\u77e9\u5f62\u7684\u56db\u4e2a\u5750\u6807\u70b9\uff08\u8fd9\u91cc\u6db5\u76d6\u4e86\u6574\u4e2a\u5c4f\u5e55\u7684\u7a7a\u95f4\uff0c\u4e5f\u53ef\u4ee5\u81ea\u5b9a\u4e49\u90e8\u5206\u533a\u57df\uff0c\u8be6\u7ec6\u770b\u5c4f\u5e55\u624b\u518c\uff09<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">void LCD_Test()\n{\n    unsigned int i,j;\n    Address_set(0,0,240-1,240-1);\n\n    for(i=0;i&lt;240;i++){\n\n    \tif(i&gt;=0&amp;&amp;i&lt;60)\n    \t\tfor (j=0;j&lt;240;j++)LCD_WR_DATA(WHITE);\n\n    \telse if(i&gt;=60&amp;&amp;i&lt;120)\n    \t\tfor (j=0;j&lt;240;j++)LCD_WR_DATA(RED);\n\n    \telse if(i&gt;=120&amp;&amp;i&lt;180)\n    \t\tfor (j=0;j&lt;240;j++)LCD_WR_DATA(GREEN);\n\n    \telse if(i&gt;=180&amp;&amp;i&lt;240)\n    \t\tfor (j=0;j&lt;240;j++)LCD_WR_DATA(BLUE);\n    }\n}<\/pre>\n\n\n\n<p>\u6700\u540e\u4ecb\u7ecdmain \u51fd\u6570\uff0c\u5176\u5b9e\u7279\u522b\u7b80\u5355\uff0c\u5305\u62ecGPIO\u7684\u521d\u59cb\u5316\uff0c\u4ee5\u53ca\u5c4f\u5e55\u7684\u521d\u59cb\u5316\uff08\u5c4f\u5e55\u5185\u90e8\u5bc4\u5b58\u5668\u7684\u914d\u7f6e \u914d\u7f6e\u4fe1\u606f\u7531\u5382\u5bb6\u76f4\u63a5\u63d0\u4f9b\uff09\uff0c\u4ee5\u53ca\u5c4f\u5e55\u6d4b\u8bd5\u51fd\u6570\u7684\u8c03\u7528<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">int main(void)\n{\n\tLcd_Gpio_Init();\n\n\tLcd_Init();\n\tLCD_Test();\n\n\twhile(1);\n\n\treturn XST_SUCCESS;\n}<\/pre>\n\n\n\n<p>\u4ee5\u4e0b\u9644\u4ef6\u4e3a \u672c\u9875\u5185\u5bb9\u7684\u5b8c\u6574\u5de5\u7a0b<\/p>\n\n\n\n<div class=\"wp-block-file\"><a id=\"wp-block-file--media-23da7b3c-1176-4b6f-9876-4a51099710b4\" href=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2022\/03\/10_PS_LCD_TEST_IO.zip\">10_PS_LCD_TEST_IO<\/a><a href=\"http:\/\/www.hellofpga.com\/wp-content\/uploads\/2022\/03\/10_PS_LCD_TEST_IO.zip\" class=\"wp-block-file__button wp-element-button\" download aria-describedby=\"wp-block-file--media-23da7b3c-1176-4b6f-9876-4a51099710b4\">\u4e0b\u8f7d<\/a><\/div>\n\n\n\n<p><\/p>\n\n\n\n<p>PS GPIO\u6a21\u62dfSPI\u548c\u786c\u4ef6SPI\u90fd\u53ef\u4ee5\u7a33\u5b9a\u7684\u70b9\u4eaeLCD\u5c4f\u5e55\uff0c\u6839\u636e\u81ea\u5df1\u7684\u9700\u6c42\u53bb\u9009\u62e9\uff08\u786c\u4ef6SPI\u6267\u884c\u6548\u7387\u6bd4GPIO\u6a21\u62dfSPI\u4f1a\u66f4\u9ad8\u4e00\u4e9b\uff0c GPIO\u6a21\u62df\u7684\u65b9\u5f0f\u66f4\u76f4\u89c2\u4e00\u4e9b\uff09<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u6587\u4ecb\u7ecd\u4e86\u4e00\u79cd\u7528IO\u53e3\u53bb\u6a21\u62dfSPI\u7684\u65b9\u5f0f\u6765\u70b9\u4eae\u6269\u5c55\u677f\u7684LCD \u8d44\u6e90<\/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-546","post","type-post","status-publish","format-standard","hentry","category-ebaz4205"],"views":708,"_links":{"self":[{"href":"http:\/\/www.hellofpga.com\/index.php\/wp-json\/wp\/v2\/posts\/546","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=546"}],"version-history":[{"count":21,"href":"http:\/\/www.hellofpga.com\/index.php\/wp-json\/wp\/v2\/posts\/546\/revisions"}],"predecessor-version":[{"id":6213,"href":"http:\/\/www.hellofpga.com\/index.php\/wp-json\/wp\/v2\/posts\/546\/revisions\/6213"}],"wp:attachment":[{"href":"http:\/\/www.hellofpga.com\/index.php\/wp-json\/wp\/v2\/media?parent=546"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.hellofpga.com\/index.php\/wp-json\/wp\/v2\/categories?post=546"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.hellofpga.com\/index.php\/wp-json\/wp\/v2\/tags?post=546"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}