<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[forum.rcl-radio.ru &mdash; 777]]></title>
	<link rel="self" href="http://forum.rcl-radio.ru/extern.php?action=feed&amp;tid=284&amp;type=atom" />
	<updated>2021-03-11T09:57:33Z</updated>
	<generator>PunBB</generator>
	<id>http://forum.rcl-radio.ru/viewtopic.php?id=284</id>
		<entry>
			<title type="html"><![CDATA[777]]></title>
			<link rel="alternate" href="http://forum.rcl-radio.ru/viewtopic.php?pid=3232#p3232" />
			<content type="html"><![CDATA[<p>// ATTINY2313 V1.25<br />// D4 = PB0<br />// D5 = PB1<br />// D6 = PB2<br />// D7 = PB3<br />// E&nbsp; = PB4<br />// RS = PD6<br />// button HH = PD3<br />// button MM = PD4</p><p>int i,hh,mm,ss;<br />int a[8];<br />long ddd;<br />float fff=100;</p><p>void setup() {<br />&nbsp; &nbsp; DDRB = 0b00011111;<br />&nbsp; &nbsp; DDRD = 0b01000000;</p><p>lcdInit();<br />}</p><p>void loop() {&nbsp; &nbsp; <br />/*<br />&nbsp; &nbsp; a[0] = hh/10+48;<br />&nbsp; &nbsp; a[1] = hh%10+48;<br />&nbsp; &nbsp; a[2] = mm/10+48;<br />&nbsp; &nbsp; a[3] = mm%10+48;<br />&nbsp; &nbsp; a[4] = ss/10+48;<br />&nbsp; &nbsp; a[5] = ss%10+48;<br /> */<br />&nbsp; &nbsp; lcdCurs(0,6);<br />&nbsp; &nbsp; lcdString(&quot;TIME&quot;);<br />&nbsp; &nbsp; lcdCurs(1,3);<br />&nbsp; &nbsp; //lcdChar(a[0]);lcdChar(a[1]);lcdString(&quot;:&quot;);lcdChar(a[2]);lcdChar(a[3]);lcdString(&quot;:&quot;);lcdChar(a[4]);lcdChar(a[5]);<br />&nbsp; &nbsp; lcdInt(fff);<br />&nbsp; //&nbsp; lcdString(1);<br />&nbsp; &nbsp; delay(3000);<br />&nbsp; &nbsp; lcd(0b00000001);<br />}</p><p>void lcdSend(bool isCommand, uint8_t data) {<br />&nbsp; &nbsp; if(isCommand==0){PORTD |= (1 &lt;&lt; 6);}//RS<br />&nbsp; &nbsp; if(isCommand==1){PORTD &amp;= ~(1 &lt;&lt; 6);}//RS<br />&nbsp; &nbsp; del();<br />&nbsp; &nbsp; if(((data &gt;&gt; 7) &amp; 1) ==1){PORTB |= (1 &lt;&lt; 3);}else{PORTB &amp;= ~(1 &lt;&lt; 3);}<br />&nbsp; &nbsp; if(((data &gt;&gt; 6) &amp; 1) ==1){PORTB |= (1 &lt;&lt; 2);}else{PORTB &amp;= ~(1 &lt;&lt; 2);}<br />&nbsp; &nbsp; if(((data &gt;&gt; 5) &amp; 1) ==1){PORTB |= (1 &lt;&lt; 1);}else{PORTB &amp;= ~(1 &lt;&lt; 1);}<br />&nbsp; &nbsp; if(((data &gt;&gt; 4) &amp; 1) ==1){PORTB |= (1 &lt;&lt; 0);}else{PORTB &amp;= ~(1 &lt;&lt; 0);}<br />&nbsp; &nbsp; rs();<br />&nbsp; &nbsp; if(((data &gt;&gt; 3) &amp; 1) ==1){PORTB |= (1 &lt;&lt; 3);}else{PORTB &amp;= ~(1 &lt;&lt; 3);}<br />&nbsp; &nbsp; if(((data &gt;&gt; 2) &amp; 1) ==1){PORTB |= (1 &lt;&lt; 2);}else{PORTB &amp;= ~(1 &lt;&lt; 2);}<br />&nbsp; &nbsp; if(((data &gt;&gt; 1) &amp; 1) ==1){PORTB |= (1 &lt;&lt; 1);}else{PORTB &amp;= ~(1 &lt;&lt; 1);}<br />&nbsp; &nbsp; if(((data &gt;&gt; 0) &amp; 1) ==1){PORTB |= (1 &lt;&lt; 0);}else{PORTB &amp;= ~(1 &lt;&lt; 0);}<br />&nbsp; &nbsp; rs();<br />}</p><p>void lcd(uint8_t cmd) {lcdSend(true, cmd);}<br />void lcdChar(const char chr) {lcdSend(false, (uint8_t)chr);}<br />void lcdString(const char* str) {while(*str != &#039;\0&#039;) {lcdChar(*str);str++;}}<br />void del(){delay(1);}<br />void rs(){PORTB |= (1 &lt;&lt; 4);del();PORTB &amp;= ~(1 &lt;&lt; 4);}<br />void lcdCurs(byte str, byte mesto){<br />&nbsp; if(str==0){lcd(0b10000000+mesto);}<br />&nbsp; if(str==1){lcd(0b11000000+mesto);}<br />&nbsp; }<br />void lcdInit(){<br />&nbsp; &nbsp; &nbsp; delay(1000);&nbsp; <br />&nbsp; &nbsp; rs();<br />&nbsp; &nbsp; lcd(0b00110000);del();<br />&nbsp; &nbsp; lcd(0b00110000);del();<br />&nbsp; &nbsp; lcd(0b00110000);del();<br />&nbsp; &nbsp; lcd(0b00000010);<br />&nbsp; &nbsp; lcd(0b00000010);<br />&nbsp; &nbsp; lcd(0b00001100);<br />&nbsp; &nbsp; lcd(0b00000001);<br />&nbsp; }&nbsp; </p><p> void lcdInt(long int_x){char aa;byte h[16];<br />&nbsp; &nbsp;int it,xx;long int_y=int_x;<br />&nbsp; for(it=0;int_x&gt;0;it++){int_x=int_x/10;}<br />&nbsp; for(xx=0;xx&lt;it;xx++){ <br />&nbsp; &nbsp;h[xx]=int_y%10; int_y=int_y/10;<br />&nbsp; &nbsp;aa=(char)h[it-xx-1];lcdChar(aa +&#039;0&#039;);}<br />&nbsp; }</p>]]></content>
			<author>
				<name><![CDATA[liman324]]></name>
				<uri>http://forum.rcl-radio.ru/profile.php?id=2</uri>
			</author>
			<updated>2021-03-11T09:57:33Z</updated>
			<id>http://forum.rcl-radio.ru/viewtopic.php?pid=3232#p3232</id>
		</entry>
</feed>
