<?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; w2812 attiny2313]]></title>
		<link>http://forum.rcl-radio.ru/viewtopic.php?id=288</link>
		<atom:link href="http://forum.rcl-radio.ru/extern.php?action=feed&amp;tid=288&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «w2812 attiny2313».]]></description>
		<lastBuildDate>Thu, 18 Mar 2021 03:27:58 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: w2812 attiny2313]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?pid=3300#p3300</link>
			<description><![CDATA[<div class="codebox"><pre><code>//  ATtiny2313 12MHz

#define L_BIT    PORTB &amp;= ~(1&lt;&lt;0)
#define H_BIT    PORTB |=  (1&lt;&lt;0)    
#define LED_MAX  4

unsigned long dat[LED_MAX];
byte aa,bb,cc;

void setup(){
   DDRB |= (1&lt;&lt;0);
}

void loop(){
/////////////////
  for(int i1=LED_MAX;i1&gt;=0;i1--){
  for(int i=0;i&lt;100;i++){
   switch(i1){
    case 0:  aa=i;bb=0;cc=0;break;
    case 1:  aa=0;bb=i;cc=0;break;
    case 2:  aa=0;bb=0;cc=i;break;
    case 3:  aa=i;bb=i;cc=i;break;
    }
  data_led(i1,  aa,bb,cc);
  led_rgb();res();
  delay(2);
  }}

  for(int i1=0;i1&lt;LED_MAX;i1++){
  for(int i=100;i&gt;=0;i--){
   switch(i1){
    case 0:  aa=i;bb=0;cc=0;break;
    case 1:  aa=0;bb=i;cc=0;break;
    case 2:  aa=0;bb=0;cc=i;break;
    case 3:  aa=i;bb=i;cc=i;break;
    }
  data_led(i1,  aa,bb,cc);
  led_rgb();res();
  delay(2);
  }}
 delay(50);
///////////////////

  for(int i1=0;i1&lt;LED_MAX;i1++){
  for(int i=0;i&lt;100;i++){
   switch(i1){
    case 0:  aa=i;bb=0;cc=0;break;
    case 1:  aa=0;bb=i;cc=0;break;
    case 2:  aa=0;bb=0;cc=i;break;
    case 3:  aa=i;bb=i;cc=i;break;
    }
  data_led(i1,  aa,bb,cc);
  led_rgb();res();
  delay(2);
  }}

  for(int i1=LED_MAX;i1&gt;=0;i1--){
  for(int i=100;i&gt;=0;i--){
   switch(i1){
    case 0:  aa=i;bb=0;cc=0;break;
    case 1:  aa=0;bb=i;cc=0;break;
    case 2:  aa=0;bb=0;cc=i;break;
    case 3:  aa=i;bb=i;cc=i;break;
    }
  data_led(i1,  aa,bb,cc);
  led_rgb();res();
  delay(2);
  }}
 delay(50);
 ////////////////////////

}

void bit_0(){H_BIT;asm(&quot;nop&quot;);   L_BIT;asm(&quot;nop&quot;);asm(&quot;nop&quot;);}
void bit_1(){H_BIT;asm(&quot;nop&quot;);asm(&quot;nop&quot;);asm(&quot;nop&quot;);asm(&quot;nop&quot;);  L_BIT;}
void bit_w(bool x){if(x) bit_1(); else bit_0();}
void res(){delayMicroseconds(100);}

void data_led(int num, unsigned long rrr, int ggg, byte bbb){
  dat[num] = ((rrr &lt;&lt; 16) &amp; 0xFF0000) + ((ggg &lt;&lt; 8) &amp; 0xFF00) + bbb;
  }

void led_rgb(){
  for(unsigned char num_i=0;num_i&lt;LED_MAX;num_i++){unsigned long data=dat[num_i];
  cli();
bit_w(data &amp; 0x80);
bit_w(data &amp; 0x40);
bit_w(data &amp; 0x20);
bit_w(data &amp; 0x10);
bit_w(data &amp; 0x08);
bit_w(data &amp; 0x04);
bit_w(data &amp; 0x02);
bit_w(data &amp; 0x01);
bit_w(data &amp; 0x800000);
bit_w(data &amp; 0x400000);
bit_w(data &amp; 0x200000);
bit_w(data &amp; 0x100000);
bit_w(data &amp; 0x080000);
bit_w(data &amp; 0x040000);
bit_w(data &amp; 0x020000);
bit_w(data &amp; 0x010000);  
bit_w(data &amp; 0x8000);    
bit_w(data &amp; 0x4000);    
bit_w(data &amp; 0x2000);    
bit_w(data &amp; 0x1000);    
bit_w(data &amp; 0x0800);    
bit_w(data &amp; 0x0400);    
bit_w(data &amp; 0x0200);    
bit_w(data &amp; 0x0100); 
   sei(); 
delayMicroseconds(10);
}}</code></pre></div><br /><p>Скетч использует 1638 байт (79%) памяти устройства. Всего доступно 2048 байт.<br />Глобальные переменные используют 28 байт (21%) динамической памяти, оставляя 100 байт для локальных переменных. Максимум: 128 байт.</p>]]></description>
			<author><![CDATA[null@example.com (liman324)]]></author>
			<pubDate>Thu, 18 Mar 2021 03:27:58 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?pid=3300#p3300</guid>
		</item>
		<item>
			<title><![CDATA[Re: w2812 attiny2313]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?pid=3299#p3299</link>
			<description><![CDATA[<div class="codebox"><pre><code>//  ATtiny2313 12MHz

#define L_BIT    PORTB &amp;= ~(1&lt;&lt;0)
#define H_BIT    PORTB |=  (1&lt;&lt;0)    
#define LED_MAX  4

unsigned long data, dat[LED_MAX];

void setup(){
   DDRB |= (1&lt;&lt;0);
}

void loop(){
   for(int i1=0;i1&lt;LED_MAX;i1++){
  for(int i=0;i&lt;50;i++){
   
  data_led(i1,  50,50-i1*3,50-i);
  led_rgb();res();
  delay(10);
  }}

  for(int i1=0;i1&lt;LED_MAX;i1++){
  data_led(i1,0,0,0);
  led_rgb();res();
  delay(500);
  }
}

void bit_0(){H_BIT;asm(&quot;nop&quot;);   L_BIT;asm(&quot;nop&quot;);asm(&quot;nop&quot;);}
void bit_1(){H_BIT;asm(&quot;nop&quot;);asm(&quot;nop&quot;);asm(&quot;nop&quot;);asm(&quot;nop&quot;);  L_BIT;}
void bit_w(bool x){if(x) bit_1(); else bit_0();}
void res(){delayMicroseconds(100);}

void data_led(int num, long rrr, int ggg, byte bbb){
  data = ((rrr &lt;&lt; 16) &amp; 0xFF0000) + ((ggg &lt;&lt; 8) &amp; 0xFF00) + bbb;
  dat[num] = data;
  }

void led_rgb(){
  for(int num_i=0;num_i&lt;LED_MAX;num_i++){data=dat[num_i];
  cli();
bit_w(data &amp; 0x80);
bit_w(data &amp; 0x40);
bit_w(data &amp; 0x20);
bit_w(data &amp; 0x10);
bit_w(data &amp; 0x08);
bit_w(data &amp; 0x04);
bit_w(data &amp; 0x02);
bit_w(data &amp; 0x01);
bit_w(data &amp; 0x800000);
bit_w(data &amp; 0x400000);
bit_w(data &amp; 0x200000);
bit_w(data &amp; 0x100000);
bit_w(data &amp; 0x080000);
bit_w(data &amp; 0x040000);
bit_w(data &amp; 0x020000);
bit_w(data &amp; 0x010000);  
bit_w(data &amp; 0x8000);    
bit_w(data &amp; 0x4000);    
bit_w(data &amp; 0x2000);    
bit_w(data &amp; 0x1000);    
bit_w(data &amp; 0x0800);    
bit_w(data &amp; 0x0400);    
bit_w(data &amp; 0x0200);    
bit_w(data &amp; 0x0100); 
   sei(); 
delayMicroseconds(10);
}}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (liman324)]]></author>
			<pubDate>Thu, 18 Mar 2021 01:53:02 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?pid=3299#p3299</guid>
		</item>
		<item>
			<title><![CDATA[w2812 attiny2313]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?pid=3298#p3298</link>
			<description><![CDATA[<div class="codebox"><pre><code>//  ATtiny2313 12MHz

#define L_BIT    PORTB &amp;= ~(1&lt;&lt;0)
#define H_BIT    PORTB |=  (1&lt;&lt;0)    

byte times;
int i=0;

void setup(){
   DDRB |= (1&lt;&lt;0);
}

void loop(){ 
 
    led(10, 0, 0);
    led(0, 10, 0);
    led(0, 0, 10);
    led(0, 0, 0);
    
    
    res();
 // delay(500);

  }

void bit_0(){H_BIT;asm(&quot;nop&quot;);   L_BIT;asm(&quot;nop&quot;);asm(&quot;nop&quot;);}
void bit_1(){H_BIT;asm(&quot;nop&quot;);asm(&quot;nop&quot;);asm(&quot;nop&quot;);asm(&quot;nop&quot;);  L_BIT;}
void bit_w(bool x){if(x) bit_1(); else bit_0();}
void res(){delayMicroseconds(100);}

void led(long rrr, int ggg, byte bbb){
  unsigned long data = ((rrr &lt;&lt; 16) &amp; 0xFF0000) + ((ggg &lt;&lt; 8) &amp; 0xFF00) + bbb;
  cli();
bit_w(data &amp; 0x80);
bit_w(data &amp; 0x40);
bit_w(data &amp; 0x20);
bit_w(data &amp; 0x10);
bit_w(data &amp; 0x08);
bit_w(data &amp; 0x04);
bit_w(data &amp; 0x02);
bit_w(data &amp; 0x01);
bit_w(data &amp; 0x800000);
bit_w(data &amp; 0x400000);
bit_w(data &amp; 0x200000);
bit_w(data &amp; 0x100000);
bit_w(data &amp; 0x080000);
bit_w(data &amp; 0x040000);
bit_w(data &amp; 0x020000);
bit_w(data &amp; 0x010000);  
bit_w(data &amp; 0x8000);    
bit_w(data &amp; 0x4000);    
bit_w(data &amp; 0x2000);    
bit_w(data &amp; 0x1000);    
bit_w(data &amp; 0x0800);    
bit_w(data &amp; 0x0400);    
bit_w(data &amp; 0x0200);    
bit_w(data &amp; 0x0100);   
   sei(); 
delayMicroseconds(10);
  
  }</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (liman324)]]></author>
			<pubDate>Thu, 18 Mar 2021 01:52:45 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?pid=3298#p3298</guid>
		</item>
	</channel>
</rss>
