Buchstabe auf "doppel-" Rainbowduino schreiben

Fehlermeldung: Upload abgeschlossen
avrdude: stk500_getsync(): not in sync: resp=0x00

BS: Windows 7 32bit

IDE: Arduino 1.0.1

Sketch:

#include "Rainbow.h"

//=============================================================
extern unsigned char dots_color[2][3][8][4];  //define Two Buffs (one for Display ,the other for receive data)
extern unsigned char GamaTab[16];             //define the Gamma value for correct the different LED matrix
//=============================================================
unsigned char line=0,level=0;  
unsigned char Buffprt = 0;
unsigned char State = 0;
unsigned char color=0,row=0,dots=0,position=0;
unsigned long timeout;
unsigned char StartTransfer = 0;

/*
This is a hacky implementation of a RainbowDuino serial interface. You need to upload the serial sketch to the RainbowDuino device.
You cannot use multiple devices with this sketch.

If you see garbled characters, reset the RainbowDuino. 

This implementation removes the inital handshake required (and advised) for I2C. This varient just sends data down the line hoping the Rainbowduino is in an appropriate state to 
output to screen.
*/

void setup()
{
  _init();

  for(int i=0;i<8;i++)
  {
    flash_next_line(i,1);
    delay(100);
  }

  Serial.begin(115200); // join i2c bus (address optional for master) 
  Serial.println("Hello");
  // Serial.onReceive(receiveEvent); // define the receive function for receiving data from master
  //  Serial.onRequest(requestEvent); // define the request function for the request from maseter 
  init_timer2();  // initial the timer for scanning the LED matrix
  StartTransfer=0;
  color=0;
  row=0;
  dots=0;
  position=0;
}
void loop()
{
  if(Serial.available()>0)  // Switch the Display Buff and Receive Buff until receive one buff data
  {
    SwitchBuff();   //receiving data
  }   
}

ISR(TIMER2_OVF_vect)          //Timer2  Service 
{ 
  TCNT2 = GamaTab[level];    // Reset a  scanning time by gamma value table
  flash_next_line(line,level);  // sacan the next line in LED matrix level by level.
  line++;
  if(line>7)        // when have scaned all LEC the back to line 0 and add the level
  {
    line=0;
    level++;
    if(level>14)       level=0;
  }
}

void init_timer2(void)               
{
  TCCR2A |= (1 << WGM21) | (1 << WGM20);   
  TCCR2B |= (1<<CS22);   // by clk/64
  TCCR2B &= ~((1<<CS21) | (1<<CS20));   // by clk/64
  TCCR2B &= ~((1<<WGM21) | (1<<WGM20));   // Use normal mode
  ASSR |= (0<<AS2);       // Use internal clock - external clock not used in Arduino
  TIMSK2 |= (1<<TOIE2) | (0<<OCIE2B);   //Timer2 Overflow Interrupt Enable
  TCNT2 = GamaTab[0];
  sei();   
}

void _init(void)    // define the pin mode
{
  DDRD=0xff;
  DDRC=0xff;
  DDRB=0xff;
  PORTD=0;
  PORTB=0;

}


//=============================================================


/* /==============================================================
 void receiveEvent(int howMany)
 {
 if (StartTransfer==1)  // if a new transfer starts , then reset the buff position
 {
 StartTransfer=0;
 color=0;
 row=0;
 dots=0;
 position=0;
 }
 
 }
 
 void requestEvent(void)
 {
 StartTransfer =1;  // master start a new data transfer
 Serial.send(2);
 }
 //==============================================================
 
 
 *///==============================================================
void shift_1_bit(unsigned char LS)  //shift 1 bit of  1 Byte color data into Shift register by clock
{
  if(LS)
  {
    shift_data_1;
  }
  else
  {
    shift_data_0;
  }
  clk_rising;
}
//==============================================================
void flash_next_line(unsigned char line,unsigned char level) // scan one line
{
  disable_oe;
  close_all_line;
  open_line(line);
  shift_24_bit(line,level);
  enable_oe;
}

//==============================================================
void shift_24_bit(unsigned char line,unsigned char level)   // display one line by the color level in buff
{
  unsigned char color=0,row=0;
  unsigned char data0=0,data1=0;
  le_high;
  for(color=0;color<3;color++)//GBR
  {
    for(row=0;row<4;row++)
    {
      data1=dots_color[Buffprt][color][line][row]&0x0f;
      data0=dots_color[Buffprt][color][line][row]>>4;

      if(data0>level)   //gray scale,0x0f aways light
      {
        shift_1_bit(1);
      }
      else
      {
        shift_1_bit(0);
      }

      if(data1>level)
      {
        shift_1_bit(1);
      }
      else
      {
        shift_1_bit(0);
      }
    }
  }
  le_low;
}



