473,507 Members | 2,472 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

RS23-Port with C#

Is there any Information about reading out a RS23-Port with C#?

Thanks,

Marcelo Muzilli

May 25 '06 #1
3 2036
mm******@gmail.com wrote:
Is there any Information about reading out a RS23-Port with C#?


Yes, checkout the System.IO.Ports.SerialPort class. It was added in
..net 2.0. I just typed it into Google and got plenty of info.
--
David Hogue
May 25 '06 #2
Thank you David for your response.

I would like to know if can I work with DEX (I will transmit
information from my handheld to my PC) using this class? And if it's
possible for you, could you give a sample?

Cheers,

Marcelo Muzilli

May 25 '06 #3
mu*****@sercomtel.com.br wrote:
I would like to know if can I work with DEX (I will transmit
information from my handheld to my PC) using this class? And if it's
possible for you, could you give a sample?


I'm not sure what DEX is. I have successfully used this class to
control ptz cameras and wireless bar code scanners. So, I don't see any
reason why it shouldn't work with your hardware.

Below is some sample code to open a the port and listen for data. It
assumes that the device sends ascii characters and that it terminates
the lines with a carriage return.

If your device has a binary protocol, you will probably want to use
SerialPort.Read() which can fill in an array of bytes.

There's also Write() and WriteLine() is you need to send data/commands
to the device.

using System;
using System.IO.Ports;

public class Example
{
private static SerialPort port;

public static void Main()
{
// setup the port
port = new SerialPort("com1",
9600, Parity.None, 8, StopBits.One);
port.NewLine = "\r";

// setup event handler
port.ErrorReceived += port_ErrorReceived;

// open port
port.Open();

Console.WriteLine("Port opened, waiting for data, " +
"press enter to quit");
Console.ReadLine();

port.Close();
}

private static void port_DataReceived(object sender,
SerialDataReceivedEventArgs e)
{
string line = port.ReadLine();
Console.WriteLine("Received: " + line);
}
}
--
David Hogue
May 26 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
3859
by: R | last post by:
Hi, I'm really stuck here. I have a data combo called cmbHvem which I link to a recordset RS23 like this If RS23.State = adStateOpen Then cmbHvem.RowSource = Nothing RS23.Close() End If
0
7223
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7114
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...
1
7034
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7488
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5623
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3191
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
762
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
412
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.