11-14-2009 03:33 AM
Hi everyone,
I was trying to use LabVEW8.5 to connect with Polhemus Fastrak with 4 sensors,and encountered a problem with "buffer"..
I have tried to use NI-VISA to read buffer from the machine and it's been done. But the string was really terribly stuck up with each other and encounterd data loss.
I had read about the related discussions here and another form about labview discussion, buyt I still didn't know how to fix it..Could somebody help or give me a hint?..Many Thanks..
Here is my vi
11-14-2009 08:23 AM
Sorry I'd attached the wrong VI,
here is the VI..
Could somebody please tell the problem is resourced from data processing or rs232-VISA serial ?
11-14-2009 10:43 AM
You may have a problem because of the way that you have written the code. There is absolutley no reason to initialize the serial port with each iteration of the while loop. Move that and VISA Close to outside the loop.
You have set the VISA Configure Serial Port to terminate the read on a termination character. You are then using VISA Bytes at Serial Port to determine how many bytes to read. You do NOT need to read how many bytes are available or a fixed wait if the instrument is sending a termination character and a single line of data. If however, the instrument sends multiple lines with each response, you want to disable the term character and use thenumber of bytes and keep reading until the number of available bytes is 0.
p.s. The use of the local 'Sig Acquire' is just silly.
11-15-2009 01:23 AM
Hi Dennis, thank you for your opinions. I'll re-write the vi again based on you advice.
Why I used 'signal aquire' is because there're several event structure and in this one I tried to use it to trigger 2 different resouce VIs (one from NI-DAQ device, another from rs232). I thought about it for several days and that's the simple one so far that came into my mind . so...
Btw the problem with 'string' had been solved by other friends, they found the string length of each data is 7.
After reconsidering of this idea, we had the string subset and solved.
Thank you again Dennis.