Neo Pixels + Bit-Banging

Hallo, ich wollte ein Code implementieren mit dem ich sowohl NeoPixels als auch DotStar LEDs zu steuern.

Bei den NeoPixels habe ich mein eigenes Programm erstellt mit Bit-Banging und für die andere habe ich die Bibliotek benutz aber irgenwie die Single Wire LEDs leuchten nicht an.

Ich vermute, dass es an der zwei Void funktionen liegt aber kann das Fehler selbst nicht finden. Könnt jemand mir hier helfen?

//Include libraries
#include <SPI.h>
#include <Adafruit_DotStar.h>

//Name the constant values
//Single Wire LED requirements
#define A                 255    // First chip on the Single Wire LED
#define B                 255    // Second chip on the Single Wire LED
#define C                 255    // Third chip on the Single Wire LED
#define DIGITAL_PIN       8      // Pin connected to the DIN pin of the LED
#define PORT              PORTB  // Port
#define PORT_PIN          PORTB0 // Port pin
#define PW                1000    //Pulse width
#define ST                100    //Setting time (Spectrometer)

//Double Wire LED requirements
#define CLOCKPIN        13
#define DATAPIN         11       // Data pin
#define NUMPIXELS       1        // Number of LEDs to be controlled

//Create variables
uint32_t t_f;                   //Used for Bit-banging
int sel = 0;                    //Program selector
int C1, C2, C4, C8;             //4 position switch 
boolean flag = true;            //To avoid a repeating loop

//Create the strip object
Adafruit_DotStar  strip = Adafruit_DotStar(NUMPIXELS, DATAPIN,  CLOCKPIN, DOTSTAR_RGB);

//Component set-up
void setup() {
 pinMode(3,INPUT);             //Selector for either SW or DW code
 pinMode(4,INPUT);
 pinMode(5,INPUT); 
 pinMode(6,INPUT);
 pinMode(7,INPUT);  
 digitalWrite(DIGITAL_PIN,0);
 strip.begin();                //Initializes the stip
 strip.show();                 //Turn off all LEDs within the NUMPIXELS range
}

void singlewire(){
 if(!C1&&!C2&&!C4&&!C8) //Rotating switch position: 0
 {
   write_1w(0, 0, 0);  
   delay(PW);
 }
 
 /*if(C1&&!C2&&!C4&&!C8) //Rotating switch position: 1
 {
    write_1w(A, 0, 0);
   delayMicroseconds(300);          //T reset, 300 ms should fulfill the requirements or the IC LEDs in the market
   delay(PW);
 }
 
 if(!C1&&C2&&!C4&&!C8) //Rotating switch position: 2
 {
   write_1w(0, B, 0);
   digitalWrite(DIGITAL_PIN,0);     //Set output to low
   delayMicroseconds(300);          //T reset, 300 ms should fulfill the requirements or the IC LEDs in the market
   delay(PW);
  }
 
 if(C1&&C2&&!C4&&!C8)  //Rotating switch position: 3
 {
   //Turn on third chip of the LED
   write_1w(0, 0, C);
   digitalWrite(DIGITAL_PIN,0);     //Set output to low
   delayMicroseconds(300);          //T reset, 300 ms should fulfill the requirements or the IC LEDs in the market
   delay(PW);
 }
 
 if(!C1&&!C2&&C4&&!C8) //Rotating switch position: 4
 {
   //Turn on chip 1 and 2 of the LED 
   write_1w(A, B, 0);
   digitalWrite(DIGITAL_PIN,0);     //Set output to low
   delayMicroseconds(300);          //T reset, 300 ms should fulfill the requirements or the IC LEDs in the market
   delay(PW);
 }
 
 if(C1&&!C2&&C4&&!C8) //Rotating switch position: 5
 {
   //Turn on chip 2 and 3 of the LED 
   write_1w(0, B, C);
   digitalWrite(DIGITAL_PIN,0);     //Set output to low
   delayMicroseconds(300);          //T reset, 300 ms should fulfill the requirements or the IC LEDs in the market
   delay(PW);
 }
 
 if(!C1&&C2&&C4&&!C8) //Rotating switch position: 6
 {
   //Turn on chip 1 and 3 of the LED 
   write_1w(A, 0, C);
   digitalWrite(DIGITAL_PIN,0);     //Set output to low
   delayMicroseconds(300);          //T reset, 300 ms should fulfill the requirements or the IC LEDs in the market
   delay(PW);
 }
 
 if(C1&&C2&&C4&&!C8) //Rotating switch position: 7
 {
   write_1w(A, B, C);
   digitalWrite(DIGITAL_PIN,0);     //Set output to low
   delayMicroseconds(300);          //T reset, 300 ms should fulfill the requirements or the IC LEDs in the market
   delay(PW);
 } 
 
 if(!C1&&!C2&&!C4&&C8) //Rotating switch position: 8
 {
 //Empty
 }
 
 if(C1&&!C2&&!C4&&C8) //Rotating switch position: 9
 {
 //Empty
 } */
 
 else{
 //Do nothing in case there is a failure in the lecture of the switch's position. 
 }  
}