//==============================================================
void open_line(unsigned char line)     // open the scaning line 
{
  switch(line)
  {
  case 0:
    {
      open_line0;
      break;
    }
  case 1:
    {
      open_line1;
      break;
    }
  case 2:
    {
      open_line2;
      break;
    }
  case 3:
    {
      open_line3;
      break;
    }
  case 4:
    {
      open_line4;
      break;
    }
  case 5:
    {
      open_line5;
      break;
    }
  case 6:
    {
      open_line6;
      break;
    }
  case 7:
    {
      open_line7;
      break;
    }
  }
}



//==============================================================
void SwitchBuff(void)
{
  dots_color[((Buffprt+1)&1)][color][row][dots]=Serial.read();
  dots++;
  position++;
  if(dots>3)
  { 
    dots=0;
    row++;
    if(row>7)
    {  
      row=0;
      color++;
      if(color>2)
      {  
        color=0; 
        if (position==0x60)  
        { 
          Buffprt++;
          Buffprt&=1;   // switch buff
          position=0;
        }
      }
    }
  }
}

TX->TX RX->RX

und warum nicht Tx -> Rx ? Was der eine sendet, soll der andere empfangen ...

OK, habs gekreutzt, TX->RX RX->TX, DTA->Reset, 5V->VCC, GND->GND aber keine änderung...?
Es kommt immer noch: Upload abgeschlossen
Binäre Sketchgröße: 2.982 Bytes (von einem Maximum von 30.720 Bytes)
avrdude: stk500_getsync(): not in sync: resp=0x00

Gibt's doch nicht, keiner eine IDEE?

Entschuldige; da habe ich nicht genau genug durchgelesen.

  1. Der Rainbowduino kann NICHT an TX und RX vom Arduino MEGA angeschlossen werden da diese Schnittstelle für das Upload des Sketches vom PC zum MEGA verwendet wird. Du mußt RX1 und TX1 bzw RX2 und TX2 verwenden. Du brauchst keine Resetleitung.

  2. Du mußt RX1 des MEGA mit TX des Rainbowduino und TX1 mit RX verbinden außerdem GND mit GND. Die Rainbowduinos mußt Du extern mit 5V versorgen (die USB-Schnittstelle wird nicht genug Strom für beide Rainbowduinos mit LED-Matrix liefern).

Wo hast Du den Sketch her?

Grüße Uwe

Der Sketch ist von Seeedstudios

Unter Board stelle ich ATMega 328 ein.
Und unter Programmer?

Hufy1990:
Der Sketch ist von Seeedstudios

Bitte Quelle
Ist der Sketch für den Arduino MEGA?

Weiß nicht welcher Link das war.

Nein, der war für den Arduino Uno

Doch nicht von Seeedstudios sondern von hier: MilesBurton.com

Gibt es für Mega einen anderen?

Warum kein Reset?

Der Code...

#include <Rainbowduino.h>

void setup()
{
  Rb.init();
}

unsigned char x,y,z;

void loop()
{

  for(int i= 0x20; i<=0x7E; i++) //generates ASCII value of all printable characters
  {
     Rb.drawChar(i,0,1,random(0xFFFFFF)); 
     delay(500);
     Rb.blankDisplay();
  }
  
}

...geht auch nicht.

Ich bin ratlos, weiß denn niemand weiter?

Das kann doch nicht sein, dass das mit dem Mega nicht geht!?

Keiner eine Idee?
Kann ich die dinger mal jemanden schicken der sich daran probiert?
Vlt liegts ja garnicht an mir :wink:

Hufy1990:
Habe das Rainbowduino an einen USB TTL Adapter TX->TX RX->RX ... angeschlosse,
wollte eine Firmware aufspielen aber es geht nix.

RX --> TX, TX --> RX die müssen über Kreuz verschaltet werden

... mehr kann ich nicht dazu beitragen, da ich mich auch erst in die Materie einarbeite :slight_smile:

Gruß Gerald

Es ist ja schon eine Standartfirmware drauf (fleuchtet und funkelt ja)
Aber ich bekomme kein Buchstabe drauf.

Spiele mein Sketch (siehe unten) auf mein Arduino Mega 2560, stecken dann das Rainbowduino (egal ob TX->Rx oder Tx->Tx) an, resette aber es geschieht (außer das funkeln) einfach nichts.

