LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Acquire data continuously using InstallComCallback

Hi

I am trying to aquire data (8 Bytes) every 20ms over RS232 using InstallComCallback.

This is how I am trying to do it :

 

// Open and Configure Com port 1
OpenComConfig (1, "", 9600, 0, 8, 1, 512, 512);

 

SetCTSMode (1, LWRS_HWHANDSHAKE_OFF);

FlushInQ (1);
FlushOutQ (1);

 

InstallComCallback (1, LWRS_RXFLAG, 0, (int)EventChar[0] , Event_Char_Detect_Func, 0); // Actuall event mask and function are some what different 

while(1)

{

          processsystemevent();        //bare with typo 😕

}

 

when I am running it. It is working fine for 4850 (apprx) data set. after that its stopping automatically

I want to run this callback for really long time (infinte loop) with stopping/ getting inturrept by any means.

Is it inturrept related problem ??

How to solve it ??

Thanks in advance 

 

Ankur Verma

0 Kudos
Message 1 of 4
(4,588 Views)

It's hard to guess what's happening with so few informations...

 

When you say it's stopping automatically: is the callback simply not being called or does the program crash in any way?

Are you receiving any error? Are you actually trapping errors in serial functions?

 

Please add a few more details so that we can try to figure out what can be happening.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 4
(4,577 Views)

Thanks for the reply.

I would like to add few more details to explain myself.

1. No system crash ,, no run time error. Everything goes smooth.

2. I added one line in while loop 

            printf("Waiting for data\n");

after printing COM data correctly for 4850 times. Its always in waiting loop and print "Waiting for data"

Note: printing COM data is done via callback function. That means COMcallback is getting uninstalled after 4850 cycle witheven asking.

P.S.: I made sure, 'Eventcharacter' is comming from external device continuously/ infinity to rule out the possibility of not getting proper event to execute callback.

 

Thanks  

0 Kudos
Message 3 of 4
(4,560 Views)

It would be the first time I see a calback uninstalled by itself!

Can you post the real line where you install the callback?

Is there any line in your code where you uninstall the callback the may get called someway?



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 4 of 4
(4,541 Views)