LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Can I call "installComCallback" then call "CmtScheduleThreadPoolFunction" to install serial callback directly?

We are writing Real Time code on PXIe-1085 with 8135/8 serial modules in chassis. I'm new to the team and working on a code based Current code we create does the following:

   

1.) In main() we call functions which initialize ports and threads for communications hardware. In particular for each of the serial com ports, we call OpenComConfig() to configure and CmtScheduleThreadPoolFunction () to create          a Thread that will call a function that will install CVI Callback for a specific serial port to receive com.

 

2.) In the body of the serial thread, it does the following:

     a.) call installComCallback to register a CVICALLBACK of serial receive routine.

     b.) Then the Serial Thread goes into an endless loop with ProcessSystemEvents() within the body of the loop. The serial Thread remain suspended there throughout the session untill application closes. Subsequently after all these serial threads are called and they do their thing, the CALLBACKS read the incoming data.

 

There are some things that I'm not really clear about. Firstly ProcessSystemEvents as described in your documentation was real scant only mentioned used in particularly allowing events especially GUI and windows messages to process. Normally in real time programming for something like this, I would imagine from main, calling a function that will initialize all the IO ports and then let's say create thread by calling CmtScheduleThreadPoolFunction() that attaches to callback directly. I guess the previous developer added the additional stage so that to get ProcessSystemEvents() in the code so the serial card see's the serial data event. Help me out here, is there a cleaner way of doing this? Does anyone out there have any examples?

0 Kudos
Message 1 of 2
(4,313 Views)

Hi Paul,

 

I'm not familiar with the ProcessSystemEvents function, but from my understanding it would not add very much functionality to a Real Time application. Adding this function to your COM Callbacks would allow LabWindows/CVI to process system events even though the COM Callbacks loop endlessly. Does your current code function as you desire it to? Could you post the relevant code so we can better understand what you are referencing?

Steven Gloor
Staff Customer Engineer - CTA, CLD
0 Kudos
Message 2 of 2
(4,282 Views)