user22930: I connected a GSM module with the Arduino UNO. The connections are as follows:

Gnd of gsm -----> Gnd of arduino
TX of gsm  -----> pin 9 of arduino
Rx of gsm  -----> pin 10 of arduino

GSM is powered from a 9V-1Amp wall adapter.
The GSM is performing according to all the AT commands (like making a voice call, hanging a call, answering a call) which are given, but it is displaying garbage values on serial monitor in response. 
Here is the code:
#include <SoftwareSerial.h>
SoftwareSerial myserial(9, 10);

void setup() {
    Serial.begin(115200);
    myserial.begin(9600);
    myserial.println("ATDXXXXXXXXXX;");
    delay(30000);
    myserial.println("ATH");
}

void loop() {
    if (myserial.available()>0){
        Serial.println(myserial.read());
    }
}

What could be reasons for the GSM to output garbage values and how can I resolve it?

user4143:     Serial.println(myserial.read());

myserial.read() returns an integer. That integer is either the ASCII code of the next character in the buffer, or -1 if there is no character to read.
You then print that integer, each one on its own line.
So the response "OK\r\n" from, say, "AT\r\n" would look like:
79
75
13
10

Instead you need to write the data, not print it:
Serial.write(myserial.read());

Also, the way you have written your code, you will get no response for 30 seconds - that is, until everything has already happened. Only after it has all finished will you get some feedback - and that may not be complete since you may overrun the buffer depending on what the modem sends.

22930: <p>I connected a GSM module with the Arduino UNO. The connections are as follows:</p>

<blockquote>
  <p>Gnd of gsm -----> Gnd of arduino</p>
  
  <p>TX of gsm  -----> pin 9 of arduino</p>
  
  <p>Rx of gsm  -----> pin 10 of arduino</p>
</blockquote>

<p>GSM is powered from a 9V-1Amp wall adapter.</p>

<p>The GSM is performing according to all the <code>AT</code> commands (like making a voice call, hanging a call, answering a call) which are given, but it is displaying garbage values on serial monitor in response. </p>

<p>Here is the code:</p>

<pre><code>#include &lt;SoftwareSerial.h&gt;
SoftwareSerial myserial(9, 10);

void setup() {
    Serial.begin(115200);
    myserial.begin(9600);
    myserial.println("ATDXXXXXXXXXX;");
    delay(30000);
    myserial.println("ATH");
}

void loop() {
    if (myserial.available()&gt;0){
        Serial.println(myserial.read());
    }
}
</code></pre>

<p>What could be reasons for the GSM to output garbage values and how can I resolve it?</p>
 4143: <pre><code>    Serial.println(myserial.read());
</code></pre>

<p><code>myserial.read()</code> returns an integer. That integer is either the ASCII code of the next character in the buffer, or -1 if there is no character to read.</p>

<p>You then print that integer, each one on its own line.</p>

<p>So the response "OK\r\n" from, say, "AT\r\n" would look like:</p>

<pre><code>79
75
13
10
</code></pre>

<p>Instead you need to <code>write</code> the data, not <code>print</code> it:</p>

<pre><code>Serial.write(myserial.read());
</code></pre>

<p>Also, the way you have written your code, you will get no response for 30 seconds - that is, until everything has already happened. Only after it has all finished will you get some feedback - and that may not be complete since you may overrun the buffer depending on what the modem sends.</p>
