09-04-2012 09:18 AM
Hard to say since you did not do what I asked.
I still think you are doing the conversion incorrectly with the index and concantanate instead of the join numbers but again, you did not provide some of the details.
09-04-2012 10:06 AM - edited 09-04-2012 10:07 AM
1. That graph image does not look like the values on the chart are going to zero. It looks to me more like a low value of a few hundred.
2. The "read string" indicator shows the last character as \FB which is supposed to be your termination character. The VISA Read does not include the termination character in the output string, so something is not working as expected. I do not have the time to set up a special serial port test to try to emulate your system. Were the termination character controls set before the program starts running? The defaults values will not set the port the way you want.
3. Your string conversion does not appear to match the protocol specified on page 4 of the sensor document. The Number indicator is not displaying 2236, which is how I would interpret the protocol for the values in read string. I have never seen a protocol like that. I do not think any of the standard string to number conversion functions will do what you want.
This code will produce the results described in the protocol.
Lynn
09-11-2012 10:45 AM
So many Thanks. your suggestions helped me alot.
01-01-2013 04:53 PM
Hi every body,
Wish you all a happy and bright new year.
I am reading signal through Serial port. When I am trying to save my file into text file Sampling frequency is changing and it is not constant while device is sending 1 frame every 10 MS.
First I faced a problem that time stamp was repeating for some points while signal kept changing.
I solved that problem by putting a case structure and time delay function for about 1 MS and it is solved. Even though I am not sure this make program miss the data or not. Device is sending every 10 ms one frame.
Thanks for your help.
01-01-2013 06:39 PM
The way I read your protocol, it looks like it sends one frame, waits 10 ms, and then sends the next frame. That makes the period 12.86 ms.
Since each frame ends with the ETX character and it appears that the data cannot contain that value, use ETX as the termination character. Then you can set the byte count to a larger value and eliminate the delay.
Write to file may take more than 12 ms. Consider a Producer/Consumer architecture and writing larger amounts of data but less often.
The OS and the resolution of the Get Date/Time function may also be factors. Look at the simple timestamp checker I have attached. On my computer the timestamp differences range from 12.6 ms to 14.3 ms with a nominal delay of 13 ms. With a delay of 10 ms the differences range from 9.6 to 11.4 ms.
Lynn
01-01-2013 07:00 PM
Dear Lynn,
So many thanks for prompt reply.
I can't see the attached file. Thanks for your help.
Regards,
01-01-2013 09:00 PM
I think it would be easier for you to see it if I actually attached it! Sorry.
Lynn