05-09-2014 12:06 AM
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
05-09-2014 01:47 AM
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.
05-10-2014 02:57 AM
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
05-11-2014 12:58 PM
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?