Így készíts képernyőmentést Siglent oszcilloszkópodról Python-ban !

Így készíts képernyőmentést Siglent oszcilloszkópodról Python-ban !

A feladat végrehajtásához segítségül hívjuk a PyVISA Python (beépülő)csomagot és a National Intruments NI VISA library-t.

Műszer Depó
Műszer Depó

A néhány soros Python program a lenti példában egy Siglent SDS1102CML+ műszerről készít képernyőmentést, majd eltárolja azt a E: meghajtóra.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#Example that returns a copy of the displayed image on SIGLENT SDS
#Oscilloscopes via USB and saves to a drive location
#
#Dependencies:
#Python 3.4 32 bit
#PyVisa 1.7
#
#Rev 1: 02262020 JC
 
import visa
import time # for sleep
 
def main():
_rm = visa.ResourceManager()
sds = _rm.open_resource("USB0::0xF4EC::0xEE3A::SDS1MFCQ3R5086::INSTR") #Replace with specific USB information from scope
file_name = "E:\SCDP.bmp" #Make suere that the drive specified is available on your computer
sds.write("SCDP")
result_str = sds.read_raw()
f = open(file_name,'wb')
f.write(result_str)
f.flush()
f.close()
if __name__=='__main__':
main()