Tektronix Technical Forums are maintained by community involvement. Feel free to post questions or respond to questions by other members. Should you require a time-sensitive answer, please contact your local Tektronix support center here.
I have been working on a program in C# (Visual Studio 2017) that can save a .csv file multiple times. This CSV needs to include x-axis data as well as data from Channel 1 and Channel 2. The current issue I am running into is that I am unable to run the program more than one without power cycling my Oscilloscope.
I run my code and, when it goes to save Channel 2, the response from the first query (in my case, YMULT) seems to be coming back incorrectly. My code crashes at the parsing of the response, saying "System.FormatException: 'Input string was not in a correct format.'" Upon looking into Response, it is an empty string. I am unsure why I cannot communicate with the Oscilloscope multiple times. Do I need to reset it in some way?
As a side note, the same thing happens after I save Channel 1, crash, and re-run the code. The second time through, it does not save channel one, crashing with the same error.
I have attached my Visual Studio Solution zipped in a .rar file. Please let me know if you have any advice for my code or if more information is needed!
EDIT: I have realized that, upon zipping and attaching my file, my first query says 'TVA.Write("DATA:SOU CH1, CH2");' This was a form of the code that I was testing, and not how I have been running it. It should just say 'TVA.Write("DATA:SOU CH1");'
- (1.19 MiB) Downloaded 767 times
When you query the data from the scope with the CURVE? query, the data gets sent back with the block header (#45000 for example) followed by the raw data itself. After you have read all the data you will need to do one more read to read the return line character "\n" that the instrument outputs after the data. If you do this, you should be good the next time you go to read from the scope.
I am running a TVA.Read(out response); directly after my TVA.ReadBinary(out rawwave1); to clear the '/n' character. This does not fix the issue. The queries return an empty string "".
I am unsure if it is an issue with my oscilloscope or my software. Could someone maybe try running this on their own oscilloscope?
On line 43 of your code it says
Code: Select all
TVA.Write("DATA:SOU CH1, CH2");
Code: Select all
I had previously posted an edit to my original post saying that I had accidentally left in a feature that I was trying out, and that was the attempt to save both channels. It is currently not working for me with the change that you asked me to make as that is what I originally had.
Who is online
Users browsing this forum: No registered users and 5 guests