Habe Strom an 5v und GND angeschlossen, Reset an DTR und TX-> TX und RX->RX (oder andersrum)

Das kann doch nicht sein!
Vlt. geht es mit dem Arduino Mega einfach nicht?

extern unsigned char dots_color[3][8][4];
extern unsigned char ASCII_Number[10][8];
extern unsigned char ASCIII_Char[52][8];

unsigned char State = 2;
unsigned char color=0,row=0,dots=0,position=0;
unsigned char line=0,level=0;
unsigned long timeout;
unsigned char Col_Red,Col_Blue,Col_Green;

void setup()
{
  Serial.begin(115200); //Setup high speed Serial
   
}

void loop()
{
  SetRGB(0x0F,0x00,0x00); // Set Colour
  SentChar(10,'T');
  delay(500);
}
//-------------------------------------------------------------
//Name:SendData
//Function: Master sent one buff data to RainbowDuino or sent the color data to RainbowDuino
//Parameter:  ADD: RainbowDuino IIC Address
//            Auto:if Auto = 1 sent the data in buff ; if Auto = 0 then sent the RGB data 
//            Red Green Blue: when Auto = 0 ,sent these color data to RainbowDuino
//-------------------------------------------------------------
void SendData(int ADD,int Auto,int Red,int Green,int Blue)
{  
  int OK=0;
  int tempcol;
  while(!OK)
  { 
    switch(State)
    {  
    case 2:
      for (color=0;color<3;color++)
      {     
        if (color==0)
        { 
          tempcol=Green;
          tempcol|=(Green<<4);
        }
        else if(color==1)
        {
          tempcol=Red;
          tempcol|=(Red<<4);
        }
        else if(color==2)
        {
          tempcol=Blue;
          tempcol|=(Blue<<4);
        }

        //// Serial.beginTransmission(ADD); 
        for (row=0;row<8;row++)
        {

          for (dots=0;dots<4;dots++)
          {
            // if (Auto)
            Serial.write(dots_color[color][row][dots]);
            //  else
            //     Serial.write(tempcol);
          }

        }
        // //Serial.endTransmission();    // stop transmitting
        delay(5);  
      }
      OK=1;
      State=2;    
      break;

    default:
      State=2;
      break;
    }
  }

}

//-------------------------------------------------------------
//Name:SendShiftData
//Function: Master sent shift the  buff and sent the data to RainbowDuino  
//Parameter:  ADD: RainbowDuino IIC Address
//            shift: set up how much bit  the buff data will shift left            
//-------------------------------------------------------------
void SendShiftData(int ADD,int shift)
{  
  int OK=0;
  int temp,val;
  while(!OK)
  { 
    switch(State)
    {  
    case 2:
      for (color=0;color<3;color++)
      {   
        // Serial.beginTransmission(ADD);    
        for (row=0;row<8;row++)
        {

          for (dots=0;dots<4;dots++)
          {                                     
            if (shift&0x01)
            {
              temp = dots + (shift>>1);
              val = ((dots_color[color][row][(temp<4)?(temp):(temp-4)]<<4)|(dots_color[color][row][(temp<3)?(temp):(temp-3)]>>4));  
              Serial.write(val); 
            }        
            else
            {
              temp = dots + (shift>>1);
              val = dots_color[color][row][(temp<4)?(temp):(temp-4)];  
              Serial.write(val);  
            }                         
          }   
        }
        //Serial.endTransmission();    // stop transmitting
        delay(5);
      }
      OK=1;
      State=2;    
      break;

    default:
      State=2;
      break;
    }
  }

}


