Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 18th, 2003, 09:45 AM
smita_bhat smita_bhat is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: Bombay
Posts: 2 smita_bhat User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question mscomm problem

Hi everybody,

Can anyone help me plzzzzzzzzzzzzz?

I am doing my VB Mscomm Program for the first time in my life.

Actually, first the PC sends some data to the circuit.Next, after certain processing the circuit sends data to PC. Now, the PC gets the entire data properly in its oncomm event.

However, if the VB Program sends the data & then is waiting to receive something in particular say 5 then the mscomm_oncomm event never occurs.

I do not know the reason behind this problem.

Also, if the program waits in the oncomm event then it works well.However, doing anything except receiving /sending in oncomm event is not a good programming practice.

So, can anyone solve the problem?

Bye.

Reply With Quote
  #2  
Old December 19th, 2003, 04:57 AM
williamcrawley williamcrawley is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: uk
Posts: 91 williamcrawley User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
The oncomm event should really only be used to receive messages. If your device is sending a 5 down the line, then provided you have the baud rate, parity and so on set correctly, then it will appear in the oncomm event.

Do not forget that the buffersize may if set to large when only 5 is sent may not raise the oncomm event, because the buffer isn't full. Set the buffersize to 1 to start with.

You should send data from another part of your program.

If your device hasn't sent a 5 or anything else, then of course the oncomm event will not occur because nothing has come in for the VB app to do anything.

Reply With Quote
  #3  
Old January 3rd, 2004, 09:57 PM
robbage robbage is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: Perth, Western Australia
Posts: 30 robbage User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Send a message via ICQ to robbage
The mscomm control sucks.. Having said that...

The OnComm event doesn't trigger when data is received. Why would it? That would make sense.
Like all 'great' MS programming, you have to poll for received data. The OnComm event triggers only when the CommEvent property changes (usually an error occurs)

Create a timer event and check the InBufferCount property or use the Input property to get data and check if there was input. Remember that when you check the Input property the data is removed. so you can't do this:

If Len(mscomm.Input) then
a=mscomm.Input
endif
because the len(mscomm.input) removes the data!

This control is a total joke

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > mscomm problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway