{"id":199,"date":"2024-05-09T12:24:06","date_gmt":"2024-05-09T04:24:06","guid":{"rendered":"https:\/\/wp.ytdx.cc\/?p=199"},"modified":"2024-05-09T12:24:06","modified_gmt":"2024-05-09T04:24:06","slug":"max7219%e7%ba%a7%e8%81%94","status":"publish","type":"post","link":"https:\/\/wp.ytdx.cc\/index.php\/2024\/05\/09\/max7219%e7%ba%a7%e8%81%94\/","title":{"rendered":"MAX7219\u7ea7\u8054"},"content":{"rendered":"\n<figure class=\"wp-block-table\"><table><tbody><tr><td>Arduino-ESP8266\u4e4bMAX7219 8\u4f4d\u6570\u7801\u7ba1\u7ea7\u8054\u7684\u5b9e\u73b0&nbsp;<a href=\"https:\/\/www.geek-workshop.com\/thread-37524-1-1.html\">[\u590d\u5236\u94fe\u63a5]<\/a><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><\/td><td><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td rowspan=\"2\"><a href=\"https:\/\/www.geek-workshop.com\/home.php?mod=space&amp;uid=7009\" target=\"_blank\" rel=\"noreferrer noopener\">duocool<\/a><a href=\"https:\/\/www.geek-workshop.com\/home.php?mod=space&amp;uid=7009\" target=\"_blank\" rel=\"noreferrer noopener\"><\/a><\/td><td>\u7535\u68af\u76f4\u8fbe<a href=\"javascript:;\"><\/a><strong><a href=\"https:\/\/www.geek-workshop.com\/thread-37524-1-1.html\"><em>1<\/em><sup>#<\/sup><\/a><\/strong><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.geek-workshop.com\/static\/image\/common\/online_member.gif?w=640&#038;ssl=1\">&nbsp;<em>\u53d1\u8868\u4e8e 2018-5-18 16:26:58<\/em>&nbsp;|&nbsp;<a href=\"https:\/\/www.geek-workshop.com\/forum.php?mod=viewthread&amp;tid=37524&amp;page=1&amp;authorid=7009\">\u53ea\u770b\u8be5\u4f5c\u8005<\/a>&nbsp;<img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.geek-workshop.com\/static\/image\/common\/arw_r.gif?w=640&#038;ssl=1\" alt=\"\u56de\u5e16\u5956\u52b1\">&nbsp; &nbsp; \u5148\u4e0a\u6700\u7ec8\u6548\u679c\uff0c\u611f\u89c9\u8fd8\u662f\u53ef\u4ee5\u7684\uff0c\u4e0d\u8fc7\u8981\u662f\u60f3\u5b8c\u7f8e\uff0c\u5f97\u50cf\u5356\u5f97\u633a\u706b\u7684\u90a3\u79cd\u6728\u58f3\u949f\u4e00\u6837\uff0c\u5e73\u5e38\u50cf\u5757\u6728\u5934\uff0c\u663e\u793a\u7684\u65f6\u5019\u624d\u900f\u51fa\u6765\uff0c\u4e0d\u8fc7\u6ca1\u627e\u5230\u5408\u9002\u7684\u5916\u58f3\u3002<br>&nbsp; &nbsp; \u6700\u8fd1\u60f3\u7528arduino-esp8266\u7f51\u4e0a\u6293\u70b9\u4e1c\u897f\u4e0b\u6765\u73a9\uff0c\u5148\u8bd5\u4e86\u8bd5OLED\u6a21\u5757\uff0c\u7f51\u4e0a0.9\u5bf8\u7684\u591a\uff0c\u6015\u5c0f\u4e70\u4e861.3\u5bf8\u7684\uff0c\u5012\u662f\u641e\u5b9a\u4e86\u663e\u793a\uff0c\u4e0d\u8fc7\u611f\u89c9\u8fd8\u662f\u5c0f\uff0c\u4e0d\u591f\u7528\u3002<br><br>&nbsp; &nbsp;&nbsp;&nbsp;\u8fd8\u6709\u79cd\u529e\u6cd5\u662f\u7528\u7535\u5b50\u7eb8\u6a21\u5757\uff0c\u6dd8\u5b9d\u4e0a\u4e5f\u6709\u73b0\u6210\u7684\uff0c\u4e0d\u8fc72\uff0c3\u767e\u7684\u4ef7\u94b1\u611f\u89c9\u6027\u4ef7\u6bd4\u4e0d\u9ad8\u3002\u540e\u6765\u51b3\u5b9a\u7528\u4e0b\u9762\u8fd9\u79cdMax7219 8\u6bb5\u6570\u7801\u7ba1\u6a21\u5757<br><br><br>\u8fd9\u79cd\u6a21\u5757\u4ece5\u5757\u591a\u523010\u591a\u5757\uff0c\u6837\u5b50\u90fd\u5dee\u4e0d\u591a\uff0c\u90fd\u5ba3\u79f0\u4e09\u7ebf\u9a71\u52a8\uff0c\u652f\u6301\u7ea7\u8054\uff0c\u6709\u4f8b\u7a0b\u3002\u6709\u710a\u7684\u4e5f\u6709\u6ca1\u710a\u63a5\u53e3\u7684\uff0c\u6211\u7701\u4e8b\u4e70\u4e867\u5757\u591a\u7684\u710a\u4e86\u7684\uff0c\u540e\u7684\u53d1\u89c9\u8981\u7ea7\u8054\u8fd8\u662f\u5f97\u710a\uff0c\u8fd8\u4e0d\u5982\u4e70\u6ca1\u710a\u63a5\u53e3\u7684\uff0c\u81ea\u5df1\u63a5\u7ebf\u8fd8\u80fd\u7d27\u51d1\u70b9\u3002<br><br>&nbsp; &nbsp;\u7136\u540e\u5c31\u662f\u586b\u7ea7\u8054\u8fd9\u4e2a\u5751\u4e86\u3002\u6700\u7701\u529b\u7684\u5e94\u8be5\u662f\u7528LedControl\u8fd9\u4e2a\u5e93\u4e86\uff0c\u8bba\u575b\u91cc\u4e5f\u6709\u7528\u8fd9\u4e2a\u5e93max7219 \u7ea7\u8054LED\u70b9\u9635\u7684\u4f8b\u5b50\u3002\u4e0d\u8fc7\u4e0d\u7ba1\u600e\u4e48\u8bd5\uff0c\u90fd\u662f\u62a5\u9519\uff0c\u597d\u8c61\u8fd9\u4e2a\u5e93\u662f\u4e0d\u652f\u6301esp8266\u7684\u3002\u95ee\u5356\u5bb6\u8981\u5230\u4f8b\u7a0b\uff0carduino\u7684\u4f8b\u7a0b\u53ea\u6709\u5355\u4e2a\u6a21\u5757\u7684\uff0c\u8fd9\u4e2a\u6837\u5b50\uff0c\u6ca1\u7528\u4ec0\u4e48\u5e93\uff0c\u611f\u89c9\u5c31\u662f\u522b\u7684\u5355\u7247\u673a\u7684c\u4ee3\u7801\u76f4\u63a5\u79fb\u503c\u8fc7\u6765\u7684\u3002<br>\/*******************************************************************************&nbsp; &nbsp; &nbsp; &nbsp;<br>* Software Author:&nbsp; &nbsp; &nbsp; &nbsp; HQ&nbsp; &nbsp; &nbsp; &nbsp;<br>* Creation Date:&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;2015-2-10<br>* Software History:&nbsp; &nbsp; &nbsp; &nbsp; 2015-3-10<br>* Version:&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;2.0<br>* Sales address\uff1a&nbsp; &nbsp;&nbsp; &nbsp; http:\/\/qifeidz.taobao.com\/<br>********************************************************************************\/<br>\/\/\u6a21\u5757\u5f15\u811a\u5b9a\u4e49<br>int CLK = 2;<br>int CS = 1;<br>int DIN = 0; \/\/\u8fd9\u91cc\u5b9a\u4e49\u4e86\u90a3\u4e09\u4e2a\u811a<br><br>void setup() {<br>&nbsp;&nbsp;\/\/ put your setup code here, to run once:<br>&nbsp;&nbsp;pinMode(CLK,OUTPUT);<br>&nbsp;&nbsp;pinMode(CS,OUTPUT);<br>&nbsp;&nbsp;pinMode(DIN,OUTPUT); \/\/\u8ba9\u4e09\u4e2a\u811a\u90fd\u662f\u8f93\u51fa\u72b6\u6001<br>}<br><br>void loop() {<br>&nbsp;&nbsp;\/\/ put your main code here, to run repeatedly:<br>&nbsp; &nbsp;Delay_xms(50);<br>&nbsp; &nbsp;Init_MAX7219();<br>&nbsp; &nbsp;Delay_xms(2000);<br>&nbsp; &nbsp;Write_Max7219(0x0f, 0x00);&nbsp; &nbsp;&nbsp; &nbsp; \/\/\u663e\u793a\u6d4b\u8bd5\uff1a1\uff1b\u6d4b\u8bd5\u7ed3\u675f\uff0c\u6b63\u5e38\u663e\u793a\uff1a0<br>&nbsp; &nbsp;Write_Max7219(1,8);<br>&nbsp; &nbsp;Write_Max7219(2,7);<br>&nbsp; &nbsp;Write_Max7219(3,6);<br>&nbsp; &nbsp;Write_Max7219(4,5);<br>&nbsp; &nbsp;Write_Max7219(5,4);<br>&nbsp; &nbsp;Write_Max7219(6,3);<br>&nbsp; &nbsp;Write_Max7219(7,2);<br>&nbsp; &nbsp;Write_Max7219(8,1);<br>&nbsp; &nbsp;while(1);<br>}<br>void Delay_xms(unsigned int x)<br>{<br>&nbsp;&nbsp;unsigned int i,j;<br>&nbsp;&nbsp;for(i=0;i&lt;x;i++)<br>&nbsp;&nbsp;for(j=0;j&lt;112;j++);<br>}<br>\/\/&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br>\/\/\u529f\u80fd\uff1a\u5411MAX7219(U3)\u5199\u5165\u5b57\u8282<br>\/\/\u5165\u53e3\u53c2\u6570\uff1aDATA<br>\/\/\u51fa\u53e3\u53c2\u6570\uff1a\u65e0<br>\/\/\u8bf4\u660e\uff1a<br>void Write_Max7219_byte(unsigned char DATA)&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;<br>{<br>&nbsp; &nbsp; unsigned char i;&nbsp; &nbsp;<br>&nbsp; &nbsp; digitalWrite(CS,LOW);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br>&nbsp; &nbsp; for(i=8;i&gt;=1;i&#8211;)<br>&nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;<br>&nbsp; &nbsp;&nbsp; &nbsp;digitalWrite(CLK,LOW);&nbsp; &nbsp;<br>&nbsp; &nbsp;&nbsp; &nbsp;if(DATA&amp;0X80)<br>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;digitalWrite(DIN,HIGH);<br>&nbsp; &nbsp;&nbsp; &nbsp;else<br>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;digitalWrite(DIN,LOW);<br>&nbsp; &nbsp;&nbsp; &nbsp;DATA&lt;&lt;=1;<br>&nbsp; &nbsp;&nbsp; &nbsp;digitalWrite(CLK,HIGH);<br>&nbsp; &nbsp;&nbsp;&nbsp;}&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;<br>}<br>\/\/&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br>\/\/\u529f\u80fd\uff1a\u5411MAX7219\u5199\u5165\u6570\u636e<br>\/\/\u5165\u53e3\u53c2\u6570\uff1aaddress\u3001dat<br>\/\/\u51fa\u53e3\u53c2\u6570\uff1a\u65e0<br>\/\/\u8bf4\u660e\uff1a<br>void Write_Max7219(unsigned char address,unsigned char dat)<br>{<br>&nbsp; &nbsp;digitalWrite(CS,LOW);<br>&nbsp; &nbsp;Write_Max7219_byte(address);&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;\/\/\u5199\u5165\u5730\u5740\uff0c\u5373\u6570\u7801\u7ba1\u7f16\u53f7<br>&nbsp; &nbsp;Write_Max7219_byte(dat);&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;\/\/\u5199\u5165\u6570\u636e\uff0c\u5373\u6570\u7801\u7ba1\u663e\u793a\u6570\u5b57<br>&nbsp; &nbsp;digitalWrite(CS,HIGH);&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;<br>}<br><br>void Init_MAX7219(void)<br>{<br>&nbsp; &nbsp;Write_Max7219(0x09, 0xff);&nbsp; &nbsp;&nbsp; &nbsp; \/\/\u8bd1\u7801\u65b9\u5f0f\uff1aBCD\u7801<br>&nbsp; &nbsp;Write_Max7219(0x0a, 0x03);&nbsp; &nbsp;&nbsp; &nbsp; \/\/\u4eae\u5ea6<br>&nbsp; &nbsp;Write_Max7219(0x0b, 0x07);&nbsp; &nbsp;&nbsp; &nbsp; \/\/\u626b\u63cf\u754c\u9650\uff1b4\u4e2a\u6570\u7801\u7ba1\u663e\u793a<br>&nbsp; &nbsp;Write_Max7219(0x0c, 0x01);&nbsp; &nbsp;&nbsp; &nbsp; \/\/\u6389\u7535\u6a21\u5f0f\uff1a0\uff0c\u666e\u901a\u6a21\u5f0f\uff1a1<br>&nbsp; &nbsp;Write_Max7219(0x0f, 0x01);&nbsp; &nbsp;&nbsp; &nbsp; \/\/\u663e\u793a\u6d4b\u8bd5\uff1a1\uff1b\u6d4b\u8bd5\u7ed3\u675f\uff0c\u6b63\u5e38\u663e\u793a\uff1a0<br>}<em>\u590d\u5236\u4ee3\u7801<\/em><br><br>\u8bd5\u4e86\u4e0b\uff0c\u53ef\u4ee5\u7528\u3002\u7ea7\u8054\u600e\u4e48\u89e3\u51b3\u5462\uff0c\u7f51\u4e0a\u53cd\u590d\u627e\uff0c\u672c\u575b\u91cc\u6709\u7bc7\u5199\u7684<a href=\"https:\/\/www.geek-workshop.com\/forum.php?mod=viewthread&amp;tid=7951&amp;highlight=max7219\" target=\"_blank\" rel=\"noreferrer noopener\">http:\/\/www.geek-workshop.com\/for &#8230; p;highlight=max7219<\/a>\u63a7\u5236led\u70b9\u9635\u7684\uff0c\u8bd5\u7740\u5c0f\u6539\u7528\u4e86\u7528\uff0c\u663e\u793a\u8fd8\u662f\u4e71\u7684\uff0c\u4e0d\u884c\u3002\u53c8\u641c\u5230\u8fd9\u4e2a\u8d34<a href=\"http:\/\/lib.csdn.net\/article\/embeddeddevelopment\/63594\" target=\"_blank\" rel=\"noreferrer noopener\">http:\/\/lib.csdn.net\/article\/embeddeddevelopment\/63594<\/a>&nbsp;MAX7219\u591a\u7ea7\u8054\u4e32\u884c\u63a7\u5236\u591a\u4e2a\u70b9\u9635\/\u6570\u7801\u7ba1\u7684\u8be6\u89e3&nbsp;&nbsp;\u7528\u7684\u662fc\u8bed\u8a00\uff0c\u90fd\u4e0d\u662f\u5199\u7ed9arduino\u7528\u7684\uff0c\u4e0d\u8fc7\u6211\u4e00\u770b\u6ce8\u91ca\u90a3\u4e48\u719f\uff0c\u6709\u4e9b\u90e8\u5206\u7b80\u76f4\u548c\u5356\u5bb6\u7ed9\u7684\u4f8b\u7a0b\u4e00\u6a21\u4e00\u6837\uff0c\u53ef\u4ee5\u80af\u5b9a\u4ed6\u4eec\u90fd\u6709\u4e00\u4e2a\u5171\u540c\u7684\u7956\u5148\u3002\u4ed4\u7ec6\u7814\u7a76\u540e\uff0c\u53d1\u73b0\u7ea7\u8054\u7684\u5173\u952e\u662f\u5199\u540e\u9762\u7684\u6a21\u5757\u5c31\u5f97\u628a\u5b83\u524d\u9762\u7684\u6a21\u5757\u5199\u7a7a\u3002\u50cf\u8fd9\u6837\/*\u7b2c\u4e8c\u7247MAX7219\u7684\u5199\u5165\u6570\u636e*\/<br>void Write_Max7219_2(uchar add2,uchar dat2)<br>{<br>&nbsp; &nbsp; &nbsp; &nbsp; Max7219_pinCS=0;<br>&nbsp; &nbsp; &nbsp; &nbsp; Write_Max7219_byte(add2);<br>&nbsp; &nbsp; &nbsp; &nbsp; Write_Max7219_byte(dat2);<br>&nbsp; &nbsp; &nbsp; &nbsp; Max7219_pinCLK=1;<br>&nbsp; &nbsp; &nbsp; &nbsp; Write_Max7219_byte(0x00);&nbsp;&nbsp;\/\/\u72471\u5199\u5165\u7a7a<br>&nbsp; &nbsp; &nbsp; &nbsp; Write_Max7219_byte(0x00);<br>&nbsp; &nbsp; &nbsp; &nbsp; Max7219_pinCS=1;<br>}<br>\/*\u7b2c\u4e09\u7247MAX7219\u7684\u5199\u5165\u6570\u636e*\/<br>void Write_Max7219_3(uchar add3,uchar dat3)<br>{<br>&nbsp; &nbsp; &nbsp; &nbsp; Max7219_pinCS=0;<br>&nbsp; &nbsp; &nbsp; &nbsp; Write_Max7219_byte(add3);<br>&nbsp; &nbsp; &nbsp; &nbsp; Write_Max7219_byte(dat3);<br>&nbsp; &nbsp; &nbsp; &nbsp; Max7219_pinCLK=1;<br>&nbsp; &nbsp; &nbsp; &nbsp; Write_Max7219_byte(0x00); \/\/\u72471\u5199\u5165\u7a7a<br>&nbsp; &nbsp; &nbsp; &nbsp; Write_Max7219_byte(0x00);<br>&nbsp; &nbsp; &nbsp; &nbsp; Write_Max7219_byte(0x00); \/\/\u72472\u5199\u5165\u7a7a<br>&nbsp; &nbsp; &nbsp; &nbsp; Write_Max7219_byte(0x00);<br>&nbsp; &nbsp; &nbsp; &nbsp; Max7219_pinCS=1;<br>}<br><em>\u590d\u5236\u4ee3\u7801<\/em><br><br><br>\u6211\u7684\u4ee3\u7801\u5982\u4e0b\uff1a \u5b9a\u4e49\u4e86\u4e00\u4e2a\u603b\u7684\u7247\u6570\uff0c\u7136\u540e\u7528\u5faa\u73af\u628a\u521d\u59cb\u5316\u6570\u7801\u7ba1\u6a21\u5757\u548c\u5199\u6bcf\u7247\u7684\u6570\u636e\u90fd\u7edf\u4e00\u8d77\u6765\u4e86\uff0c\u8fd9\u6837\u4e0d\u7ba1\u662f\u5199\u4e00\u7247\uff0c\u8fd8\u662f8\u7247\uff0c\u4ee3\u7801\u90fd\u662f\u4e00\u6837\u7684\u957f\u5ea6\uff08\u597d\u8c61max7219\u6700\u591a\u5c31\u652f\u63018\u7247\uff09\uff0c\u8fd8\u81ea\u5b9a\u4e49\u4e86\u4e00\u4e2aDP\u53c2\u6570\uff0c\u89e3\u51b3\u4e86\u5356\u5bb6\u4f8b\u7a0b\u6ca1\u5199\u7684\u5c0f\u6570\u70b9\u6709\u65e0\u7684\u95ee\u9898\u3002\u5356\u5bb6\u4f8b\u7a0b\u662f\u5728loop\u4e2d\u521d\u59cb\u5316\u6a21\u5757\u7684\uff0c\u8fd9\u6837\u663e\u793a\u611f\u89c9\u6709\u95ea\u70c1\uff0c\u6211\u79fb\u5230setup\u4e2d\u521d\u59cb\u5316\uff0c\u95ea\u70c1\u5c31\u6ca1\u4e86<br>\/\/\u6a21\u5757\u5f15\u811a\u5b9a\u4e49<br>int CLK = D6;<br>int CS = D7;<br>int DIN = D8; \/\/\u8fd9\u91cc\u5b9a\u4e49\u4e86\u90a3\u4e09\u4e2a\u811a<br>int PIECENUM = 4;\/\/\u6570\u7801\u7ba1\u7247\u6570<br><br>void setup() {<br>&nbsp;&nbsp;\/\/ put your setup code here, to run once:<br>&nbsp;&nbsp;pinMode(CLK, OUTPUT);<br>&nbsp;&nbsp;pinMode(CS, OUTPUT);<br>&nbsp;&nbsp;pinMode(DIN, OUTPUT); \/\/\u8ba9\u4e09\u4e2a\u811a\u90fd\u662f\u8f93\u51fa\u72b6\u6001<br>&nbsp;&nbsp;Delay_xms(50);<br>&nbsp;&nbsp;Init_MAX7219(PIECENUM);<br>&nbsp;&nbsp;Delay_xms(2000);<br>}<br><br>void loop() {<br>&nbsp;&nbsp;\/\/ put your main code here, to run repeatedly:<br><br>&nbsp;&nbsp;Write_Max7219(1, 0x0f, 0x00, 0);&nbsp; &nbsp;&nbsp;&nbsp;\/\/\u663e\u793a\u6d4b\u8bd5\uff1a1\uff1b\u6d4b\u8bd5\u7ed3\u675f\uff0c\u6b63\u5e38\u663e\u793a\uff1a0<br><br>&nbsp;&nbsp;for (int i = 1; i &lt;= 5; i++) {<br>&nbsp; &nbsp; Write_Mynum(1, i, i + 1, 1);<br>&nbsp;&nbsp;}<br>&nbsp;&nbsp;\/\/Write_Mynum(1, 7, &#8216;_&#8217;, 0);<br>\/\/ Write_Mynum(1, 8, &#8216;_&#8217;, 0);<br>&nbsp;&nbsp;for (int i = 1; i &lt;= 8; i++) {<br>&nbsp; &nbsp; Write_Mynum(2, i, 2, 0);<br>&nbsp;&nbsp;}<br><br>&nbsp;&nbsp;for (int i = 1; i &lt;= 8; i++) {<br>&nbsp; &nbsp; Write_Mynum(3, i, 3, 0);<br>&nbsp;&nbsp;}<br><br>&nbsp;&nbsp;for (int i = 1; i &lt;= 8; i++) {<br>&nbsp; &nbsp; Write_Mynum(4, i, 8 &#8211; i, 1);<br>&nbsp;&nbsp;}<br><br>&nbsp;&nbsp;while (1);<br>}<br><br><br>void Delay_xms(unsigned int x)<br>{<br>&nbsp;&nbsp;unsigned int i, j;<br>&nbsp;&nbsp;for (i = 0; i &lt; x; i++)<br>&nbsp; &nbsp; for (j = 0; j &lt; 112; j++);<br>}<br><br>\/\/\u5207\u6362\u5730\u5740\uff0c\u65b9\u4fbf\u5199<br>void Write_Mynum(int pnum,&nbsp;&nbsp;unsigned char address, unsigned char dat , int dp) {<br>&nbsp;&nbsp;Write_Max7219(pnum, 9 &#8211; address, dat, dp);<br>}<br><br>\/\/&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br>\/\/\u529f\u80fd\uff1a\u5411MAX7219\u5199\u5165\u5b57\u8282<br>\/\/\u5165\u53e3\u53c2\u6570\uff1aDATA,dp\u663e\u793a\u5c0f\u6570\u70b9\u4e0e\u5426<br>void Write_Max7219_byte(unsigned char DATA, int dp)<br>{<br>&nbsp;&nbsp;unsigned char i;<br>&nbsp;&nbsp;digitalWrite(CS, LOW);<br>&nbsp;&nbsp;for (i = 8; i &gt;= 1; i&#8211;)<br>&nbsp;&nbsp;{<br>&nbsp; &nbsp; digitalWrite(CLK, LOW);<br>&nbsp; &nbsp; if (i == 8 &amp;&amp; dp == 1)<br>&nbsp; &nbsp;&nbsp; &nbsp;digitalWrite(DIN, HIGH);<br>&nbsp; &nbsp; else {<br>&nbsp; &nbsp;&nbsp; &nbsp;if (DATA &amp; 0X80)<br>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;digitalWrite(DIN, HIGH);<br>&nbsp; &nbsp;&nbsp; &nbsp;else<br>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;digitalWrite(DIN, LOW);<br>&nbsp; &nbsp; }<br>&nbsp; &nbsp; DATA &lt;&lt;= 1;<br>&nbsp; &nbsp; digitalWrite(CLK, HIGH);<br>&nbsp;&nbsp;}<br>}<br><br>\/\/&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br>\/\/\u529f\u80fd\uff1a\u5411MAX7219\u5199\u5165\u6570\u636e<br>\/\/\u5165\u53e3\u53c2\u6570\uff1apnum\u6570\u7801\u7ba1\u7247\u5e8f\u53f7,address,dat,dp\u663e\u793a\u5c0f\u6570\u70b9\u4e0e\u5426<br>void Write_Max7219(int pnum, unsigned char address, unsigned char dat, int dp)<br>{<br>&nbsp;&nbsp;digitalWrite(CS, LOW);<br>&nbsp;&nbsp;Write_Max7219_byte(address, 0);&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; \/\/\u5199\u5165\u5730\u5740\uff0c\u5373\u6570\u7801\u7ba1\u7f16\u53f7<br>&nbsp;&nbsp;Write_Max7219_byte(dat, dp);&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;\/\/\u5199\u5165\u6570\u636e\uff0c\u5373\u6570\u7801\u7ba1\u663e\u793a\u6570\u5b57<br>&nbsp;&nbsp;if (pnum &gt; 1) {<br>&nbsp; &nbsp; digitalWrite(CLK, HIGH);<br>&nbsp; &nbsp; for (int i = 1; i &lt; pnum; i++) {<br>&nbsp; &nbsp;&nbsp; &nbsp;Write_Max7219_byte(0X00, 0);<br>&nbsp; &nbsp;&nbsp; &nbsp;Write_Max7219_byte(0X00, 0);<br>&nbsp; &nbsp; }<br>&nbsp;&nbsp;}<br>&nbsp;&nbsp;digitalWrite(CS, HIGH);<br>}<br><br><br>\/\/Max7219\u521d\u59cb\u5316<br>void Init_MAX7219(int pienum)<br>{<br>&nbsp;&nbsp;for (int i = 1 ; i &lt;= pienum ; i++) {<br>&nbsp; &nbsp; Write_Max7219(i, 0x09, 0xff, 0);&nbsp; &nbsp;&nbsp;&nbsp;\/\/\u8bd1\u7801\u65b9\u5f0f\uff1aBCD\u7801<br>&nbsp; &nbsp; Write_Max7219(i, 0x0a, 0x03, 0);&nbsp; &nbsp;&nbsp;&nbsp;\/\/\u53c2\u65703\uff1a\u4eae\u5ea6<br>&nbsp; &nbsp; Write_Max7219(i, 0x0b, 0x07, 0);&nbsp; &nbsp;&nbsp;&nbsp;\/\/\u626b\u63cf\u754c\u9650\uff1b\u53c2\u65703\uff1a8\u4e2a\u6570\u7801\u7ba1\u663e\u793a<br>&nbsp; &nbsp; Write_Max7219(i, 0x0c, 0x01, 0);&nbsp; &nbsp;&nbsp;&nbsp;\/\/\u6389\u7535\u6a21\u5f0f\uff1a\u53c2\u65703\uff1a0\uff0c\u666e\u901a\u6a21\u5f0f\uff1a1<br>&nbsp; &nbsp; Write_Max7219(i, 0x0f, 0x01, 0);&nbsp; &nbsp;&nbsp;&nbsp;\/\/\u663e\u793a\u6d4b\u8bd5\uff1a\u53c2\u65703\uff1a1\uff1b\u6d4b\u8bd5\u7ed3\u675f\uff0c\u6b63\u5e38\u663e\u793a\uff1a0<br>&nbsp;&nbsp;}<br>}<br><em>\u590d\u5236\u4ee3\u7801<\/em><\/td><\/tr><\/tbody><\/table><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Arduino-ESP8266\u4e4bMAX7219 8\u4f4d\u6570\u7801\u7ba1\u7ea7\u8054\u7684\u5b9e\u73b0&nbsp;[\u590d\u5236\u94fe\u63a5] duocool  &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/wp.ytdx.cc\/index.php\/2024\/05\/09\/max7219%e7%ba%a7%e8%81%94\/\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u201cMAX7219\u7ea7\u8054\u201d<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4],"tags":[],"class_list":["post-199","post","type-post","status-publish","format-standard","hentry","category-date","entry"],"jetpack_featured_media_url":"","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wp.ytdx.cc\/index.php\/wp-json\/wp\/v2\/posts\/199","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wp.ytdx.cc\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wp.ytdx.cc\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wp.ytdx.cc\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wp.ytdx.cc\/index.php\/wp-json\/wp\/v2\/comments?post=199"}],"version-history":[{"count":1,"href":"https:\/\/wp.ytdx.cc\/index.php\/wp-json\/wp\/v2\/posts\/199\/revisions"}],"predecessor-version":[{"id":200,"href":"https:\/\/wp.ytdx.cc\/index.php\/wp-json\/wp\/v2\/posts\/199\/revisions\/200"}],"wp:attachment":[{"href":"https:\/\/wp.ytdx.cc\/index.php\/wp-json\/wp\/v2\/media?parent=199"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wp.ytdx.cc\/index.php\/wp-json\/wp\/v2\/categories?post=199"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wp.ytdx.cc\/index.php\/wp-json\/wp\/v2\/tags?post=199"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}