<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>'How to read messages from an RS 232?' Thread RSS Feed</title>
    <link>http://www.programmersheaven.com/</link>
    <description>Contains the latest posts from the thread 'How to read messages from an RS 232?' posted on the 'C#' forum at Programmer's Heaven.</description>
    <language>en</language>
    <copyright>Copyright 2008 Programmers Heaven</copyright>
    <pubDate>Mon, 01 Dec 2008 21:20:16 -0700</pubDate>
    <lastBuildDate>Mon, 01 Dec 2008 21:20:16 -0700</lastBuildDate>
    <generator>Argotic Syndication Framework 2007.3.0.1, http://www.codeplex.com/Argotic</generator>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <ttl>360</ttl>
    <image>
      <url>http://www.programmersheaven.com/images/ph.gif</url>
      <title>Programmers Heaven</title>
      <link>http://www.programmersheaven.com/</link>
      <width>88</width>
      <height>31</height>
    </image>
    <item>
      <title>How to read messages from an RS 232?</title>
      <link>http://www.programmersheaven.com/mb/csharp/373154/373154/how-to-read-messages-from-an-rs-232/</link>
      <description>Hi,&lt;br /&gt;
&lt;br /&gt;
I am writing a program that will connect to a modem via an RS232 port, and send commands, like for example to start a call.&lt;br /&gt;
&lt;br /&gt;
Also I will need to read the feedback given from the modem, and by the code I have below, nothing is happening.&lt;br /&gt;
&lt;br /&gt;
Can someone please help?&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="sourcecode"&gt;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO.Ports;


namespace IREG_Tester_V2
{
    class Program
    {
        static SerialPort port1 = new SerialPort();
        static bool _continue = false; 

        static void Main(string[] args)
        {
            //Create Seriel Port Settings
                        
            port1.PortName = "COM3";
            port1.BaudRate = 9600;
            port1.Parity = Parity.None;
            port1.DataBits = 8;
            port1.StopBits = StopBits.One;



            // Open the port for communications 
            port1.Open();

            //Start Call
            Console.WriteLine("Enter Number to Dial and press Enter");
            string ip = Convert.ToString(Console.ReadLine());
            port1.WriteLine("ATD" + ip + ";");
            Console.WriteLine(DateTime.Now.ToLongTimeString())
;


            //Console.ReadLine();

            int pauseTime = 9000;
            System.Threading.Thread.Sleep(pauseTime);
            // During the 9 seconds pause, answer the call, and 
            // a messege OK should be received



            //Disconnect Call
            port1.WriteLine("ATH");
            Console.WriteLine(DateTime.Now.ToLongTimeString())
;
            Console.WriteLine("Call Disconnected!");

            
            Console.WriteLine("Press enter to Exit!");
            Console.ReadLine();

            // Close the port 
            port1.Close();
        }


             public void SerialPortProgram() 
             { 
                 Console.WriteLine("Incoming Data:"); 
                 
                 // Attach a method to be called when there is data waiting in the port's buffer 
                 port1.DataReceived += new SerialDataReceivedEventHandler(port_DataReceived); 
             } 
        
            private void port_DataReceived(object sender,SerialDataReceivedEventArgs e) 
            { 
            // Show all the incoming data in the port's buffer 
                Console.WriteLine(port1.ReadExisting()); 
            }

    }
}
&lt;/pre&gt;</description>
      <pubDate>Sat, 05 Jul 2008 02:39:44 -0700</pubDate>
      <category>C#</category>
    </item>
  </channel>
</rss>