08-10-2005 12:18 PM
08-11-2005 01:08 PM
It sounds as if you are having interupt problems. Are you using a CVI Callback function to respond to the serial port?
Terry
08-11-2005 01:31 PM
I'm using InstallComCallback ( with a receive event mask set at 13 bytes, my messages range from 7 to 400 bytes) with a CVI callback function. After further debugging, it also appears that the callback stops funcitoning - I can place a breakpoint in my callback function and I never get there even though I know data are being sent to the serial port. I've added a GetComStat() function that I poll periodically to see if anything bad is happening and it appears that everything is working fine. Strange stuff.......
Thanks,
Jeff
08-12-2005 04:39 AM
I've only used the serial libraries a few times for my CVI programs, but I never did get the hang of the COM callbacks - I never could get them to work as I expected. So now I don't bother with them. I use a combination of conventional Timer callbacks, a decent input buffer size, GetInQLen() and ComRdByte(1) functions to tailor my applications and have never looked back.
JR
08-12-2005 06:07 AM
08-12-2005 07:58 AM
Thanks for the input. This is definitely a bizarre phenomena that I'm seeing and is something I haven't encountered in the past. My serial buffer size is huge 65k and I have multiple threads running in the background, although all the I/O operations (i.e. serial and file) are in the same thread. The other strange thing that I'm seeing is that the Com Callback seems to stop functiong after some time (not sure if it also related to data throughput). I know this is occurring when my notice my application stops functioning properly and I put a breakpoint in my callback routine (I know my hardware is still sending data) and I never get to my breakpoint. Given this, I'm beginning to wonder if the callback routine is reentrant. If it was, this would certainly be the cause of my problems. My callback routine reads data from the serial port and copies these data to a circular buffer where another routine checks message integrity and processes the message as necessary. This would certainly cause my data corruption problems. Also, I noticed that using an InstallComCallback with a Receive Mask of n bytes requires the serial buffer to go below this threshold and then back above it to cause a event trigger. With reentrant code, I may not be reading the serial buffer at the right instance in time causing the event trigger to never happen again. Any thoughts? All your help is much appreciated, this has been a very frustrating debug session.
Jeff
11-27-2007 08:37 AM
11-28-2007 11:34 AM
11-28-2007 11:37 AM
I never really found a good solution to this problem. I ended up adding an async timer that polled the port at a predefined interval, not a great solution since it wasted cpu cycles, but a very predicatable and stable one (better tradeoff). I was using CVI 7.0.
Jeff
11-28-2007 12:10 PM