04-04-2006 02:58 PM - edited 04-04-2006 02:58 PM
Message Edited by k1_ke on 04-04-2006 04:01 PM
04-04-2006 03:15 PM
04-05-2006 07:17 AM
Hi Mert A.
Thank you for your reply. I tried what you told me....but still in the portmap i get the same messeges before i receive the response. When using comcallback, would all the characters be waiting in the input buffer and read them one after the other, i roughly send 8bytes and receive between 8-13btyes...do u think the waits and get comm status is because it still waiting to get all the characters....
Also i jus want to make myself clear, when i step through it...i have a breakpoint when i read the port...from the time i send a request....n comes to the breakpoint....i have already got a few wait and get comstatus commands....
Do u think its something in my code thats triggering the extra lines??
looking forward to hear from you.
Thanks
k1_ke
04-05-2006 11:18 AM
04-06-2006 02:50 PM
hi Mert A
Thanks alot for the reply. No i only call installcomcallback once in the start in main loop.....i also do not open n close the comport.....well i hv a timer callback which sends a command to the serial and then receive data using comcallback and then update the uir using Convert2Buffval()........i dont use processsystemevent() but after a send request is made.....it should wait until the data is received....even if the timer tick occured...i check if the respective flags where set...if yes send another request otherwise wait.....attached a the pieces of code....for comcallback n timer....
hope it helps...
thanks
k1_ke
04-06-2006 03:56 PM
04-11-2006 08:23 AM
Hi,
Thank you for your reply. Well i hv those checks cos i dont knw the termination byte, jus that the 2nd byte tells me hw many bytes i should receive....so later i check if the bytes received are the same thats all......i will look into the speed stuff later....for now i am happy with the perfomance
Currently i am stuck in another problem.....See i hv multiple panels.....i hv a timer in the main panel....which updates the parameters.....i use installcomback and everytime a char is recd comcallback is triggered....Now in my other panel i hv to use this too but the parameters are different for installcomcallback so what i do is when loading the new panel....i do the following....
InstallComCallback (comport, 0, 0, 0, 0, 0); //disable sync callback function
SetCtrlAttribute (panelhandle, MAIN_TIMER, ATTR_INTERVAL, (double)0.005); //enables main timer
InstallComCallback (comport, LWRS_RECEIVE, 32, 0, VideoComCallback, NULL);
Well in this new panel i recd alot of bytes...and sometimes i cna hv less than 32 btyes in the que in the end....so then i use the same timer which is in the main panel....hv a flag so timer know what code to execute.....i change the timer interval to 5ms as thats longer than what it would take to receive 32bytes at 115200baud.......in the new videocomcallback i hv reset timer() everytime it is called adn enable timer everytime it exits....thus if it wrks fine....the timer gets reset before it counts 5ms.....bt if i look at the port map i receive bytes ramdonly...sometimes 32 sometimes 48......its weird.....and i hv checked...when in this new panel everythign else is stopped.....even the updatign in the main panel stops cos in the timer hv a flag....if idle i use the portmap to see there is nothign sent or received.
do u think what i done with installcomcallback is causing the problem??? also in the timer callback i now hv ProcessSystemEvents cos otherwise doesnt let me click on anything on the main uir....
Looking forward for a reply.
Thanks
k1_ke
04-11-2006 10:34 AM
I was able to figure out my problem.
Thanks anyways for trying!
k1_ke
04-11-2006 10:57 AM
04-11-2006 10:58 AM