Forum Index > Comm64 OnComm genererates Receive Event only when several bytes received.

By: Guest Posted on: Mar 18 2014 at 04:50:35 AM
I use Visual Studio 2012, C#, and Comm64.dll.
My Windows7 PC receives 60 packets every seconds, and One packet consists of 15 bytes.
I set .rThreshold to '1' for checking every byte in OnComm routine.
But, when I checked, OnComm arises only when 15 bytes received. and sometime 16 bytes, and some times 29 bytes.
I should control the other device whenever the start code of packet received.
But the timing of Oncomm is not regular so, I don't know how to do.
The property of com port is 38000, o, 8, 1.
The program worked well when I used MSCOMM in windows 32bit system.
I test it for .net serialport class.
It shows the same as comm64.
Does anyone know the reason?

By: Guest Posted on: Mar 18 2014 at 02:49:10 PM
Are you saying that the .net serialport also raises the event after >15 characters?

The event is raised on the first character. But by the time the event handler in your application is triggered more characters have arrived.

Perhaps the framework is a little slower to respond.

Remember. 38400 bps is almost 4 bytes per millisecond. When you respond to an oncomm event you must empty the receive buffer.

Also you say you're using Odd parity with 8 databits? You might be able to select that but not all hardware is capable of doing 8 databits with a parity bit. Most IBM PC compatibe com ports are based on 8250/16550 Uart which will be throwing framing errors slowing things down. Notnsaying this is the cause of your problem but maybe think about whther you are actually acheiving Odd,8,1

By: Guest Posted on: Mar 18 2014 at 05:24:37 PM
Thanks for your reply.
Maybe you are right. The framework seems to be slow.
When I used the same system with windows XP and MSCOMM and C#, it worked well.
At that time I had set the .rThreshold to '15'.
But in current system the event handler shows irregular bytes received with rThreshold '15'. So I set the .rThreshold to '1', and the result was as I said.
Now, I think I should find new method for finding the start timing of Packet.
Except the timing, the serial port works well. It can receive all data without loss.
Thanks again.

By: Guest Posted on: Mar 18 2014 at 05:32:56 PM
And, I didn't understand actual achieving of Odd, 8, 1.
I had just set the port as '38400, odd, 8, 1'. Actually I didn't check and consider whether the odd parity worked well. I used only 8 data bits. And I didn't catch any problem about this. I didn't know how to check the parity in hardware.


Reply - add comment to this topic
You may enter letters, numbers and standard punctuation only. HTML and other scripts/tags will be rejected
  Topic:- Comm64 OnComm genererates Receive Event only when several bytes received.

Your Name


Forum scripts and databases - Copyright (c) 2009 - 2012