Quantcast
Channel: Intel Communities: Message List
Viewing all articles
Browse latest Browse all 20984

Intel galileo Serial1.read problem......

$
0
0

Sir i am trying to communicate intel galileo with AVR atmega8 microcontroller..........The ATmega8 sends all bytes properly to MY PC (i am using Serial Terminal) at 9600 baud rate 1stop bit and no parity..............

but i am not able to receive the exact msg send via atmega8  serially....this is my intel galileo code

 

///---------------------------------------------------------------///

int led = 13;

char buffer[30];

char ch = '0';

 

 

void setup()

{

        pinMode(13,OUTPUT);

        digitalWrite(led,LOW);

 

         Serial.begin(9600);

        Serial1.begin(9600);

        delay(5000);

      

Serial.write("I am waiting press '* y'");         

   while(true)                    ////         the galileo receives code only if its sent  " * y " via serial terminal and atmega transmitts only if it receives '*'

  {

 

  if(Serial.available())

       {

  ch = Serial.read();

  if(ch=='y')break;

         else

                {

                            Serial.write(ch);

                            delay(10);

                             Serial1.write(ch);          //send '*' to atmega 8 to make atmega 8 Trasnmit bytes 

                  }

 

            }

 

  }

          

       

  int i=0,length = 0;

  while(true)                   

  {

 

  if(Serial1.available())

  {

  ch = Serial1.read();

 

  if(ch=='*')break;

  buffer[i] = ch;

  ++i;

  ++length;

                        Serial.write(ch);               // here at serial terminal i am getting some unknown characters..........................

                       

                        Serial.println(ch);

                   

  }

 

  }

  digitalWrite(led,HIGH);

  delay(1000);

  Serial.write("The Received bytes of data are ");

  Serial.println(" ");

  for(i=0;i<length;i++)

  {

  Serial.print(buffer[i]);

  }

 

  delay(5000);

 

 

  /* add setup code here */

 

 

}

 

 

void loop()

{

digitalWrite(led,LOW);

delay(1000);

digitalWrite(led,HIGH);

delay(1000);

 

}

The data sent by atmega 8 is " * Hello World * " with 1s delay in transmitting bytes .........

I am getting some unknown characters at serial terminal.............please help me out


Viewing all articles
Browse latest Browse all 20984

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>