//-------------------------------------------------------------
//Name:FillBuff
//Function: Fill the master's buff with color data  
//Parameter: Re, Gr, Bl  : RGB color level data        
//-------------------------------------------------------------
void FillBuff(int Re,int Gr,int Bl)
{   
  for(color=0;color<3;color++)
  {
    for (row=0;row<8;row++)
    {
      for (dots=0;dots<4;dots++)
      {
        switch (color)
        {
        case 0://green
          dots_color[color][row][dots]=( Gr|(Gr<<4));
          break;

        case 1://blue
          dots_color[color][row][dots]= (Bl|(Bl<<4));
          break;

        case 2://red
          dots_color[color][row][dots]= (Re|(Re<<4));
          break;

        default:
          break;
        }
      }
    }
  }
}
//-------------------------------------------------------------
//Name:SetLine
//Function:  change one line data of  the master's buff   
//Parameter: Re, Gr, Bl  : RGB line color  data    
//           levl: the RGB level 
//           lines: line position
//-------------------------------------------------------------
void SetLine(int levl,int lines,int Red,int Green,int Blue)
{ 
  int  shift; 
  for (color=0;color<3;color++)
  {
    if (color==0)
      shift=Green;
    else if (color==1)
      shift=Blue;
    else if (color==2)
      shift=Red;
    for (dots=0;dots<4;dots++)
    {
      dots_color[color][line][dots]=0;
      if(dots!=0)  shift=shift<<1;
      if (shift&0x80)
        dots_color[color][line][dots]|=(level<<4);
      else
        dots_color[color][line][dots]&=0x0F;


      shift=shift<<1;         
      if (shift&0x80)
        dots_color[color][line][dots]|=level;
      else
        dots_color[color][line][dots]&=0xF0; 

    }
  }

}




//-------------------------------------------------------------
//Name:FillLine
//Function:  Fill one line data of  the master's buff   
//Parameter: Re, Gr, Bl  : RGB color level data    
//           Lines : the line position
//-------------------------------------------------------------
void FillLine(int Lines,int Red,int Green,int Blue)
{ 
  int  shift; 
  for (color=0;color<3;color++)
  {
    if (color==0)
      shift=Green;
    else if (color==1)
      shift=Blue;
    else if (color==2)
      shift=Red;
    for (dots=0;dots<4;dots++)
    {
      dots_color[color][Lines][dots]=0;

      shift|=shift<<4;
      dots_color[color][Lines][dots]=shift;
    }
  }

}



//-------------------------------------------------------------
//Name:SetDots
//Function:  change one dot data of  the master's buff   
//Parameter: Row_X, Line_Yint: the dot position
//           Re, Gr, Bl  : RGB color level data    
//-------------------------------------------------------------
void SetDots(int Row_X,int Line_Y,int Red,int Green,int Blue)
{
  dots_color[0][Line_Y][Row_X/2]&=(Row_X&1)?(0xf0):(0x0f);
  dots_color[0][Line_Y][Row_X/2]|=(Row_X&1)?(Green):(Green<<4);
  dots_color[1][Line_Y][Row_X/2]&=(Row_X&1)?(0xf0):(0x0f);
  dots_color[1][Line_Y][Row_X/2]|=(Row_X&1)?(Blue):(Blue<<4);
  dots_color[2][Line_Y][Row_X/2]&=(Row_X&1)?(0xf0):(0x0f);
  dots_color[2][Line_Y][Row_X/2]|=(Row_X&1)?(Red):(Red<<4);     
}






//-------------------------------------------------------------
//Name:SetRGB
//Function:  Set the  Global color Variables  
//Parameter:  Re, Gr, Bl  : RGB color level data            
//-------------------------------------------------------------
void SetRGB(int Red,int Green,int Blue)
{
  Col_Red=Red;
  Col_Blue=Blue;
  Col_Green=Green;   
}