//Bit banging procotol
void write_1w(unsigned char x, unsigned char y, unsigned char z)
{
     cli();                            // Disable interrupts so that timing is as precise as possible
     if(x & 0b10000000 )               //If the first bit equals 1, the pin is controlled as it follows         
     {
       asm volatile(
       // Instruction        Clock   Description   Phase     Bit Transmitted
       "sbi  %0, %1\n\t"     // 2    PIN HIGH      (T =  2)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  4)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  6)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  8)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 10)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 12)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 14)        
       "nop\n\t"             // 1    nop           (T = 15)
       "cbi   %0, %1\n\t"    // 2    PIN LOW       (T = 17)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 19) 1
       ::
       // Input operands
       "I" (_SFR_IO_ADDR(PORT)), //%0
       "I" (PORT_PIN)            //%1
       );
     } else                            //If the first bit equals 0, the pin is controlled as it follows   
     {
         asm volatile(
         // Instruction        Clock   Description   Phase     Bit Transmitted
         "sbi  %0, %1\n\t"     // 2    PIN HIGH      (T =  2)  
         "rjmp .+0\n\t"        // 2    nop nop       (T =  4)
         "nop\n\t"             // 1    nop           (T =  5)
         "cbi   %0, %1\n\t"    // 2    PIN LOW       (T =  7)
         "rjmp .+0\n\t"        // 2    nop nop       (T =  9)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 11)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 13)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 15)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 17)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 19)    0
         ::
         // Input operands
         "I" (_SFR_IO_ADDR(PORT)), //%0
         "I" (PORT_PIN)            //%1
         );
    }
     if(x & 0b01000000 )            
     {
       asm volatile(
       // Instruction        Clock   Description   Phase     Bit Transmitted
       "sbi  %0, %1\n\t"     // 2    PIN HIGH      (T =  2)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  4)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  6)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  8)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 10)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 12)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 14)        
       "nop\n\t"             // 1    nop           (T = 15)
       "cbi   %0, %1\n\t"    // 2    PIN LOW       (T = 17)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 19) 1
       ::
       // Input operands
       "I" (_SFR_IO_ADDR(PORT)), //%0
       "I" (PORT_PIN)            //%1
       );
     } else
     {
         asm volatile(
         // Instruction        Clock   Description   Phase     Bit Transmitted
         "sbi  %0, %1\n\t"     // 2    PIN HIGH      (T =  2)  
         "rjmp .+0\n\t"        // 2    nop nop       (T =  4)
         "nop\n\t"             // 1    nop           (T =  5)
         "cbi   %0, %1\n\t"    // 2    PIN LOW       (T =  7)
         "rjmp .+0\n\t"        // 2    nop nop       (T =  9)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 11)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 13)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 15)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 17)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 19)  0
         ::
         // Input operands
         "I" (_SFR_IO_ADDR(PORT)), //%0
         "I" (PORT_PIN)            //%1
         );
    }
     if(x & 0b00100000 )            
     {
       asm volatile(
       // Instruction        Clock   Description   Phase     Bit Transmitted
       "sbi  %0, %1\n\t"     // 2    PIN HIGH      (T =  2)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  4)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  6)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  8)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 10)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 12)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 14)        
       "nop\n\t"             // 1    nop           (T = 15)
       "cbi   %0, %1\n\t"    // 2    PIN LOW       (T = 17)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 19) 1
       ::
       // Input operands
       "I" (_SFR_IO_ADDR(PORT)), //%0
       "I" (PORT_PIN)            //%1
       );
     } else
     {
         asm volatile(
         // Instruction        Clock   Description   Phase     Bit Transmitted
         "sbi  %0, %1\n\t"     // 2    PIN HIGH      (T =  2)  
         "rjmp .+0\n\t"        // 2    nop nop       (T =  4)
         "nop\n\t"             // 1    nop           (T =  5)
         "cbi   %0, %1\n\t"    // 2    PIN LOW       (T =  7)
         "rjmp .+0\n\t"        // 2    nop nop       (T =  9)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 11)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 13)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 15)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 17)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 19)  0
         ::
         // Input operands
         "I" (_SFR_IO_ADDR(PORT)), //%0
         "I" (PORT_PIN)            //%1
         );
    }
     if(x & 0b00010000 )            
     {
       asm volatile(
       // Instruction        Clock   Description   Phase     Bit Transmitted
       "sbi  %0, %1\n\t"     // 2    PIN HIGH      (T =  2)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  4)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  6)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  8)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 10)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 12)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 14)        
       "nop\n\t"             // 1    nop           (T = 15)
       "cbi   %0, %1\n\t"    // 2    PIN LOW       (T = 17)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 19)  1
       ::
       // Input operands
       "I" (_SFR_IO_ADDR(PORT)), //%0
       "I" (PORT_PIN)            //%1
       );
     } else
     {
         asm volatile(
         // Instruction        Clock   Description   Phase     Bit Transmitted
         "sbi  %0, %1\n\t"     // 2    PIN HIGH      (T =  2)  
         "rjmp .+0\n\t"        // 2    nop nop       (T =  4)
         "nop\n\t"             // 1    nop           (T =  5)
         "cbi   %0, %1\n\t"    // 2    PIN LOW       (T =  7)
         "rjmp .+0\n\t"        // 2    nop nop       (T =  9)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 11)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 13)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 15)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 17)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 19)  0
         ::
         // Input operands
         "I" (_SFR_IO_ADDR(PORT)), //%0
         "I" (PORT_PIN)            //%1
         );
    }
     if(x & 0b00001000 )            
     {
       asm volatile(
       // Instruction        Clock   Description   Phase     Bit Transmitted
       "sbi  %0, %1\n\t"     // 2    PIN HIGH      (T =  2)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  4)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  6)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  8)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 10)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 12)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 14)        
       "nop\n\t"             // 1    nop           (T = 15)
       "cbi   %0, %1\n\t"    // 2    PIN LOW       (T = 17)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 19)  1
       ::
       // Input operands
       "I" (_SFR_IO_ADDR(PORT)), //%0
       "I" (PORT_PIN)            //%1
       );
     } else
     {
         asm volatile(
         // Instruction        Clock   Description   Phase     Bit Transmitted
         "sbi  %0, %1\n\t"     // 2    PIN HIGH      (T =  2)  
         "rjmp .+0\n\t"        // 2    nop nop       (T =  4)
         "nop\n\t"             // 1    nop           (T =  5)
         "cbi   %0, %1\n\t"    // 2    PIN LOW       (T =  7)
         "rjmp .+0\n\t"        // 2    nop nop       (T =  9)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 11)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 13)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 15)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 17)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 19)   0
         ::
         // Input operands
         "I" (_SFR_IO_ADDR(PORT)), //%0
         "I" (PORT_PIN)            //%1
         );
    }
     if(x & 0b00000100 )            
     {
       asm volatile(
       // Instruction        Clock   Description   Phase     Bit Transmitted
       "sbi  %0, %1\n\t"     // 2    PIN HIGH      (T =  2)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  4)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  6)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  8)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 10)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 12)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 14)        
       "nop\n\t"             // 1    nop           (T = 15)
       "cbi   %0, %1\n\t"    // 2    PIN LOW       (T = 17)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 19)  1
       ::
       // Input operands
       "I" (_SFR_IO_ADDR(PORT)), //%0
       "I" (PORT_PIN)            //%1
       );
     } else
     {
         asm volatile(
         // Instruction        Clock   Description   Phase     Bit Transmitted
         "sbi  %0, %1\n\t"     // 2    PIN HIGH      (T =  2)  
         "rjmp .+0\n\t"        // 2    nop nop       (T =  4)
         "nop\n\t"             // 1    nop           (T =  5)
         "cbi   %0, %1\n\t"    // 2    PIN LOW       (T =  7)
         "rjmp .+0\n\t"        // 2    nop nop       (T =  9)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 11)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 13)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 15)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 17)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 19)  0
         ::
         // Input operands
         "I" (_SFR_IO_ADDR(PORT)), //%0
         "I" (PORT_PIN)            //%1
         );
    }
     if(x & 0b00000010 )            
     {
       asm volatile(
       // Instruction        Clock   Description   Phase     Bit Transmitted
       "sbi  %0, %1\n\t"     // 2    PIN HIGH      (T =  2)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  4)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  6)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  8)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 10)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 12)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 14)        
       "nop\n\t"             // 1    nop           (T = 15)
       "cbi   %0, %1\n\t"    // 2    PIN LOW       (T = 17)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 19)  1
       ::
       // Input operands
       "I" (_SFR_IO_ADDR(PORT)), //%0
       "I" (PORT_PIN)            //%1
       );
     } else
     {
         asm volatile(
         // Instruction        Clock   Description   Phase     Bit Transmitted
         "sbi  %0, %1\n\t"     // 2    PIN HIGH      (T =  2)  
         "rjmp .+0\n\t"        // 2    nop nop       (T =  4)
         "nop\n\t"             // 1    nop           (T =  5)
         "cbi   %0, %1\n\t"    // 2    PIN LOW       (T =  7)
         "rjmp .+0\n\t"        // 2    nop nop       (T =  9)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 11)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 13)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 15)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 17)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 19)  0
         ::
         // Input operands
         "I" (_SFR_IO_ADDR(PORT)), //%0
         "I" (PORT_PIN)            //%1
         );
    }
     if(x & 0b00000001 )            
     {
       asm volatile(
       // Instruction        Clock   Description   Phase     Bit Transmitted
       "sbi  %0, %1\n\t"     // 2    PIN HIGH      (T =  2)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  4)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  6)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  8)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 10)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 12)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 14)        
       "nop\n\t"             // 1    nop           (T = 15)
       "cbi   %0, %1\n\t"    // 2    PIN LOW       (T = 17)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 19)  1
       ::
       // Input operands
       "I" (_SFR_IO_ADDR(PORT)), //%0
       "I" (PORT_PIN)            //%1
       );
     } else
     {
         asm volatile(
         // Instruction        Clock   Description   Phase     Bit Transmitted
         "sbi  %0, %1\n\t"     // 2    PIN HIGH      (T =  2)  
         "rjmp .+0\n\t"        // 2    nop nop       (T =  4)
         "nop\n\t"             // 1    nop           (T =  5)
         "cbi   %0, %1\n\t"    // 2    PIN LOW       (T =  7)
         "rjmp .+0\n\t"        // 2    nop nop       (T =  9)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 11)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 13)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 15)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 17)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 19)  0
         ::
         // Input operands
         "I" (_SFR_IO_ADDR(PORT)), //%0
         "I" (PORT_PIN)            //%1
         );
    }
    /*End of first byte*/

     if(y & 0b10000000 )            
     {
       asm volatile(
       // Instruction        Clock   Description   Phase     Bit Transmitted
       "sbi  %0, %1\n\t"     // 2    PIN HIGH      (T =  2)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  4)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  6)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  8)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 10)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 12)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 14)        
       "nop\n\t"             // 1    nop           (T = 15)
       "cbi   %0, %1\n\t"    // 2    PIN LOW       (T = 17)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 19)  1
       ::
       // Input operands
       "I" (_SFR_IO_ADDR(PORT)), //%0
       "I" (PORT_PIN)            //%1
       );
     } else
     {
         asm volatile(
         // Instruction        Clock   Description   Phase     Bit Transmitted
         "sbi  %0, %1\n\t"     // 2    PIN HIGH      (T =  2)  
         "rjmp .+0\n\t"        // 2    nop nop       (T =  4)
         "nop\n\t"             // 1    nop           (T =  5)
         "cbi   %0, %1\n\t"    // 2    PIN LOW       (T =  7)
         "rjmp .+0\n\t"        // 2    nop nop       (T =  9)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 11)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 13)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 15)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 17)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 19)  0
         ::
         // Input operands
         "I" (_SFR_IO_ADDR(PORT)), //%0
         "I" (PORT_PIN)            //%1
         );
    }
     if(y & 0b01000000 )            
     {
       asm volatile(
       // Instruction        Clock   Description   Phase     Bit Transmitted
       "sbi  %0, %1\n\t"     // 2    PIN HIGH      (T =  2)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  4)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  6)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  8)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 10)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 12)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 14)        
       "nop\n\t"             // 1    nop           (T = 15)
       "cbi   %0, %1\n\t"    // 2    PIN LOW       (T = 17)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 19)  1
       ::
       // Input operands
       "I" (_SFR_IO_ADDR(PORT)), //%0
       "I" (PORT_PIN)            //%1
       );
     } else
     {
         asm volatile(
         // Instruction        Clock   Description   Phase     Bit Transmitted
         "sbi  %0, %1\n\t"     // 2    PIN HIGH      (T =  2)  
         "rjmp .+0\n\t"        // 2    nop nop       (T =  4)
         "nop\n\t"             // 1    nop           (T =  5)
         "cbi   %0, %1\n\t"    // 2    PIN LOW       (T =  7)
         "rjmp .+0\n\t"        // 2    nop nop       (T =  9)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 11)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 13)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 15)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 17)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 19)  0
         ::
         // Input operands
         "I" (_SFR_IO_ADDR(PORT)), //%0
         "I" (PORT_PIN)            //%1
         );
    }
     if(y & 0b00100000 )            
     {
       asm volatile(
       // Instruction        Clock   Description   Phase     Bit Transmitted
       "sbi  %0, %1\n\t"     // 2    PIN HIGH      (T =  2)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  4)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  6)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  8)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 10)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 12)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 14)        
       "nop\n\t"             // 1    nop           (T = 15)
       "cbi   %0, %1\n\t"    // 2    PIN LOW       (T = 17)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 19)  1
       ::
       // Input operands
       "I" (_SFR_IO_ADDR(PORT)), //%0
       "I" (PORT_PIN)            //%1
       );
     } else
     {
         asm volatile(
         // Instruction        Clock   Description   Phase     Bit Transmitted
         "sbi  %0, %1\n\t"     // 2    PIN HIGH      (T =  2)  
         "rjmp .+0\n\t"        // 2    nop nop       (T =  4)
         "nop\n\t"             // 1    nop           (T =  5)
         "cbi   %0, %1\n\t"    // 2    PIN LOW       (T =  7)
         "rjmp .+0\n\t"        // 2    nop nop       (T =  9)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 11)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 13)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 15)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 17)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 19)  0
         ::
         // Input operands
         "I" (_SFR_IO_ADDR(PORT)), //%0
         "I" (PORT_PIN)            //%1
         );
    }
     if(y & 0b00010000 )            
     {
       asm volatile(
       // Instruction        Clock   Description   Phase     Bit Transmitted
       "sbi  %0, %1\n\t"     // 2    PIN HIGH      (T =  2)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  4)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  6)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  8)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 10)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 12)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 14)        
       "nop\n\t"             // 1    nop           (T = 15)
       "cbi   %0, %1\n\t"    // 2    PIN LOW       (T = 17)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 19)  1
       ::
       // Input operands
       "I" (_SFR_IO_ADDR(PORT)), //%0
       "I" (PORT_PIN)            //%1
       );
     } else
     {
         asm volatile(
         // Instruction        Clock   Description   Phase     Bit Transmitted
         "sbi  %0, %1\n\t"     // 2    PIN HIGH      (T =  2)  
         "rjmp .+0\n\t"        // 2    nop nop       (T =  4)
         "nop\n\t"             // 1    nop           (T =  5)
         "cbi   %0, %1\n\t"    // 2    PIN LOW       (T =  7)
         "rjmp .+0\n\t"        // 2    nop nop       (T =  9)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 11)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 13)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 15)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 17)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 19) 0
         ::
         // Input operands
         "I" (_SFR_IO_ADDR(PORT)), //%0
         "I" (PORT_PIN)            //%1
         );
    }
     if(y & 0b00001000 )            
     {
       asm volatile(
       // Instruction        Clock   Description   Phase     Bit Transmitted
       "sbi  %0, %1\n\t"     // 2    PIN HIGH      (T =  2)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  4)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  6)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  8)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 10)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 12)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 14)        
       "nop\n\t"             // 1    nop           (T = 15)
       "cbi   %0, %1\n\t"    // 2    PIN LOW       (T = 17)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 19)  1
       ::
       // Input operands
       "I" (_SFR_IO_ADDR(PORT)), //%0
       "I" (PORT_PIN)            //%1
       );
     } else
     {
         asm volatile(
         // Instruction        Clock   Description   Phase     Bit Transmitted
         "sbi  %0, %1\n\t"     // 2    PIN HIGH      (T =  2)  
         "rjmp .+0\n\t"        // 2    nop nop       (T =  4)
         "nop\n\t"             // 1    nop           (T =  5)
         "cbi   %0, %1\n\t"    // 2    PIN LOW       (T =  7)
         "rjmp .+0\n\t"        // 2    nop nop       (T =  9)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 11)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 13)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 15)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 17)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 19)  0
         ::
         // Input operands
         "I" (_SFR_IO_ADDR(PORT)), //%0
         "I" (PORT_PIN)            //%1
         );
    }
     if(y & 0b00000100 )            
     {
       asm volatile(
       // Instruction        Clock   Description   Phase     Bit Transmitted
       "sbi  %0, %1\n\t"     // 2    PIN HIGH      (T =  2)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  4)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  6)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  8)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 10)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 12)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 14)        
       "nop\n\t"             // 1    nop           (T = 15)
       "cbi   %0, %1\n\t"    // 2    PIN LOW       (T = 17)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 19)  1
       ::
       // Input operands
       "I" (_SFR_IO_ADDR(PORT)), //%0
       "I" (PORT_PIN)            //%1
       );
     } else
     {
         asm volatile(
         // Instruction        Clock   Description   Phase     Bit Transmitted
         "sbi  %0, %1\n\t"     // 2    PIN HIGH      (T =  2)  
         "rjmp .+0\n\t"        // 2    nop nop       (T =  4)
         "nop\n\t"             // 1    nop           (T =  5)
         "cbi   %0, %1\n\t"    // 2    PIN LOW       (T =  7)
         "rjmp .+0\n\t"        // 2    nop nop       (T =  9)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 11)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 13)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 15)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 17)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 19)  0
         ::
         // Input operands
         "I" (_SFR_IO_ADDR(PORT)), //%0
         "I" (PORT_PIN)            //%1
         );
    }
     if(y & 0b00000010 )            
     {
       asm volatile(
       // Instruction        Clock   Description   Phase     Bit Transmitted
       "sbi  %0, %1\n\t"     // 2    PIN HIGH      (T =  2)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  4)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  6)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  8)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 10)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 12)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 14)        
       "nop\n\t"             // 1    nop           (T = 15)
       "cbi   %0, %1\n\t"    // 2    PIN LOW       (T = 17)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 19)  1
       ::
       // Input operands
       "I" (_SFR_IO_ADDR(PORT)), //%0
       "I" (PORT_PIN)            //%1
       );
     } else
     {
         asm volatile(
         // Instruction        Clock   Description   Phase     Bit Transmitted
         "sbi  %0, %1\n\t"     // 2    PIN HIGH      (T =  2)  
         "rjmp .+0\n\t"        // 2    nop nop       (T =  4)
         "nop\n\t"             // 1    nop           (T =  5)
         "cbi   %0, %1\n\t"    // 2    PIN LOW       (T =  7)
         "rjmp .+0\n\t"        // 2    nop nop       (T =  9)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 11)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 13)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 15)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 17)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 19)  0
         ::
         // Input operands
         "I" (_SFR_IO_ADDR(PORT)), //%0
         "I" (PORT_PIN)            //%1
         );
    }
     if(y & 0b00000001 )            
     {
       asm volatile(
       // Instruction        Clock   Description   Phase     Bit Transmitted
       "sbi  %0, %1\n\t"     // 2    PIN HIGH      (T =  2)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  4)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  6)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  8)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 10)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 12)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 14)        
       "nop\n\t"             // 1    nop           (T = 15)
       "cbi   %0, %1\n\t"    // 2    PIN LOW       (T = 17)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 19)  1
       ::
       // Input operands
       "I" (_SFR_IO_ADDR(PORT)), //%0
       "I" (PORT_PIN)            //%1
       );
     } else
     {
         asm volatile(
         // Instruction        Clock   Description   Phase     Bit Transmitted
         "sbi  %0, %1\n\t"     // 2    PIN HIGH      (T =  2)  
         "rjmp .+0\n\t"        // 2    nop nop       (T =  4)
         "nop\n\t"             // 1    nop           (T =  5)
         "cbi   %0, %1\n\t"    // 2    PIN LOW       (T =  7)
         "rjmp .+0\n\t"        // 2    nop nop       (T =  9)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 11)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 13)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 15)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 17)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 19)  0
         ::
         // Input operands
         "I" (_SFR_IO_ADDR(PORT)), //%0
         "I" (PORT_PIN)            //%1
         );
    }

    /*End of second byte*/
    
     if(z & 0b10000000 )            
     {
       asm volatile(
       // Instruction        Clock   Description   Phase     Bit Transmitted
       "sbi  %0, %1\n\t"     // 2    PIN HIGH      (T =  2)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  4)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  6)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  8)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 10)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 12)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 14)        
       "nop\n\t"             // 1    nop           (T = 15)
       "cbi   %0, %1\n\t"    // 2    PIN LOW       (T = 17)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 19)  1
       ::
       // Input operands
       "I" (_SFR_IO_ADDR(PORT)), //%0
       "I" (PORT_PIN)            //%1
       );
     } else
     {
         asm volatile(
         // Instruction        Clock   Description   Phase     Bit Transmitted
         "sbi  %0, %1\n\t"     // 2    PIN HIGH      (T =  2)  
         "rjmp .+0\n\t"        // 2    nop nop       (T =  4)
         "nop\n\t"             // 1    nop           (T =  5)
         "cbi   %0, %1\n\t"    // 2    PIN LOW       (T =  7)
         "rjmp .+0\n\t"        // 2    nop nop       (T =  9)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 11)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 13)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 15)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 17)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 19)  0
         ::
         // Input operands
         "I" (_SFR_IO_ADDR(PORT)), //%0
         "I" (PORT_PIN)            //%1
         );
    }
     if(z & 0b01000000 )            
     {
       asm volatile(
       // Instruction        Clock   Description   Phase     Bit Transmitted
       "sbi  %0, %1\n\t"     // 2    PIN HIGH      (T =  2)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  4)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  6)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  8)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 10)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 12)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 14)        
       "nop\n\t"             // 1    nop           (T = 15)
       "cbi   %0, %1\n\t"    // 2    PIN LOW       (T = 17)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 19)  1
       ::
       // Input operands
       "I" (_SFR_IO_ADDR(PORT)), //%0
       "I" (PORT_PIN)            //%1
       );
     } else
     {
         asm volatile(
         // Instruction        Clock   Description   Phase     Bit Transmitted
         "sbi  %0, %1\n\t"     // 2    PIN HIGH      (T =  2)  
         "rjmp .+0\n\t"        // 2    nop nop       (T =  4)
         "nop\n\t"             // 1    nop           (T =  5)
         "cbi   %0, %1\n\t"    // 2    PIN LOW       (T =  7)
         "rjmp .+0\n\t"        // 2    nop nop       (T =  9)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 11)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 13)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 15)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 17)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 19)  0
         ::
         // Input operands
         "I" (_SFR_IO_ADDR(PORT)), //%0
         "I" (PORT_PIN)            //%1
         );
    }
     if(z & 0b00100000 )            
     {
       asm volatile(
       // Instruction        Clock   Description   Phase     Bit Transmitted
       "sbi  %0, %1\n\t"     // 2    PIN HIGH      (T =  2)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  4)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  6)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  8)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 10)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 12)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 14)        
       "nop\n\t"             // 1    nop           (T = 15)
       "cbi   %0, %1\n\t"    // 2    PIN LOW       (T = 17)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 19)  1
       ::
       // Input operands
       "I" (_SFR_IO_ADDR(PORT)), //%0
       "I" (PORT_PIN)            //%1
       );
     } else
     {
         asm volatile(
         // Instruction        Clock   Description   Phase     Bit Transmitted
         "sbi  %0, %1\n\t"     // 2    PIN HIGH      (T =  2)  
         "rjmp .+0\n\t"        // 2    nop nop       (T =  4)
         "nop\n\t"             // 1    nop           (T =  5)
         "cbi   %0, %1\n\t"    // 2    PIN LOW       (T =  7)
         "rjmp .+0\n\t"        // 2    nop nop       (T =  9)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 11)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 13)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 15)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 17)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 19)  0
         ::
         // Input operands
         "I" (_SFR_IO_ADDR(PORT)), //%0
         "I" (PORT_PIN)            //%1
         );
    }
     if(z & 0b00010000 )            
     {
       asm volatile(
       // Instruction        Clock   Description   Phase     Bit Transmitted
       "sbi  %0, %1\n\t"     // 2    PIN HIGH      (T =  2)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  4)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  6)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  8)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 10)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 12)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 14)        
       "nop\n\t"             // 1    nop           (T = 15)
       "cbi   %0, %1\n\t"    // 2    PIN LOW       (T = 17)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 19)  1
       ::
       // Input operands
       "I" (_SFR_IO_ADDR(PORT)), //%0
       "I" (PORT_PIN)            //%1
       );
     } else
     {
         asm volatile(
         // Instruction        Clock   Description   Phase     Bit Transmitted
         "sbi  %0, %1\n\t"     // 2    PIN HIGH      (T =  2)  
         "rjmp .+0\n\t"        // 2    nop nop       (T =  4)
         "nop\n\t"             // 1    nop           (T =  5)
         "cbi   %0, %1\n\t"    // 2    PIN LOW       (T =  7)
         "rjmp .+0\n\t"        // 2    nop nop       (T =  9)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 11)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 13)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 15)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 17)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 19)   0
         ::
         // Input operands
         "I" (_SFR_IO_ADDR(PORT)), //%0
         "I" (PORT_PIN)            //%1
         );
    }
     if(z & 0b00001000 )            
     {
       asm volatile(
       // Instruction        Clock   Description   Phase     Bit Transmitted
       "sbi  %0, %1\n\t"     // 2    PIN HIGH      (T =  2)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  4)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  6)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  8)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 10)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 12)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 14)        
       "nop\n\t"             // 1    nop           (T = 15)
       "cbi   %0, %1\n\t"    // 2    PIN LOW       (T = 17)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 19)  1
       ::
       // Input operands
       "I" (_SFR_IO_ADDR(PORT)), //%0
       "I" (PORT_PIN)            //%1
       );
     } else
     {
         asm volatile(
         // Instruction        Clock   Description   Phase     Bit Transmitted
         "sbi  %0, %1\n\t"     // 2    PIN HIGH      (T =  2)  
         "rjmp .+0\n\t"        // 2    nop nop       (T =  4)
         "nop\n\t"             // 1    nop           (T =  5)
         "cbi   %0, %1\n\t"    // 2    PIN LOW       (T =  7)
         "rjmp .+0\n\t"        // 2    nop nop       (T =  9)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 11)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 13)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 15)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 17)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 19)   0
         ::
         // Input operands
         "I" (_SFR_IO_ADDR(PORT)), //%0
         "I" (PORT_PIN)            //%1
         );
    }
     if(z & 0b00000100 )            
     {
       asm volatile(
       // Instruction        Clock   Description   Phase     Bit Transmitted
       "sbi  %0, %1\n\t"     // 2    PIN HIGH      (T =  2)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  4)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  6)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  8)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 10)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 12)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 14)        
       "nop\n\t"             // 1    nop           (T = 15)
       "cbi   %0, %1\n\t"    // 2    PIN LOW       (T = 17)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 19)  1
       ::
       // Input operands
       "I" (_SFR_IO_ADDR(PORT)), //%0
       "I" (PORT_PIN)            //%1
       );
     } else
     {
         asm volatile(
         // Instruction        Clock   Description   Phase     Bit Transmitted
         "sbi  %0, %1\n\t"     // 2    PIN HIGH      (T =  2)  
         "rjmp .+0\n\t"        // 2    nop nop       (T =  4)
         "nop\n\t"             // 1    nop           (T =  5)
         "cbi   %0, %1\n\t"    // 2    PIN LOW       (T =  7)
         "rjmp .+0\n\t"        // 2    nop nop       (T =  9)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 11)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 13)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 15)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 17)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 19)  0
         ::
         // Input operands
         "I" (_SFR_IO_ADDR(PORT)), //%0
         "I" (PORT_PIN)            //%1
         );
    }
     if(z & 0b00000010 )            
     {
       asm volatile(
       // Instruction        Clock   Description   Phase     Bit Transmitted
       "sbi  %0, %1\n\t"     // 2    PIN HIGH      (T =  2)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  4)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  6)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  8)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 10)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 12)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 14)        
       "nop\n\t"             // 1    nop           (T = 15)
       "cbi   %0, %1\n\t"    // 2    PIN LOW       (T = 17)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 19)  1
       ::
       // Input operands
       "I" (_SFR_IO_ADDR(PORT)), //%0
       "I" (PORT_PIN)            //%1
       );
     } else
     {
         asm volatile(
         // Instruction        Clock   Description   Phase     Bit Transmitted
         "sbi  %0, %1\n\t"     // 2    PIN HIGH      (T =  2)  
         "rjmp .+0\n\t"        // 2    nop nop       (T =  4)
         "nop\n\t"             // 1    nop           (T =  5)
         "cbi   %0, %1\n\t"    // 2    PIN LOW       (T =  7)
         "rjmp .+0\n\t"        // 2    nop nop       (T =  9)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 11)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 13)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 15)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 17)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 19)  0
         ::
         // Input operands
         "I" (_SFR_IO_ADDR(PORT)), //%0
         "I" (PORT_PIN)            //%1
         );
    }
     if(z & 0b00000001 )            
     {
       asm volatile(
       // Instruction        Clock   Description   Phase     Bit Transmitted
       "sbi  %0, %1\n\t"     // 2    PIN HIGH      (T =  2)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  4)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  6)
       "rjmp .+0\n\t"        // 2    nop nop       (T =  8)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 10)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 12)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 14)        
       "nop\n\t"             // 1    nop           (T = 15)
       "cbi   %0, %1\n\t"    // 2    PIN LOW       (T = 17)
       "rjmp .+0\n\t"        // 2    nop nop       (T = 19)  1
       ::
       // Input operands
       "I" (_SFR_IO_ADDR(PORT)), //%0
       "I" (PORT_PIN)            //%1
       );
     } else
     {
         asm volatile(
         // Instruction        Clock   Description   Phase     Bit Transmitted
         "sbi  %0, %1\n\t"     // 2    PIN HIGH      (T =  2)  
         "rjmp .+0\n\t"        // 2    nop nop       (T =  4)
         "nop\n\t"             // 1    nop           (T =  5)
         "cbi   %0, %1\n\t"    // 2    PIN LOW       (T =  7)
         "rjmp .+0\n\t"        // 2    nop nop       (T =  9)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 11)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 13)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 15)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 17)
         "rjmp .+0\n\t"        // 2    nop nop       (T = 19)  0
         ::
         // Input operands
         "I" (_SFR_IO_ADDR(PORT)), //%0
         "I" (PORT_PIN)            //%1
         );
    }
    /*End of third byte */
    sei();                           //Enable interruptions
    
}

