Solved

Listening the serial port

Posted on 2009-05-19
1
251 Views
Last Modified: 2012-05-07
Hello,

I have a vb.net 2008 application. I am sending the following data to serial port: 01, AA, 02, 03, 09, CS. After sending 01 I wait for nearly 1 ms and then send AA, again wait for 1 ms and then send other set of data and so on. Now following is my query:
After I send the last data CS, I want to wait for 4 ms and then go into listen mode to listen and read any data that comes to serial port. How do I achieve this?
0
Comment
Question by:vj_mi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 15

Accepted Solution

by:
ChloesDad earned 500 total points
ID: 24428938
The serial port control has a datareceived event, so you can do one of two things

1 Have the event handler always connected, and use a timer to ignore andything received before the 4ma are up, or
2 add the handler programmatically after the 4ms are up
option 1
 
private serialport_dataReceived(sender as object, e as eventargs) handles serialport.datareceived
 
if i'm_ready_for_data then
' read data from port
endif
 
end sub
 
option 2
 
after the 4ms wait add
 
addhandler serialport.datareceived, addressof serialport_dataReceived
 
the code for the eventhandler becomes
 
private serialport_dataReceived(sender as object, e as eventargs) 
 
' read data from port
 
end sub

Open in new window

0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Groupbox Control ? 2 40
Web page design problem 3 42
Best book for Internet security 4 55
Read oracle BLOB in vb.net 2 24
Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question