|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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. |
|
#2
|
|||
|
|||
|
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. |
|
#3
|
|||
|
|||
|
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 ![]() |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Visual Basic Programming > mscomm problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|