void doublewire(){
 if(!C1&&!C2&&!C4&&!C8) //Rotating switch position: 0
   {
     strip.setPixelColor(0, 0x000000);     //Color format = BGR
     strip.show();
     delay(PW);
     strip.setPixelColor(0, 0x000000);     //Color format = BGR
     strip.show();
   }    
   
   if(C1&&!C2&&!C4&&!C8) //Rotating switch position: 1
   {
     strip.setPixelColor(0, 0xFF0000);     //Color format = BGR
     strip.show();
     delay(PW);
     strip.setPixelColor(0, 0x000000);     //Color format = BGR
     strip.show();
   }

   if(!C1&&C2&&!C4&&!C8) //Rotating switch position: 2
   {
     strip.setPixelColor(0, 0x00FF00);     //Color format = BGR
     strip.show();
     delay(PW);
     strip.setPixelColor(0, 0x000000);     //Color format = BGR
     strip.show();
   }

   if(C1&&C2&&!C4&&!C8)  //Rotating switch position: 3
   {
     strip.setPixelColor(0, 0x0000FF);     //Color format = BGR
     strip.show();
     delay(PW);  
     strip.setPixelColor(0, 0x000000);     //Color format = BGR
     strip.show();    
   }
  else{
   //Do nothing in case there is a failure in the lecture of the switch's position. 
  }
}
//Program initialization
void loop() {
 while(flag){
   
   C1 = /*digitalRead(4);*/true;
   C2 = false;//digitalRead(7);/*true;*/
   C4 = false;///*true;*/digitalRead(5);
   C8 = false;///*false;*/digitalRead(6);
   if(/*digitalRead(3)*/true){
     singlewire();
     flag = false;
   }
   else{
     doublewire();
     flag = false;
   }
 }
}

