2 ธันวาคม 2554 9:37I am using Serial Port interrupt routine. I set the ReceivedBytesThreshold at 1K (1024 Bytes), so in the manners interrupt should be occur at 1K data. But whenever character "&" (0x26) receive an interrupt generates, it is braking the rule of ReceivedBytesThreshold and there is no method found to change this character. How i can change it or any way to solve this problem?
- ย้ายโดย Esther FanMicrosoft 23 เมษายน 2555 1:05 (From:Visual Studio Class Designer)
7 ธันวาคม 2554 8:35
Welcome to the MSDN Forum.
Please take a look at this thread: http://social.msdn.microsoft.com/forums/en-us/vcgeneral/thread/1786654E-7314-4F0E-9397-BD82862B91CD
You need to check where you have set the serial port interruption to "&".
MSDN Community Support | Feedback to us
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
7 ธันวาคม 2554 15:01
I did not find my answer at your provided links. I am using Serial event handler (Said serial interrupt).
20 ธันวาคม 2554 15:34
Is it .Net Framework 4 class SerialPort class?
If it is, you may review http://blogs.msdn.com/b/bclteam/archive/2006/10/10/top-5-serialport-tips-_5b00_kim-hamilton_5d00_.aspx at first. It provides details about DataReceived event:
“In general, if you set the ReceivedBytesThreshold to some value, say n, the interpretation is the same: you will get a DataReceived event when at least n bytes are available; not one per every n bytes.”
The DataReceived event is not guaranteed to be raised for every byte received(default). Use the BytesToRead property to determine how much data is left to be read in the buffer.
Have you changed the SerialPort.Encoding?
Can you repro this issue with a few lines code?