TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
bob kings
NA
1
0
Problem with serial communication with xon/xoff controls
Oct 22 2008 6:58 PM
Hi
I am a newbie in C# and somehow have to develop a software that communicates with an external device that has a RS232 interface.
I have some experiences with RS232 programming but none of them involves handshacking.
The parameters of this device is as follows:
baudrate: 1200
parity: odd
data bits: 7
stop bits: 1
handshacking: Xon/Xoff
If I use the hyperterminal in windows, it responds ok. But I cannot get the C# program to work.
Here is the part of the settings in the program:
SerialPort BalancePort = new SerialPort();
BalancePort.PortName = 'COM1';
BalancePort.BaudRate = 1200;
BalancePort.DataBits = 7;
BalancePort.Parity = System.IO.Ports.Parity.Odd;
BalancePort.StopBits = System.IO.Ports.StopBits.One;
BalancePort.Handshake = System.IO.Ports.Handshake.XOnXOff;
BalancePort.ReadTimeout = 2000;
Here is the the write and read part:
BalancePort.Write(new byte[] { 0x1B, 0x50 }, 0, 2);
Thread.Sleep(5000);
string feedback = BalancePort.ReadExisting();
But it turns out every time it does not read a byte.
Any suggestions is highly appreciated.
ThanksP
Reply
Answers (
1
)
Crystal report in ASP.Net - How to design parameter prompts
Crystal Report