Welche Motivation steckt dahinter, das selbst zu machen?

So geht es doch auch und aus meiner Sicht auch einfacher:

#include <Adafruit_DotStar.h>
#include <Adafruit_NeoPixel.h>

#define NEO_PIN          8       // Pin connected to the DIN pin of the LED
#define NEOPIXELS        9
Adafruit_NeoPixel stripN = Adafruit_NeoPixel(NEOPIXELS, NEO_PIN, NEO_RGB + NEO_KHZ800);

//Double Wire LED requirements
#define CLOCKPIN        13       // Clock pin
#define DATAPIN         11       // Data pin
#define NUMPIXELS       10       // Number of LEDs to be controlled

Adafruit_DotStar  stripD = Adafruit_DotStar(NUMPIXELS, DATAPIN,  CLOCKPIN, DOTSTAR_RGB);

void setup() {
  stripN.begin();                //Initializes the stip
  stripN.fill(0x200000);
  stripN.show();
  
  stripD.begin();                //Initializes the stip
  stripD.fill(0xFFFFFF);
  stripD.show();
}

void loop() {
}

Nein liegt es absolut nicht.
void heißt nur daß eine Funktion keinen Rückgabewert gibt. Also kann void nichts blockieren.

Wieso benutzt Du keine Bibliotheken? sonder willst es mit Assembler machen?

