01-26-2015 03:55 AM
Hi,
I found a LabVIEW code here which can storage data from input signal (e.g.A/I)in SR830 and transfer it by the GPIB.
I used function generator to generate a sine wave with frequency:30Hz& Vp-p:100mVolt , conencting to SR830.
Clearly ,I got a correct result when i used the code by GPIB communication interface(left graph).
Than,I tried to change the communication interface RS232 to accept the same signal,but it has mistakes(right graph).
Here is original code "data storage for GPIB"
Here is rewrite code for RS232 by myself,but what's wrong i did?
01-26-2015 08:47 AM
format strings are case sensitive and well,,,,, yours are wrong.
%d formats a decimal integer "%8.0D" makes no sense at all. The help file will guide you towards getting the actual format specifiers you need from the SR830 manual.
01-26-2015 09:15 AM
01-26-2015 03:31 PM - edited 01-26-2015 03:42 PM
The SR830 expects three integer arguments (separated by commas) for the TRCA? query:
* i = 1 or 2 specifies which buffer to download from
* j >= 0 specifies the starting point
* k>=1 specifies how many points to download
If you know k, you can calculate the exact number of bytes in the response. For your code, which downloads 4000 points at a time, that will be something like 60 kB (if memory serves, the response in ASCII transfer mode is 15 bytes/value). Make sure that you're not hitting any timeout or serial buffer size limits with a transfer of that size.
Edit: You have your bitrate set to 9600 baud (1200 bytes/second) and a 10 second timeout. That will read 12 kB before timing out, or 1/5th of your transfer. The 830 supports baud rates up to 19,200, which will help, but you'll also need either a longer timeout or to transfer your data in smaller chunks.
01-24-2025 08:32 AM
Hello! I’d like to ask how to make this program run infinitely, so it’s always reading the outputs from both channels. Could you help me with this? Thank you!