|
-
Jan 7th, 2011, 07:09 AM
#2
Fanatic Member
Re: C# with RS485/Serial Port Communication
 Originally Posted by honeybee
I have to work with a device that uses RS485 protocol to talk to a PC. So there are two things I need to get done:
1. Use an RS485 connector to connect the device to my PC. But I don't have an RS485 port on my machine. On checking the internet I found I could use a bridge to convert RS485 to RS232 and back. Supposing that's the way I have to go, will it impact the communication with the device in any way? Will I then have to code the app to use RS232?
2. Secondly, are there any good samples out there which use serial communication with C#?
.
If you want to connect it to the RS232 port on your computer then you can get small self powered adapters - RS232 9pin one one with the RS422/485 screw terminals on the other. Cost maybe $20
Or you can use a USB adapter. That has USB on one end with 422/485 on the other.
I mention 422 and 485 because electrically they're pretty much the same thing except we usually use RS422 as a point-to-point to connect two devices to each other wherease Rs485 is usually a multidrop protocol based thing where you have a controller that 'polls' a number of slave devices all sharing the same bit of wire.
So, if you are using RS485 then not only do you need to think about the hardware you'll probably also need to look the RS485 protocol which can be a problem because there is no actual industry standard protocol. If you have an RS485 device then you need to be looking at the supplier of that device to find out if it's 2 wire or 4 wire RS485 AND also information about the protocol.
But, step back a bit, and you may find that the supplier of the RS485 device also supplies the computer hardware with built in RS485 protocol and all you need to do is send receive RS232 data.
It is a big subject with too many variable to give much advice. Talk to the supplier of the other 485 devices.
As for sample code that uses c# you can see some at
http://www.comm64.com
but that's just going to show you RS232 but it's a start I suppose.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|