//-------------------------------------------------------------
//Name:SentNum
//Function: Sent a Numeber to RainbowDuino to show  
//Parameter:   ADD: RainbowDuino IIC Address
//             Num: the Num want to show
//Other: the Number character color definet by the Global color Variables which set up by SetRGB() function
//-------------------------------------------------------------
void SentNum(int ADD,int Num)
{  
  int OK=0;
  int tempword,tempdata,tempcol;
  while(!OK)
  { 
    switch(State)
    {  
    case 2:
      for (color=0;color<3;color++)
      {     
        if(color==0)        tempcol=Col_Green;
        else if(color==1)   tempcol=Col_Red;
        else if(color==2)   tempcol=Col_Blue;

        // Serial.beginTransmission(ADD); 
        for (row=0;row<8;row++)
        {

          for (dots=0;dots<4;dots++)
          {

            tempword = ASCII_Number[Num][row];
            if((tempword<<2*dots)&0x80)
            {
              tempdata&=0x0F;
              tempdata|=(tempcol<<4);
            }
            else
            {
              tempdata&=0x0F;
            }

            if((tempword<<(2*dots+1))&0x80)
            {
              tempdata&=0xF0;
              tempdata|=tempcol;
            }
            else
            {
              tempdata&=0xF0;
            }           
            Serial.write(tempdata); 

          }

        }
        //Serial.endTransmission();    // stop transmitting
        delay(5);  
      }
      OK=1;
      State=2;    
      break;

    default:
      State=2;
      break;
    }
  }
}
//-------------------------------------------------------------
//Name:SentChar
//Function: Sent a  English Latter character to RainbowDuino to show  
//Parameter:   ADD: RainbowDuino IIC Address
//             Chr: the Latter want to show
//Other: the Latter character color definet by the Global color Variables which set up by SetRGB() function
//-------------------------------------------------------------
void SentChar(int ADD,int Chr)
{  
  int OK=0;
  int tempword,tempdata,tempcol;
  while(!OK)
  { 
    switch(State)
    {  
    case 2:
      for (color=0;color<3;color++)
      {     
        if(color==0)        tempcol=Col_Green;
        else if(color==1)   tempcol=Col_Red;
        else if(color==2)   tempcol=Col_Blue;

        // Serial.beginTransmission(ADD); 
        for (row=0;row<8;row++)
        {

          for (dots=0;dots<4;dots++)
          {
            if ((Chr>64)&&(Chr<91))
            {
              Chr-=65;
            }
            else if((Chr>96)&&(Chr<123))
            {
              Chr-=71;
            }


            tempword = ASCIII_Char[Chr][row];
            if((tempword<<2*dots)&0x80)
            {
              tempdata&=0x0F;
              tempdata|=(tempcol<<4);
            }
            else
            {
              tempdata&=0x0F;
            }

            if((tempword<<(2*dots+1))&0x80)
            {
              tempdata&=0xF0;
              tempdata|=tempcol;
            }
            else
            {
              tempdata&=0xF0;
            }           
            Serial.write(tempdata); 

          }

        }
        //Serial.endTransmission();    // stop transmitting
        delay(5);  
      }
      OK=1;
      State=2;    
      break;

    default:
      State=2;
      break;
    }
  }
}
//-------------------------------------------------------------
//Name:Shift_Num_Right
//Function: Sent a Numeber with shift to RainbowDuino to show  
//Parameter:   ADD: RainbowDuino IIC Address
//             Num: the Num want to show
//             Shift: Shift right bits(0-8)
//Other: the Number character color definet by the Global color Variables which set up by SetRGB() function
//-------------------------------------------------------------
void Shift_Num_Right(int ADD,int Num,int Shift)
{  
  int OK=0;
  int tempword,tempdata,tempcol;
  while(!OK)
  { 
    switch(State)
    {  
    case 2:
      for (color=0;color<3;color++)
      {     
        if(color==0)        tempcol=Col_Green;
        else if(color==1)   tempcol=Col_Red;
        else if(color==2)   tempcol=Col_Blue;

        // Serial.beginTransmission(ADD); 
        for (row=0;row<8;row++)
        {

          for (dots=0;dots<4;dots++)
          {

            tempword = ASCII_Number[Num][row];


            if((tempword<<(2*dots+Shift))&0x80)
            {
              tempdata&=0x0F;
              tempdata|=(tempcol<<4);
            }
            else
            {
              tempdata&=0x0F;
            }

            if((tempword<<(2*dots+1+Shift))&0x80)
            {
              tempdata&=0xF0;
              tempdata|=tempcol;
            }
            else
            {
              tempdata&=0xF0;
            }           
            Serial.write(tempdata); 

          }

        }
        //Serial.endTransmission();    // stop transmitting
        delay(5);  
      }
      OK=1;
      State=2;    
      break;

    default:
      State=2;
      break;
    }
  }
}

//-------------------------------------------------------------
//Name:Shift_Num_Left
//Function: Sent a Numeber with shift to RainbowDuino to show  
//Parameter:   ADD: RainbowDuino IIC Address
//             Num: the Num want to show
//             Shift: Shift left bits (0-8)
//Other: the Number character color definet by the Global color Variables which set up by SetRGB() function
//-------------------------------------------------------------
void Shift_Num_Left(int ADD,int Num,int Shift)
{  
  int OK=0;
  int tempword,tempdata,tempcol;
  while(!OK)
  { 
    switch(State)
    {     
    case 2:
      for (color=0;color<3;color++)
      {     
        if(color==0)        tempcol=Col_Green;
        else if(color==1)   tempcol=Col_Red;
        else if(color==2)   tempcol=Col_Blue;

        // Serial.beginTransmission(ADD); 
        for (row=0;row<8;row++)
        {

          for (dots=0;dots<4;dots++)
          {

            tempword = ASCII_Number[Num][row];

            tempword=tempword>>Shift;
            if((tempword<<(2*dots))&0x80)
            {
              tempdata&=0x0F;
              tempdata|=(tempcol<<4);
            }
            else
            {
              tempdata&=0x0F;
            }

            if((tempword<<(2*dots+1))&0x80)
            {
              tempdata&=0xF0;
              tempdata|=tempcol;
            }
            else
            {
              tempdata&=0xF0;
            }           
            Serial.write(tempdata); 

          }

        }
        //Serial.endTransmission();    // stop transmitting
        delay(5);  
      }
      OK=1;
      State=2;    
      break;

    default:
      State=2;
      break;
    }
  }
}






