6 Replies - 617 Views - Last Post: 29 January 2013 - 01:02 AM Rate Topic: -----

#1 Priyanka KS  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 25-January 13

Data_Received event not firing using serialport connection in .Net

Posted 25 January 2013 - 02:25 AM

I have connected my pc to a null modem cable. When i look in device manager, i get two port names as USB-to-Serial(COM17) and COM28. But, when i try to send and receive data through ports, i am unable to do. Tried looking into various forums on this issue but not able to get the solution. I did use a query

"SELECT * FROM WIN32_SerialPort"
to get the list of all ports available on my pc, but it displayed only COM3 and COM4 nothing as COM17 and COM28. In one of the article, they said these are virtual ports and so doesn't get displayed.

Can anyone please help me send and receive data through a null modem cable using serial ports.

I have almost tried all examples given in all forums. Also, i have tried in hyperterminal to check if my comports work. It doesn't give any response. Someone, please help me to findout what is wrong?

Is This A Good Question/Topic? 0
  • +

Replies To: Data_Received event not firing using serialport connection in .Net

#2 Pademelon  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 6
  • Joined: 20-January 13

Re: Data_Received event not firing using serialport connection in .Net

Posted 25 January 2013 - 03:42 AM

Hello,

I've been playing with serial port stuff myself.
Quick google found this: http://stackoverflow...port-in-c-sharp

But, I'd probably try and get the com port number below 10 if possible.
I'm using an Arduino microcontroller which comes up as COM6.

You can change the comport (Windows 7) by:
  • Control Panel|Devices and Printers
  • Look for something that looks like your USB serial port or UART (mine in at the bottom, in "Unspecified"
  • Right Click Properties|Hardware Tab
  • Double Click USB Serial Port (COM6) in Device Functions
  • Select Port Settings Tab then Advanced Button
  • Change Com Port Number in the drop down box.


You will need your USB-Serial device plugged in before you can get to this.
Was This Post Helpful? 0
  • +
  • -

#3 Priyanka KS  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 25-January 13

Re: Data_Received event not firing using serialport connection in .Net

Posted 25 January 2013 - 04:00 AM

Hi Pademelon,

I have now changed the port of null modem cables as COM1 and COM2. But still the same issue persists. I checked through hyperterminal once again, but unable to get any response. i tried the below program

http://naveenkumar18...-port-in-c.html

but it only sends the data but not receiving and Data_Received event still not firing.
Was This Post Helpful? 0
  • +
  • -

#4 Priyanka KS  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 25-January 13

Re: Data_Received event not firing using serialport connection in .Net

Posted 25 January 2013 - 04:24 AM

Basically, the program given on the post
http://msmvps.com/bl...2300_-.NET.aspx

helps in knowing about the serial port. But it dosn't work in all pc i suppose. I am still not able to receive any data
Was This Post Helpful? 0
  • +
  • -

#5 Pademelon  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 6
  • Joined: 20-January 13

Re: Data_Received event not firing using serialport connection in .Net

Posted 25 January 2013 - 05:08 AM

Quote

Basically, the program given on the post

I've got that one as well, and it works with my microcontroller.

I think you have bigger problems though. If you can't get your computer talking with Hyperterminal, you're probably not going to get the other serial comms samples to run either.

First you need to make sure your cable is ok. Because you have tried multiple serial ports (both USB and real) I'd be looking at the null modem cable first.

These are wired:
pin 2 to pin 3 (RX to TX)
pin 3 to pin 2 (TX to RX)
pin 5 to pin 5 (GND to GND)

Generally you don't need the other pins connected unless you are using hardware handshaking (which for hyperterminal you probably won't be)

If you need to a fully strapped (means hardware signals are faked at each end of the cable to make the devices at either end happy) you can do the following on each individual connector:

loop pin 7 to pin 8 (RTS to CTS) on Plug 1, then make the same loop on Plug 2
loop pin 4 to pin 6 (DTR to DSR) on Plug 1, then make the same loop on Plug 2

The strapping connections on plug 1 are NOT connected to plug 2 (plug = connector)

Generally you don't need to go to this trouble, but some (few) devices require it.

I'd go with the first option and then strap the cable only if it doesn't work. Depending on the cable you are currently using, the hardware signals could be stopping your comms from working.

If you have a multi-meter your should be able to bell (check continuity or resistance on ohms) out the cable to see what you have.

Try that and I'll check back tomorrow.
Was This Post Helpful? 1
  • +
  • -

#6 Priyanka KS  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 25-January 13

Re: Data_Received event not firing using serialport connection in .Net

Posted 28 January 2013 - 06:27 AM

Hi Pademelon,

As per your suggestion, went to electronics shop and bought a new cross over cable and made the connection. We are now able to send and receive data perfectly.
Thanks for your valuable suggestion.
Was This Post Helpful? 0
  • +
  • -

#7 Pademelon  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 6
  • Joined: 20-January 13

Re: Data_Received event not firing using serialport connection in .Net

Posted 29 January 2013 - 01:02 AM

Good to see you now have it working, glad I was able to help out.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1