<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[forum.rcl-radio.ru &mdash; w2812 attiny2313]]></title>
	<link rel="self" href="http://forum.rcl-radio.ru/extern.php?action=feed&amp;tid=288&amp;type=atom" />
	<updated>2021-03-18T03:27:58Z</updated>
	<generator>PunBB</generator>
	<id>http://forum.rcl-radio.ru/viewtopic.php?id=288</id>
		<entry>
			<title type="html"><![CDATA[Re: w2812 attiny2313]]></title>
			<link rel="alternate" href="http://forum.rcl-radio.ru/viewtopic.php?pid=3300#p3300" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[liman324]]></name>
				<uri>http://forum.rcl-radio.ru/profile.php?id=2</uri>
			</author>
			<updated>2021-03-18T03:27:58Z</updated>
			<id>http://forum.rcl-radio.ru/viewtopic.php?pid=3300#p3300</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: w2812 attiny2313]]></title>
			<link rel="alternate" href="http://forum.rcl-radio.ru/viewtopic.php?pid=3299#p3299" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[liman324]]></name>
				<uri>http://forum.rcl-radio.ru/profile.php?id=2</uri>
			</author>
			<updated>2021-03-18T01:53:02Z</updated>
			<id>http://forum.rcl-radio.ru/viewtopic.php?pid=3299#p3299</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[w2812 attiny2313]]></title>
			<link rel="alternate" href="http://forum.rcl-radio.ru/viewtopic.php?pid=3298#p3298" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[liman324]]></name>
				<uri>http://forum.rcl-radio.ru/profile.php?id=2</uri>
			</author>
			<updated>2021-03-18T01:52:45Z</updated>
			<id>http://forum.rcl-radio.ru/viewtopic.php?pid=3298#p3298</id>
		</entry>
</feed>