//-------------------------------------------------------------
//Name: Shift_Char_Right
//Function: Sent a Latter character with shift to RainbowDuino to show  
//Parameter:   ADD: RainbowDuino IIC Address
//             Chr: the Latter want to show
//             Shift: Shift right bits (0-8)
//Other: the Latter character color definet by the Global color Variables which set up by SetRGB() function
//-------------------------------------------------------------
void Shift_Char_Right(int ADD,int Chr,int Shift,int BG)
{  
  int OK=0;
  int tempword,tempdata,tempcol;
  while(!OK)
  { 
    switch(State)
    {  
    case 2:
      for (color=0;color<3;color++)
      {     
        if(color==0)        tempcol=Col_Green;
        else if(color==1)   tempcol=Col_Red;
        else if(color==2)   tempcol=Col_Blue;

        // Serial.beginTransmission(ADD); 
        for (row=0;row<8;row++)
        {

          for (dots=0;dots<4;dots++)
          {
            if ((Chr>64)&&(Chr<91))
            {
              Chr-=65;
            }
            else if((Chr>96)&&(Chr<123))
            {
              Chr-=71;
            }
            tempword = ASCIII_Char[Chr][row];


            if((tempword<<(2*dots+Shift))&0x80)
            {
              tempdata&=0x0F;
              tempdata|=(tempcol<<4);
            }
            else
            {
              tempdata&=0x0F;
              if(BG)  tempdata|=(dots_color[color][row][dots]&0xf0);

            }

            if((tempword<<(2*dots+1+Shift))&0x80)
            {
              tempdata&=0xF0;
              tempdata|=tempcol;
            }
            else
            {
              tempdata&=0xF0;
              if(BG)  tempdata|=(dots_color[color][row][dots]&0x0f);

            }           
            Serial.write(tempdata); 

          }

        }
        //Serial.endTransmission();    // stop transmitting
        delay(5);  
      }
      OK=1;
      State=2;    
      break;

    default:
      State=2;
      break;
    }
  }
}
//-------------------------------------------------------------
//Name: Shift_Char_Left
//Function: Sent a Latter character with shift to RainbowDuino to show  
//Parameter:   ADD: RainbowDuino IIC Address
//             Chr: the Latter want to show
//             Shift: Shift left bits (0-8)
//Other: the Latter character color definet by the Global color Variables which set up by SetRGB() function
//-------------------------------------------------------------
void Shift_Char_Left(int ADD,int Chr,int Shift,int BG)
{  
  int OK=0;
  int tempword,tempdata,tempcol;
  while(!OK)
  { 
    switch(State)
    {  
    case 2:
      for (color=0;color<3;color++)
      {     
        if(color==0)        tempcol=Col_Green;
        else if(color==1)   tempcol=Col_Red;
        else if(color==2)   tempcol=Col_Blue;

        //Serial.beginTransmission(ADD);
        for (row=0;row<8;row++)
        {

          for (dots=0;dots<4;dots++)
          {
            if ((Chr>64)&&(Chr<91))
            {
              Chr-=65;
            }
            else if((Chr>96)&&(Chr<123))
            {
              Chr-=71;
            }
            tempword = ASCIII_Char[Chr][row];                
            tempword=tempword>>Shift;

            if((tempword<<(2*dots))&0x80)
            {
              tempdata&=0x0F;
              tempdata|=(tempcol<<4);
            }
            else
            {
              tempdata&=0x0F;
              if(BG)  tempdata|=(dots_color[color][row][dots]&0xF0);

            }

            if((tempword<<(2*dots+1))&0x80)
            {
              tempdata&=0xF0;
              tempdata|=tempcol;
            }
            else
            {
              tempdata&=0xF0;
              if(BG)  tempdata|=(dots_color[color][row][dots]&0x0f);

            }           
            Serial.write(tempdata); 

          }

        }
        ////Serial.endTransmission();    // stop transmitting
        delay(5);  
      }
      OK=1;
      State=2;    
      break;

    default:
      State=2;
      break;
    }
  }
}