Pages: [1]   Go Down
Author Topic: Serial monitor displaying junk.  (Read 840 times)
0 Members and 1 Guest are viewing this topic.
Surat,GJ,India
Offline Offline
Newbie
*
Karma: 0
Posts: 35
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I have Arduino duemilanove and it's 4-5 month old,
i have problem with serial interfacing,

i uploaded simple serial code:

Code:
void setup(){
  Serial.begin(9600);
  pinMode(13,OUTPUT);
}
void loop(){
  Serial.println("abcdefghijklmnopqrstuvwxyz");
  digitalWrite(13,HIGH);
  delay(500);
  digitalWrite(13,LOW);
  delay(500);
}

led 13 is blinking but serial output is like "¸…®…ÅÄçGó".

so i tried another two atmega328 with Arduino boot-loader but same problem.
i also tried to uninstall drivers, restart pc, serial loopback test shorting 0 and 1, external serial monitor and everything is fine except serial monitor,
i also used putty but same output.

ps. i can still upload the sketch, pc baud rate 9600.

any ideas ???
« Last Edit: August 10, 2012, 03:09:15 pm by ashish-k » Logged

Rock it n loop it.

Southern California
Offline Offline
Full Member
***
Karma: 0
Posts: 108
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

By any chance is the serial monitor baudrate different than 9600?  They need to be the same.
Logged

Surat,GJ,India
Offline Offline
Newbie
*
Karma: 0
Posts: 35
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

thanks for your replay but i mentioned that
PC BAUD RATE IS 9600".
Logged

Rock it n loop it.

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 309
Posts: 26485
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Have you changed any of the processor clock speed settings?
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Surat,GJ,India
Offline Offline
Newbie
*
Karma: 0
Posts: 35
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

nothing modified, just tried sd shield and it was working fine, but when i modified the sd sketch to read file and print on the serial the problem starts, don't know why. smiley-neutral
Logged

Rock it n loop it.

Southern California
Offline Offline
Full Member
***
Karma: 0
Posts: 108
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
thanks for your replay but i mentioned that
PC BAUD RATE IS 9600".

I realize you said that, it's just that I got some of the same characters you mentioned in your first post when I set my serial monitor to 300 baud.  Hope you find a solution!   
Logged

SE USA
Offline Offline
Faraday Member
**
Karma: 41
Posts: 3783
@ssh0le
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

what does it do when you use a real serial terminal?
Logged


Surat,GJ,India
Offline Offline
Newbie
*
Karma: 0
Posts: 35
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

i also mentioned that i tried PUTTY and same output.
Logged

Rock it n loop it.

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 632
Posts: 50182
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
nothing modified, just tried sd shield and it was working fine, but when i modified the sd sketch to read file and print on the serial the problem starts, don't know why.
Well, right there - line 37 - that's where you went wrong.

If you were to actually post the code you are running, then perhaps one of us would be inclined to try to replicate your problem. Or spot it.
Logged

Surat,GJ,India
Offline Offline
Newbie
*
Karma: 0
Posts: 35
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

i just uploaded the example sketch, then i uploaded same code with different file names like test1.txt, user.txt, password.txt
and the last one was not working and hear's the code
Code:
#include <SD.h>

File myFile;

void setup()
{
  Serial.begin(9600);
  Serial.print("Initializing SD card...");
  // On the Ethernet Shield, CS is pin 4. It's set as an output by default.
  // Note that even if it's not used as the CS pin, the hardware SS pin
  // (10 on most Arduino boards, 53 on the Mega) must be left as an output
  // or the SD library functions will not work.
   pinMode(10, OUTPUT);
  
  if (!SD.begin(10)){
    Serial.println("initialization failed!");
    return;
  }
  Serial.println("initialization done.");
  // open the file. note that only one file can be open at a time,
  // so you have to close this one before opening another.
  myFile = SD.open("password.txt", FILE_WRITE);
  // if the file opened okay, write to it:
  if (myFile) {
    Serial.print("Writing to password.txt...");
    myFile.println("testing 1, 2, 3.");
// close the file:
    myFile.close();
    Serial.println("done.");
  } else {
    // if the file didn't open, print an error:
    Serial.println("error opening password.txt");
  }
}

void loop()
{
  myFile = SD.open("password.txt");
  if (myFile) {
    Serial.println("password.txt:");
    
    // read from the file until there's nothing else in it:
    while (myFile.available()) {
     Serial.write(myFile.read());
    }
    // close the file:
    myFile.close();
  } else {
   // if the file didn't open, print an error:
    Serial.println("error opening password.txt");
  }
delay(1000);
}

so basically the last code didn't worked so i uploaded the serial test that i mentioned at the beginning.

thank you.
« Last Edit: August 11, 2012, 11:53:15 am by ashish-k » Logged

Rock it n loop it.

Pages: [1]   Go Up
Jump to: