473,387 Members | 1,504 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

communication with RS232

Hello

I would like to activate a communication with RS232 port via c sharp, the code is :

Expand|Select|Wrap|Line Numbers
  1.  SerialPort sp = new SerialPort("COM1", 9600, Parity.None, 8, StopBits.One); 
  2.  try
  3.                     {
  4.                         sp.Open();
  5.                         if (serialPort1.IsOpen)
  6.                         {
  7.                             sp.Write("0");
  8.  
  9.                         }
  10.                         sp.Close();
  11.  
  12.                     }
  13.                     catch (System.Exception)
  14.                     {
  15.                         MessageBox.Show("error");
  16.                     }
  17.  
  18.  
  19.                 }

I want to test by hyper terminal, but it don't display nothing.
there is something else to do (a file to download, a manipulation..)

thank you
Jun 10 '11 #1
3 2448
Plater
7,872 Expert 4TB
What is your issue here ?
Jun 10 '11 #2
alexis4
113 100+
I want to test by hyper terminal, but it don't display nothing.
there is something else to do (a file to download, a manipulation..)
To test your code to hyperterminal, you must first make sure about a few things:

1) Your serial card drivers are installed.

2) Your serial cable is OK. Open hyperterminal, then choose port (let's say port3). This port3 will communicate with your application's port1. One edge of the cable goes to port3, the other edge goes to your hand. The pins of the connector are numbered. Short pins 2&3 (so you short Rx&Tx pins), I do this with a simple flat screwdriver. If you type a character in hyperterminal and you see it printed on the screen, then the cable communicates OK. Then do the same thing for port1, just to be sure that you are accessing the right ports. Apart from that, you need the cable to be a cross cable, meaning that you unplug the cable from the pc and you check that pin2 from one side of connector is shorted with pin3 on the other side. You can check this with a ohmmeter. When you are sure of all those, plug one edge on port1, the other on port3. Now you have port1 and 3, ready to communicate with each other.

3) All hyperterminal settings must match your application settings (same baudrate, stopbits, etc).

Hope that helped
Jun 10 '11 #3
What is your system (XP , Win7 , vista .....)?
Jun 11 '11 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: nchap99 | last post by:
hello, Does anybody know if Microsoft Dot Net supports the RS232 type of connection. As far as I know Visual basic 6 supports RS232 connection format. Thanks,
6
by: Przemo | last post by:
Hi, Do you know some good RS232C class? There is one in VB.NET 101 Examples, but I think it is poor. 1. I can't for e.g. read into my application all data received. I must tell how many...
2
by: AlirezaH | last post by:
Any sample program for rs232 communication?
3
by: Ramakant Kasar | last post by:
Hi, If an application is reading data from a serial port, How can I open the same serial port with another application? Any idea? Please help. Thanks, Ramakant K.
0
by: Hendra | last post by:
Hi All I need some help here, I'm now trying to communicate my Data Acquisition hardware with my PC and planning to use either VB.Net or VB ver 6.0, the problem is I dont have the appropriate...
2
by: Chuck | last post by:
I am using the Microsoft Communication Control in my solution for RS232/RS485 serial communication. I have been working on this solution for the past six months without incident. Today when I ran...
2
by: KCUK | last post by:
I have created a software to receive data from an equipment through RS232 communication. It is a simple application of the RS232 class. The software does receive strings from the equipment every time...
0
by: kvu95111 | last post by:
Hi All, I have wrote a simple program using RS232 protocol. However, I have the following problem in hand. I used the software to receive data from a RFID reader (you may simply treat it like a...
0
by: nmsreddi | last post by:
hello any one using c#2005 express edition i want to know how to use the system.io.ports namespace for serial communication ,for interacting with the hard ware connected to my pc through rs232...
0
by: soniyaperuma | last post by:
hi, i am doing project on communication protocols ,i want a code in vb for pc to pc communication using rs232,if any one know please send it to me including form for the code thank you.
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.