Neopixel aka WS2812 mit einem Datensignal mit konstanter Frequenz
Dot Star aka WS2801 mit Datensignal und clock mit Variabler Datenrate bis zu einigen 10MHz

Fastspi kann beide bedienen. Einfach 2 Objekte definieren.

Grüße Uwe

Hi Uwe ,

vielen Dank für deine Antwort ich wollte mal die Eigenschaften der LEDs testen und ich mach es mit Assembler weil ich eine RGBW LED auf Alibaba gefunden habe, die mit 32 bits anstatt 24 programmiert werden muss.

Mit NeoPixels kenne ich micht nicht so gut, deswegen wollte ich mal mit der WS2812 testen und wenn es klapp. kann ich meine Programmierung erweitern.

Trotzdem alle Vorschlage sind gerne wilkommen.
Grüße,
Carlos

Die Bibliothek Adafruit_NeoPixel kann auch RGBW, siehe Beispiel RGBWstrandtest.ino mit dem Parameter NEO_RGBW.

Du brauchst das Rad also nicht ein zweites Mal zu erfinden :slightly_smiling_face:

Mein Beispiel mit RGBW-LEDs:

#include <Adafruit_DotStar.h>
#include <Adafruit_NeoPixel.h>

#define NEO_PIN          8       // Pin connected to the DIN pin of the LED
#define NEOPIXELS        9
Adafruit_NeoPixel stripN = Adafruit_NeoPixel(NEOPIXELS, NEO_PIN, NEO_GRBW + NEO_KHZ800);

