<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[forum.rcl-radio.ru &mdash; LED матрица max7219]]></title>
		<link>http://forum.rcl-radio.ru/viewtopic.php?id=300</link>
		<atom:link href="http://forum.rcl-radio.ru/extern.php?action=feed&amp;tid=300&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «LED матрица max7219».]]></description>
		<lastBuildDate>Sat, 16 Nov 2024 09:23:48 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: LED матрица max7219]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?pid=11029#p11029</link>
			<description><![CDATA[<p>Всем доброго времени суток.<br />Часы шикарные&nbsp; все работает , скетч с поста 23.<br />Еще бы будильник туда добавить .</p>]]></description>
			<author><![CDATA[null@example.com (rudakov2002@mail.ru)]]></author>
			<pubDate>Sat, 16 Nov 2024 09:23:48 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?pid=11029#p11029</guid>
		</item>
		<item>
			<title><![CDATA[Re: LED матрица max7219]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?pid=10777#p10777</link>
			<description><![CDATA[<p>Померьте напряжение на батарейки часов реального времени, если есть отклонение от номинала 3 В +-10% то это может быть причиной зависания. Увеличьте емкость конденсатора по цепи питания, может так же помочь.</p>]]></description>
			<author><![CDATA[null@example.com (liman324)]]></author>
			<pubDate>Sun, 22 Sep 2024 13:43:49 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?pid=10777#p10777</guid>
		</item>
		<item>
			<title><![CDATA[Re: LED матрица max7219]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?pid=10776#p10776</link>
			<description><![CDATA[<p>Выявилась проблемма. Часы работают потом зависают. Нажимаю ресет на мк он сбрасывается и опять работают дальше часы. Как устранить зависания часов?</p>]]></description>
			<author><![CDATA[null@example.com (klerik77)]]></author>
			<pubDate>Sun, 22 Sep 2024 13:30:46 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?pid=10776#p10776</guid>
		</item>
		<item>
			<title><![CDATA[Re: LED матрица max7219]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?pid=9195#p9195</link>
			<description><![CDATA[<p>Здравствуйте!<br />Та же проблема.<br />Можно выложить исправленный скетч , а то не силен в пррграммировании.</p>]]></description>
			<author><![CDATA[null@example.com (sergei)]]></author>
			<pubDate>Sat, 13 Jan 2024 14:59:40 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?pid=9195#p9195</guid>
		</item>
		<item>
			<title><![CDATA[Re: LED матрица max7219]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?pid=9146#p9146</link>
			<description><![CDATA[<p>Помогло!!! Спасибо большое.</p>]]></description>
			<author><![CDATA[null@example.com (klerik77)]]></author>
			<pubDate>Sun, 07 Jan 2024 16:13:49 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?pid=9146#p9146</guid>
		</item>
		<item>
			<title><![CDATA[Re: LED матрица max7219]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?pid=9145#p9145</link>
			<description><![CDATA[<p>Эта строка должна быть закоменнтирована<br /> set_time(21,2,5,3,0,4,0);// год 00-99, ДН 1-7 (1=ВС), месяц 1-12, дата 1-31, час 0-23, минуты 0-59, секунды 0-59</p>]]></description>
			<author><![CDATA[null@example.com (liman324)]]></author>
			<pubDate>Sun, 07 Jan 2024 15:39:34 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?pid=9145#p9145</guid>
		</item>
		<item>
			<title><![CDATA[Re: LED матрица max7219]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?pid=9144#p9144</link>
			<description><![CDATA[<p>//Вот этот скетч использую.<br />////////// |PORT&nbsp; &nbsp;|pin | Arduino<br />// MAX7219<br />#define CLK PD2 // | 4&nbsp; | D2<br />#define CS&nbsp; PD3 // | 5&nbsp; | D3<br />#define DIN PD4 // | 6&nbsp; | D4<br />// DS1307<br />#define SQW PB4 // | 18 | D12<br />// DHT11<br />#define OUT PB0 // | 14 | D8<br />// BUTTON<br />#define SET PC0 // | 23 | A0<br />#define UP&nbsp; PC1 // | 24 | A1<br />#define DW&nbsp; PC2 // | 25 | A2<br />// I2C<br />#define ADDR&nbsp; &nbsp; 0b1101000<br />#define CPU_F&nbsp; &nbsp;16000000<br />#define SCL_F&nbsp; &nbsp;100000</p><p>int beg,obr,br,tik;<br />byte data_dht[5],www;<br />byte d0,d1,d2,d3,i1,bb,i3,f1,sett,z;<br />byte hh,mm,dh_t,dh_h;<br />byte dat[18][8] = {{B00111100,B01100110,B01101110,B01111110,B01110110,B01100110,B00111100,B00000000},// 0<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{B00011000,B00111000,B00011000,B00011000,B00011000,B00011000,B00011000,B00000000},// 1<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{B00111100,B01100110,B00000110,B00011100,B00110000,B01100000,B01111110,B00000000},// 2<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{B00111100,B01100110,B00000110,B00011100,B00000110,B01100110,B00111100,B00000000},// 3<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{B00001110,B00011110,B00110110,B01100110,B01111110,B00000110,B00000110,B00000000},// 4<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{B01111110,B01100000,B01111100,B00000110,B00000110,B01100110,B00111100,B00000000},// 5<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{B00011100,B00110000,B01100000,B01111100,B01100110,B01100110,B00111100,B00000000},// 6<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{B01111110,B00000110,B00000110,B00001100,B00011000,B00011000,B00011000,B00000000},// 7<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{B00111100,B01100110,B01100110,B00111100,B01100110,B01100110,B00111100,B00000000},// 8<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{B00111100,B01100110,B01100110,B00111110,B00000110,B00001100,B00111000,B00000000},// 9<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{B00110000,B00110000,B01111100,B00110000,B00110000,B00110100,B00011000,B00000000},// t = 10<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{B01100110,B01100110,B01100110,B01111110,B01100110,B01100110,B01100110,B00000000},// H = 11<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{B00000000,B00111000,B01101100,B01101100,B00111000,B00000000,B00000000,B00000000},// градус = 12<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{B00000000,B11000110,B11001100,B00011000,B00110000,B01100110,B11000110,B00000000},// % = 13<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{B11000110,B11101110,B11111110,B11111110,B11010110,B11000110,B11000110,B00000000},// M = 14<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{B01111000,B01101100,B01100110,B01100110,B01100110,B01101100,B01111000,B00000000},// D = 15<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{B01111100,B01100110,B01100110,B01111100,B01100110,B01100110,B01111100,B00000000},// B = 16<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{B00000000,B00000000,B01011100,B01110110,B01100000,B01100000,B01100000,B00000000} // r = 17<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;};&nbsp; &nbsp; &nbsp; &nbsp;</p><p>void setup() {<br />// Serial.begin(9600);<br />&nbsp; DDRB &amp;= ~(1 &lt;&lt; SQW);PORTB |= (1 &lt;&lt; SQW);<br />&nbsp; TWBR = (((CPU_F)/(SCL_F)-16 )/2) ;<br />&nbsp; TWSR = 0;<br />&nbsp; &nbsp;set_time(21,2,5,3,0,4,0);// год 00-99, ДН 1-7 (1=ВС), месяц 1-12, дата 1-31, час 0-23, минуты 0-59, секунды 0-59<br />&nbsp; i2c_write(ADDR,0x0E, 0b00010000); // выход SQW, частота 1 Гц<br />&nbsp; delay(2);<br />&nbsp; br = EEPROM_read(0);<br />&nbsp; if(br==255){br=0;EEPROM_write(0,br);}<br />&nbsp; DDRD |= (1 &lt;&lt; DIN) | (1 &lt;&lt; CS) | (1 &lt;&lt; CLK);<br />&nbsp; PORTC |= (1 &lt;&lt; SET) | (1 &lt;&lt; UP) | (1 &lt;&lt; DW);<br />&nbsp; max7219_L(0x0F, 0);// тест выкл.<br />&nbsp; max7219_L(0x0C, 0x01010101);// вкл. индик.<br />&nbsp; max7219_L(0x0A, 0x01010101*br);// яркость<br />&nbsp; max7219_L(0x09, 0);// дешифраторы выкл.<br />&nbsp; max7219_L(0x0B, 0x07070707);// кол-во разрядов <br />}</p><p>void loop() {<br />&nbsp; byte sec =&nbsp; (i2c_read(ADDR,0) &amp; 0x0F) + (((i2c_read(ADDR,0) &amp; 0x70) &gt;&gt; 4) * 10);<br />&nbsp; byte min =&nbsp; (i2c_read(ADDR,1) &amp; 0x0F) + (((i2c_read(ADDR,1) &amp; 0x70) &gt;&gt; 4) * 10);<br />&nbsp; byte hour = ((i2c_read(ADDR,2) &amp; 0x0F) + ((i2c_read(ADDR,2) &amp; 0x70) &gt;&gt; 4) * 10);<br />&nbsp; byte day =&nbsp; (i2c_read(ADDR,3) &amp; 0x0F);<br />&nbsp; byte datat = ((i2c_read(ADDR,4) &amp; 0x0F) + ((i2c_read(ADDR,4) &amp; 0x70) &gt;&gt; 4) * 10);<br />&nbsp; byte mont = ((i2c_read(ADDR,5) &amp; 0x0F) + ((i2c_read(ADDR,5) &amp; 0x70) &gt;&gt; 4) * 10);<br />&nbsp; byte year = ((i2c_read(ADDR,6) &amp; 0x0F) + ((i2c_read(ADDR,6) &amp; 0x70) &gt;&gt; 4) * 10);</p><br /><p>&nbsp; if(((PINC &gt;&gt; SET) &amp; 1) == 0){sett++;www=1;if(sett&gt;5){sett=0;}delay(300);}<br />&nbsp; if(sett==0 &amp;&amp; www==1){set_time(255,255,255,255,255,255,0);www=0;}<br />&nbsp; if(((PINC &gt;&gt; UP) &amp; 1) == 0 &amp;&amp; sett == 1){hour++;if(hour&gt;23){hour=0;}set_time(255,255,255,255,hour,255,255);delay(300);}<br />&nbsp; if(((PINC &gt;&gt; DW) &amp; 1) == 0 &amp;&amp; sett == 1){hour--;if(hour&lt;0){hour=0;}set_time(255,255,255,255,hour,255,255);delay(300);}</p><p>&nbsp; if(((PINC &gt;&gt; UP) &amp; 1) == 0 &amp;&amp; sett == 2){min++;if(min&gt;59){min=0;}set_time(255,255,255,255,255,min,255);delay(300);}<br />&nbsp; if(((PINC &gt;&gt; DW) &amp; 1) == 0 &amp;&amp; sett == 2){min--;if(min&lt;0){min=0;}set_time(255,255,255,255,255,min,255);delay(300);}</p><p>&nbsp; if(((PINC &gt;&gt; UP) &amp; 1) == 0 &amp;&amp; sett == 3){datat++;if(datat&gt;31){datat=1;}set_time(255,255,255,datat,255,255,255);delay(300);}<br />&nbsp; if(((PINC &gt;&gt; DW) &amp; 1) == 0 &amp;&amp; sett == 3){datat--;if(datat&lt;1){datat=1;}set_time(255,255,255,datat,255,255,255);delay(300);}</p><p>&nbsp; if(((PINC &gt;&gt; UP) &amp; 1) == 0 &amp;&amp; sett == 4){mont++;if(mont&gt;12){mont=1;}set_time(255,255,mont,255,255,255,255);delay(300);}<br />&nbsp; if(((PINC &gt;&gt; DW) &amp; 1) == 0 &amp;&amp; sett == 4){mont--;if(mont&lt;1){mont=1;}set_time(255,255,mont,255,255,255,255);delay(300);}</p><p>&nbsp; if(((PINC &gt;&gt; UP) &amp; 1) == 0 &amp;&amp; sett == 5){br++;if(br&gt;15){br=15;}EEPROM_write(0,br);max7219_L(0x0A, 0x01010101*br);delay(300);}<br />&nbsp; if(((PINC &gt;&gt; DW) &amp; 1) == 0 &amp;&amp; sett == 5){br--;if(br&lt;0){br=0;}EEPROM_write(0,br);max7219_L(0x0A, 0x01010101*br);delay(300);} </p><br /><p>if(sett==0){ <br />&nbsp; if(((PINB &gt;&gt; SQW) &amp; 1)==1){bb = 0;}else{bb = 3;}<br />&nbsp; if(obr==2 &amp;&amp;f1==0){f1=1; dht_read();delay(1000);}<br />&nbsp; if(obr!=2){f1=0;}</p><p>switch(tik){<br />&nbsp; case 0 : obr=0;break;<br />&nbsp; case 1 : obr=3;break;<br />&nbsp; case 2 : obr=2;break;<br />&nbsp; case 3 : obr=1;break;<br />&nbsp; case 4 : obr=0;break;<br />&nbsp; case 5 : obr=7;break;<br />&nbsp; case 6 : obr=6;break;<br />&nbsp; case 7 : obr=1;break;<br />&nbsp; case 8 : obr=0;break;<br />&nbsp; case 9 : obr=5;break;<br />&nbsp; case 10 : obr=4;break;<br />&nbsp; case 11 : obr=1;break;<br />&nbsp; case 12 : tik=0;break;<br />&nbsp; }</p><p>// Serial.println(data_dht[0]);</p><p>&nbsp; beg++;<br />///// time ///////////////////// <br />if(obr==0){<br />&nbsp; d0=hour/10;d1=hour%10;d2=min/10;d3=min%10;<br />&nbsp; for(z=0;z&lt;8;z++){<br />&nbsp; &nbsp; max7219_L(z+1, ind(24, 17, 7, 0)&lt;&lt; beg);<br />&nbsp; &nbsp; if(z==1||z==2||z==4||z==5){<br />&nbsp; &nbsp; max7219_L(z+1, (ind(24, 17, 7, 0)|(unsigned long)bb &lt;&lt; 15) &lt;&lt; beg);}} <br />&nbsp; &nbsp; if(beg&gt;32){beg=0;tik++;}}</p><p>if(obr==1){<br />&nbsp; d0=hour/10;d1=hour%10;d2=min/10;d3=min%10;<br />&nbsp; for(z=0;z&lt;8;z++){<br />&nbsp; &nbsp; max7219_L(z+1, ind(24, 17, 7, 0) &gt;&gt; 32 - beg);<br />&nbsp; &nbsp; if(z==1||z==2||z==4||z==5){<br />&nbsp; &nbsp; max7219_L(z+1, (ind(24, 17, 7, 0)|(unsigned long)bb &lt;&lt; 15) &gt;&gt; 32 - beg);}} <br />&nbsp; &nbsp; if(beg&gt;32){beg=-120;tik++;}}</p><p>/////// data /////////////////////////////////////////////////<br />if(obr==2){<br />&nbsp; d0=datat/10;d1=datat%10;d2=mont/10;d3=mont%10;<br />&nbsp; for(z=0;z&lt;8;z++){<br />&nbsp; &nbsp; max7219_L(z+1, ind(24, 17, 7, 0) &lt;&lt; beg);<br />&nbsp; &nbsp; if(z==6||z==7){<br />&nbsp; &nbsp; max7219_L(z+1, (ind(24, 17, 7, 0)|(unsigned long)3 &lt;&lt; 15) &lt;&lt; beg);}}&nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; if(beg&gt;32){beg=0;tik++;}}</p><p>if(obr==3){<br />&nbsp; d0=datat/10;d1=datat%10;d2=mont/10;d3=mont%10;<br />&nbsp; for(z=0;z&lt;8;z++){<br />&nbsp; &nbsp; max7219_L(z+1, ind(24, 17, 7, 0) &gt;&gt; 32 - beg);<br />&nbsp; &nbsp; if(z==6||z==7){<br />&nbsp; &nbsp; max7219_L(z+1, (ind(24, 17, 7, 0)|(unsigned long)3 &lt;&lt; 15) &gt;&gt; 32 - beg);}}&nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; if(beg&gt;32){beg=-50;tik++;}}</p><p>&nbsp; ////// hhhh ////////////////////////////////////////////////////////////////////////<br />if(obr==4){<br />&nbsp; d0=11;d1=data_dht[0]/10;d2=data_dht[0]%10;d3=13;<br />&nbsp; for(z=0;z&lt;8;z++){<br />&nbsp; &nbsp; max7219_L(z+1, ind(24, 15, 8, 0) &lt;&lt; beg);}&nbsp; &nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; if(beg&gt;32){beg=0;tik++;}}</p><p>if(obr==5){<br />&nbsp; d0=11;d1=data_dht[0]/10;d2=data_dht[0]%10;d3=13;<br />&nbsp; for(z=0;z&lt;8;z++){<br />&nbsp; &nbsp; max7219_L(z+1, ind(24, 15, 8, 0) &gt;&gt; 32 - beg);}&nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; if(beg&gt;32){beg=-50;tik++;}}</p><p>////// temp ////////////////////////////////////////////////////////////////////////<br />if(obr==6){<br />&nbsp; d0=10;d1=data_dht[2]/10;d2=data_dht[2]%10;d3=12;<br />&nbsp; for(z=0;z&lt;8;z++){<br />&nbsp; &nbsp; max7219_L(z+1, ind(24, 15, 8, 0) &lt;&lt; beg);}&nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; if(beg&gt;32){beg=0;tik++;}}</p><p>if(obr==7){<br />&nbsp; d0=10;d1=data_dht[2]/10;d2=data_dht[2]%10;d3=12;<br />&nbsp; for(z=0;z&lt;8;z++){<br />&nbsp; &nbsp; max7219_L(z+1, ind(24, 15, 8, 0) &gt;&gt; 32 - beg);}&nbsp; &nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; if(beg&gt;32){beg=-50;tik++;}}<br />}</p><p>if(sett==1){<br />&nbsp; d0=11;d1=11;d2=hour/10;d3=hour%10;<br />&nbsp; for(z=0;z&lt;8;z++){<br />&nbsp; max7219_L(z+1, ind(24, 16, 8, 0));}}&nbsp; &nbsp;</p><p>if(sett==2){<br />&nbsp; d0=14;d1=14;d2=min/10;d3=min%10;<br />&nbsp; for(z=0;z&lt;8;z++){<br />&nbsp; max7219_L(z+1, ind(24, 16, 8, 0));}}&nbsp; &nbsp;</p><p>if(sett==3){<br />&nbsp; d0=15;d1=15;d2=datat/10;d3=datat%10;<br />&nbsp; for(z=0;z&lt;8;z++){<br />&nbsp; max7219_L(z+1, ind(24, 16, 8, 0));}} </p><p>if(sett==4){<br />&nbsp; d0=1;d1=14;d2=mont/10;d3=mont%10;<br />&nbsp; for(z=0;z&lt;8;z++){<br />&nbsp; max7219_L(z+1, ind(24, 16, 8, 0));}}</p><p>if(sett==5){<br />&nbsp; d0=16;d1=17;d2=br/10;d3=br%10;<br />&nbsp; for(z=0;z&lt;8;z++){<br />&nbsp; max7219_L(z+1, ind(24, 16, 8, 0));}}&nbsp; &nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp;<br />&nbsp; delay(25);<br />&nbsp; }//loop</p> <br /><p>void max7219_L(byte reg_n, unsigned long h){<br />&nbsp; byte h1 = h &gt;&gt; 24,h2 = h &gt;&gt; 16,h3 = h &gt;&gt; 8,h4 = h;<br />&nbsp; PORTD &amp;=~(1 &lt;&lt; CS);WriteBit16(reg_n,h1);WriteBit16(reg_n,h2);WriteBit16(reg_n,h3);WriteBit16(reg_n,h4);PORTD |=(1 &lt;&lt; CS);<br />&nbsp; } </p><p>void WriteBit16(byte reg, byte data){ <br />&nbsp; &nbsp; &nbsp;for(char i = 7; i &gt;= 0; i--){<br />&nbsp; &nbsp; &nbsp; &nbsp; PORTD &amp;= ~(1 &lt;&lt; CLK);<br />&nbsp; &nbsp; &nbsp; &nbsp; if(((reg &gt;&gt; i) &amp; 1) == 1){PORTD |= (1 &lt;&lt; DIN);}else{PORTD &amp;= ~(1 &lt;&lt; DIN);}<br />&nbsp; &nbsp; &nbsp; &nbsp; PORTD |=(1 &lt;&lt; CLK);}<br />&nbsp; &nbsp; &nbsp;for(char i = 7; i &gt;= 0; i--){<br />&nbsp; &nbsp; &nbsp; &nbsp; PORTD &amp;= ~(1 &lt;&lt; CLK);<br />&nbsp; &nbsp; &nbsp; &nbsp; if(((data &gt;&gt; i) &amp; 1) == 1){PORTD |= (1 &lt;&lt; DIN);}else{PORTD &amp;= ~(1 &lt;&lt; DIN);}<br />&nbsp; &nbsp; &nbsp; &nbsp; PORTD |=(1 &lt;&lt; CLK);}<br />&nbsp; &nbsp; &nbsp; &nbsp; PORTD &amp;= ~(1 &lt;&lt; CLK);PORTD |= (1 &lt;&lt; DIN);<br />&nbsp; }</p><p>byte i2c_read(byte i2c_addr, byte i2c_reg){<br />&nbsp; &nbsp;TWCR = (1&lt;&lt;TWINT)|(1&lt;&lt;TWSTA)|(1&lt;&lt;TWEN);&nbsp; // START<br />&nbsp; while (!(TWCR &amp; (1&lt;&lt;TWINT)));<br />&nbsp; &nbsp;TWDR = i2c_addr &lt;&lt; 1;<br />&nbsp; &nbsp;TWCR = (1&lt;&lt;TWINT) | (1&lt;&lt;TWEN);<br />&nbsp; while (!(TWCR &amp; (1&lt;&lt;TWINT)));<br />&nbsp; &nbsp;TWDR = i2c_reg;<br />&nbsp; &nbsp;TWCR = (1&lt;&lt;TWINT) | (1&lt;&lt;TWEN);<br />&nbsp; while (!(TWCR &amp; (1&lt;&lt;TWINT)));<br />&nbsp; &nbsp;TWCR = (1&lt;&lt;TWINT)|(1&lt;&lt;TWSTA)|(1&lt;&lt;TWEN);&nbsp; // START<br />&nbsp; while (!(TWCR &amp; (1&lt;&lt;TWINT)));<br />&nbsp; &nbsp;TWDR = (i2c_addr &lt;&lt; 1) | 1;<br />&nbsp; &nbsp;TWCR = (1&lt;&lt;TWINT) | (1&lt;&lt;TWEN);<br />&nbsp; while (!(TWCR &amp; (1&lt;&lt;TWINT)));<br />&nbsp; &nbsp;TWCR = (1&lt;&lt;TWINT) | (1&lt;&lt;TWEN);<br />&nbsp; while (!(TWCR &amp; (1&lt;&lt;TWINT)));<br />&nbsp; &nbsp;byte i2c_data = TWDR; <br />&nbsp; &nbsp;TWCR = (1&lt;&lt;TWINT)|(1&lt;&lt;TWEN)|(1&lt;&lt;TWSTO); // СТОП<br />&nbsp; &nbsp;return i2c_data;<br />&nbsp; }</p><p>void i2c_write(byte i2c_addr, byte i2c_reg, byte i2c_dat){<br />&nbsp; &nbsp;TWCR = (1&lt;&lt;TWINT)|(1&lt;&lt;TWSTA)|(1&lt;&lt;TWEN);&nbsp; // START<br />&nbsp; while (!(TWCR &amp; (1&lt;&lt;TWINT)));<br />&nbsp; &nbsp;TWDR = i2c_addr &lt;&lt; 1;<br />&nbsp; &nbsp;TWCR = (1&lt;&lt;TWINT) | (1&lt;&lt;TWEN);<br />&nbsp; while (!(TWCR &amp; (1&lt;&lt;TWINT)));<br />&nbsp; &nbsp;TWDR = i2c_reg;<br />&nbsp; &nbsp;TWCR = (1&lt;&lt;TWINT) | (1&lt;&lt;TWEN);<br />&nbsp; while (!(TWCR &amp; (1&lt;&lt;TWINT)));<br />&nbsp; &nbsp;TWDR = i2c_dat;<br />&nbsp; &nbsp;TWCR = (1&lt;&lt;TWINT) | (1&lt;&lt;TWEN);<br />&nbsp; while (!(TWCR &amp; (1&lt;&lt;TWINT)));<br />&nbsp; &nbsp;TWCR = (1&lt;&lt;TWINT)|(1&lt;&lt;TWEN)|(1&lt;&lt;TWSTO); // СТОП<br />&nbsp; } </p><p>void set_time(byte years, byte days, byte monts, byte datas, byte hours ,byte minute, byte second){<br />&nbsp; &nbsp; if(second &lt; 255){i2c_write(ADDR,0x00,(second/10&lt;&lt;4)+second%10);}<br />&nbsp; &nbsp; if(minute &lt; 255){i2c_write(ADDR,0x01,(minute/10&lt;&lt;4)+minute%10);}<br />&nbsp; &nbsp; if(hours &lt; 255){i2c_write(ADDR,0x02,(hours/10&lt;&lt;4)+hours%10);}<br />&nbsp; &nbsp; if(days &lt; 255){i2c_write(ADDR,0x03,days);}<br />&nbsp; &nbsp; if(datas &lt; 255){i2c_write(ADDR,0x04,(datas/10&lt;&lt;4)+datas%10);}<br />&nbsp; &nbsp; if(monts &lt; 255){i2c_write(ADDR,0x05,(monts/10&lt;&lt;4)+monts%10);}<br />&nbsp; &nbsp; if(years &lt; 255){i2c_write(ADDR,0x06,(years/10&lt;&lt;4)+years%10);}<br />&nbsp; } </p><br /><p>int dht_read(){<br />&nbsp; &nbsp; &nbsp; &nbsp; byte id = 0,id1 = 0; <br />&nbsp; &nbsp; &nbsp; &nbsp; for(id = 0;id &lt; 5;id++){data_dht[id] = 0;}&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; &nbsp; &nbsp; DDRB |=(1 &lt;&lt; OUT);<br />&nbsp; &nbsp; &nbsp; &nbsp; PORTB &amp;= ~(1 &lt;&lt; OUT);<br />&nbsp; &nbsp; &nbsp; &nbsp; delay(18);<br />&nbsp; &nbsp; &nbsp; &nbsp; PORTB |= (1 &lt;&lt; OUT);<br />&nbsp; &nbsp; &nbsp; &nbsp; delayMicroseconds(40);<br />&nbsp; &nbsp; &nbsp; &nbsp; DDRB &amp;= ~(1 &lt;&lt; OUT);<br />&nbsp; &nbsp; &nbsp; &nbsp; delayMicroseconds(80);<br />&nbsp; &nbsp; while(PINB &amp; (1 &lt;&lt; OUT));<br />&nbsp; &nbsp; &nbsp; for (id = 0; id &lt; 5; id++){<br />&nbsp; &nbsp; &nbsp; &nbsp; data_dht[id]=0;<br />&nbsp; &nbsp; &nbsp; for (id1=0; id1&lt;8; id1++){<br />&nbsp; &nbsp; while(!(PINB &amp; (1 &lt;&lt; OUT))); <br />&nbsp; &nbsp; &nbsp; &nbsp; delayMicroseconds(30);<br />&nbsp; &nbsp; &nbsp; if (PINB &amp; (1 &lt;&lt; OUT)){data_dht[id] |= 1 &lt;&lt; (7-id1);}<br />&nbsp; &nbsp; while(PINB &amp; (1 &lt;&lt; OUT)); <br />}}return 1;} </p><p>unsigned char EEPROM_read(unsigned int uiAddress){<br />&nbsp; while(EECR &amp; (1&lt;&lt;EEPE));&nbsp; // проверка готовности EEPROM<br />&nbsp; &nbsp; EEAR = uiAddress; // регистр адреса<br />&nbsp; &nbsp; EECR |= (1&lt;&lt;EERE);// чтение EEPROM<br />&nbsp; &nbsp; return EEDR; // вывод значения<br />}</p><p>void EEPROM_write(unsigned int uiAddress, unsigned char ucData){<br />&nbsp; while(EECR &amp; (1&lt;&lt;EEPE)); // проверка готовности EEPROM<br />&nbsp; &nbsp; &nbsp; EEAR = uiAddress; // регистр адреса<br />&nbsp; &nbsp; &nbsp; EEDR = ucData; // регистр данных<br />&nbsp; &nbsp; &nbsp; EECR |= (1&lt;&lt;EEMPE);// Разрешение записи в EEPROM<br />&nbsp; &nbsp; &nbsp; EECR |= (1&lt;&lt;EEPE); // Запись в EEPROM<br />} </p><p>unsigned long ind(int sd0, int sd1, int sd2, int sd3){<br />&nbsp; unsigned long long_data = (unsigned long)dat[d0][z]&lt;&lt;sd0 | (unsigned long)dat[d1][z]&lt;&lt;sd1 | (unsigned int)dat[d2][z]&lt;&lt;sd2 | dat[d3][z] &lt;&lt; sd3;<br />&nbsp; return long_data;<br />&nbsp; }</p>]]></description>
			<author><![CDATA[null@example.com (klerik77)]]></author>
			<pubDate>Sun, 07 Jan 2024 15:36:13 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?pid=9144#p9144</guid>
		</item>
		<item>
			<title><![CDATA[Re: LED матрица max7219]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?pid=9143#p9143</link>
			<description><![CDATA[<p>Что то не помогает. Поставил заряженную батарейку 3.4В - не сохраняется время при отключении питания. Поставил разряженную батарейку 2.56В - не сохраняется время. Это все при отпаянном диоде.</p>]]></description>
			<author><![CDATA[null@example.com (klerik77)]]></author>
			<pubDate>Sun, 07 Jan 2024 15:18:04 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?pid=9143#p9143</guid>
		</item>
		<item>
			<title><![CDATA[Re: LED матрица max7219]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?pid=9142#p9142</link>
			<description><![CDATA[<p><span class="postimg"><img src="http://forum.rcl-radio.ru/uploads/images/2024/01/c0904d62ec9f2cf1059218e8cdd49148.png" alt="http://forum.rcl-radio.ru/uploads/images/2024/01/c0904d62ec9f2cf1059218e8cdd49148.png" /></span> </p><p>На плате установлен диод 1N4148 - удалите его. Через него идет зарядный ток, а так как у Вас не аккумулятор а батарейка, то часы глючат от повышенного напряжения батареи.</p>]]></description>
			<author><![CDATA[null@example.com (liman324)]]></author>
			<pubDate>Sun, 07 Jan 2024 15:01:59 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?pid=9142#p9142</guid>
		</item>
		<item>
			<title><![CDATA[Re: LED матрица max7219]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?pid=9141#p9141</link>
			<description><![CDATA[<p>это на выводах 13 и 14 микросхемы ds3231</p>]]></description>
			<author><![CDATA[null@example.com (klerik77)]]></author>
			<pubDate>Sun, 07 Jan 2024 15:00:10 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?pid=9141#p9141</guid>
		</item>
		<item>
			<title><![CDATA[Re: LED матрица max7219]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?pid=9140#p9140</link>
			<description><![CDATA[<p>3.23В</p>]]></description>
			<author><![CDATA[null@example.com (klerik77)]]></author>
			<pubDate>Sun, 07 Jan 2024 14:58:47 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?pid=9140#p9140</guid>
		</item>
		<item>
			<title><![CDATA[Re: LED матрица max7219]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?pid=9139#p9139</link>
			<description><![CDATA[<p>Замерьте напряжение на батарейке DS3231</p>]]></description>
			<author><![CDATA[null@example.com (liman324)]]></author>
			<pubDate>Sun, 07 Jan 2024 14:43:46 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?pid=9139#p9139</guid>
		</item>
		<item>
			<title><![CDATA[Re: LED матрица max7219]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?pid=9138#p9138</link>
			<description><![CDATA[<p>Собрал часы на ds3231. Время показывает и считает но не сохраняется время при отключении питания хотя модуль с батарейкой. Может сможете помочь? Очень нравятся часы, время видно из далека да еще температуру и влажность показывают.</p>]]></description>
			<author><![CDATA[null@example.com (klerik77)]]></author>
			<pubDate>Sun, 07 Jan 2024 14:42:28 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?pid=9138#p9138</guid>
		</item>
		<item>
			<title><![CDATA[Re: LED матрица max7219]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?pid=8417#p8417</link>
			<description><![CDATA[<p>Здравствуйте!<br />Собрал данные часы , запустились отлично , ход точный. Но при снятии питания не сохраняют ход и каждый раз приходится настраивать заново. Хотя стоит батарейка в часах реального времени . Не подскажите в чем может быть причина?</p>]]></description>
			<author><![CDATA[null@example.com (sergei)]]></author>
			<pubDate>Thu, 31 Aug 2023 09:46:14 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?pid=8417#p8417</guid>
		</item>
		<item>
			<title><![CDATA[Re: LED матрица max7219]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?pid=8151#p8151</link>
			<description><![CDATA[<div class="quotebox"><blockquote><p>Поставил пропала реакция на освещенность .</p></blockquote></div><p>Значит скетч не тот.</p>]]></description>
			<author><![CDATA[null@example.com (liman324)]]></author>
			<pubDate>Mon, 07 Aug 2023 16:47:10 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?pid=8151#p8151</guid>
		</item>
	</channel>
</rss>
