| Products > Test Equipment |
| Visual Basic Code Example To Download Screen Shot from TDS3000/MSO4101/TDS5054s |
| (1/3) > >> |
| daveyk:
I am trying to work out Visual Basic Code To Download Screen Shots from TDS3000/MSO4101/TDS5054s. I have access to a non-Tektronics TDS3000 series program that during testing, it download several screen shots in BMP format that look identical to a sub folder of the program. I have yet to figure out how to do that other than turning on the InkSaver option - lol. The inksaver does make the screen shot from OpenChoice Desktop better for inclusion in a Word documents. I just think it would be nice to do the screenshot myself and save a step or two. I do not have access to the author of the program in question to ask him how he did it. I have been working around the SAV:IMAG commands and am not receiving errors when I tell it to dump to c:\temp\test.BMP, but I beginning to this those commands are from the perspective of the scope, not the program. I know the TDS5054 has a "C" drive, but I really do not think the TDS3000 or MSO4104s do. Scope.WriteString "SAV:IMAG:INKS ON" Scope.WriteString "SAV:IMAG:FILEF BMP" Scope.WriteString "SAV:IMAG C:\TEMP\TEST.BMP" Again, the scope does not know what or where my "C:" drive is, so I think that may be an issue. The other program that I did not write does transfer the BMP from the scope to the computer. I just don't know how it is doing that. Anyone else here program with these scopes? Dave |
| alm:
Read the programming manuals for your scope for the exact commands. Having the scope save directly to your computer's disk is certainly not going to work, so unless you want to juggle usb sticks / floppies, I'd use something like this (again check the programming manuals for specifics). This is Python code I wrote over a decade ago for the TDS-3000, not Visual Basic, but should be trivial to translate to whatever flavour of Visual Basic you use (I hope something from the current millennium...): --- Code: ---gpib.write(scope, 'hardcopy:port gpib') (or rs232) gpib.write(scope, 'hardcopy:layout portrait') gpib.write(scope, 'hardcopy:format PNG') gpib.write(scope, 'hardcopy:compression 1') gpib.write(scope, 'hardcopy:inksaver 0') gpib.write(scope, 'hardcopy:pallet normal') gpib.write(scope, 'hardcopy start') hardcopy_data = gpib.readraw(scope) harcopy_file = open('hc.png', 'w') hardcopy_file.write(hardcopy_data) hardcopy_file.close() --- End code --- I hope you're not using RS-232, because downloading hard copies over RS-232 was quite a hassle for me back then. RS-232 doesn't have a real concept of 'readraw', so what I ended up doing is to read 1 byte at a time, and if no data came for a number of seconds, consider this the end of the transmission. |
| daveyk:
Using GPIB, or in the case of the MSO4104, USB, but I communicate with it using the exact same VISA code as with GPIB just making show my ini file shows the address (USB0::0x0699::0x0401::C000082::0::INSTR). At this point my brain is numb - lol. Tektronix states for the MSO4104, if you are connected to USB it will send the hard copy to the USB port. Now, how to capture the hard copy? I need to study your code above. |
| daveyk:
P.S. - BTW, my utility program that I am trying to add this feature to already supports my TDS3000 scopes (have four of them) and I recently added the MSO4104. I already had a TDS5054, that as far as I can tell pretty much responds to the same codebase of the MSO4104. There are some differences between the code of the TDS3000 and the other two, but not huge differences. I was able to easily (in some case, it wasn't - lol) addapt existing TDS3000 code to control and setup the MSO4104. Then I go the silly idea, I would like to download a tiff image (or BMP, or PNG) of the screen. I never figured out how to do that with the TDS3000 either. If I could figure that out, I have several programs here in the lab that could benefit from that ability. |
| daveyk:
" hardcopy_data = gpib.readraw(scope) harcopy_file = open('hc.png', 'w') hardcopy_file.write(hardcopy_data) hardcopy_file.close() " This needs explained how that is intercepting the hardcopy. I do not have a readraw option. When I do my visa code to accept data from the scope, here is an example: scope.ReadString ->Scope = gpib I have an: Scope.ReadIEEEBlock, which I have no idea what that is about and there is Scope.ReadNumber Typically data from the scope is read in to a variable. Anyway, without the structure and the "hardcopy_file" definition or function, or utility, I don't know to make of that. Anyway, it's time to give this a rest for the night, but I do want to continue this tomorrow after church. Dave |
| Navigation |
| Message Index |
| Next page |