//Double Wire LED requirements
#define CLOCKPIN        13       // Clock pin
#define DATAPIN         11       // Data pin
#define NUMPIXELS       10       // Number of LEDs to be controlled

Adafruit_DotStar  stripD = Adafruit_DotStar(NUMPIXELS, DATAPIN,  CLOCKPIN, DOTSTAR_BGR);

void setup() {
  stripN.begin();                //Initializes the stip
  stripN.fill(0x55000000);
  stripN.show();
  
  stripD.begin();                //Initializes the stip
  stripD.fill(0xDC143C);
  stripD.show();
}

void loop() {
}

Die vonmir genannte FastLED -Bibliothek GitHub - FastLED/FastLED: The FastLED library for colored LED animation on Arduino. Please direct que kann vieles aber scheinbar kein RGBW.
Grüße Uwe

Vielen Dank an alle für eure Antworte. Wie ich mich es vorgestellt hab, eine Unterbrechung in den Code ist nicht möglich. Hat jemand noch sowas in die richtung schon bearbeitet?

Beste Grüße,
Carlos

Das verstehe ich nicht, was meinst Du damit? Was willst Du wie unterbrechen?

Ja. Hat schon jemand bearbeitet.

Wie lautet die konkrete Frage nach 26 Tagen?

Ich möchte die Routine eines Strip unterbrechen, sobald eine Taste gedrückt wird. Ich habe es mitbekommen, das milis() mich helfen könnte aber ich komme nicht klar damit

Ich habe es keine Lösung gefunden und mich entschieden mit NeoPixels zu arbeiten

Bitte zeige ein einfaches Testprogramm und beschreibe, womit Du nicht klar kommst.