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
Iqrar Ali
NA
259
3.1k
wrong data coming from LIS analyzer abacus diatron 380
Mar 27 2018 11:24 PM
i have below code when i execute the machine, the machine returns "q?". which is not suitable that i want from machine. what i do please please help....
public
void
SettingRS232()
{
try
{
serialPort1.PortName = comportName.Text;
serialPort1.BaudRate = Convert.ToInt32(combaudrate.Text);
serialPort1.DataBits = Convert.ToInt32(comdatabits.Text);
serialPort1.StopBits = (StopBits)Enum.Parse(typeof(StopBits), comstopBits.Text);
serialPort1.Parity = (Parity)Enum.Parse(typeof(Parity), comparityBits.Text);
serialPort1.Handshake = (Handshake)Enum.Parse(typeof(Handshake), comparityBits.Text);
serialPort1.ReadTimeout = 2000;
serialPort1.WriteTimeout = 500;
serialPort1.DtrEnable =
true
;
serialPort1.RtsEnable =
true
;
serialPort1.Open();
serialPort1.DataReceived +=
new
SerialDataReceivedEventHandler(DataReceivedHandler);
lblstatus.Text =
"Port is now ready..."
;
}
catch
(Exception ex)
{
lblstatus.Text = ex.Message;
}
}
public
void
DataReceivedHandler(object sender, SerialDataReceivedEventArgs e)
{
SerialPort sp = (SerialPort)sender;
string indata = sp.ReadExisting();
this
.Invoke(
new
Action(delegate() { richTextBox1.Text = indata; }));
}
private
void
btnStart_Click(object sender, EventArgs e)
{
if
(serialPort1.IsOpen)
{
}
else
{
btnStart.BackColor = Color.Green;
SettingRS232();
btnStop.BackColor =
default
(Color);
}
}
Attachment:
is.rar
Reply
Answers (
0
)
Session Triggers (Log on/off) in a Windows 7 Service
Window Service Database application