Cours:Oscillogbf : Différence entre versions
| Ligne 1 : | Ligne 1 : | ||
| + | =python et Qt= | ||
| + | <source lang=python> | ||
| + | import sys | ||
| + | import pyvisa | ||
| + | |||
| + | from PySide2 import QtCore, QtGui, QtWidgets | ||
| + | from PySide2.QtWidgets import QApplication, QWidget, QFileDialog, QPushButton | ||
| + | from PySide2.QtUiTools import QUiLoader | ||
| + | |||
| + | |||
| + | def appui_bouton(): | ||
| + | print("Appui sur le bouton") | ||
| + | print(inst.query('*IDN?')) | ||
| + | |||
| + | |||
| + | loader = QUiLoader() | ||
| + | app = QtWidgets.QApplication(sys.argv) | ||
| + | window = loader.load("form.ui", None) | ||
| + | window.my_push_button = window.findChild(QPushButton, "pushButton_2") | ||
| + | window.show() | ||
| + | |||
| + | window.my_push_button.clicked.connect(appui_bouton) | ||
| + | |||
| + | materiel=pyvisa.ResourceManager() | ||
| + | print(materiel.list_resources()) | ||
| + | inst=materiel.open_resource('TCPIP::10.98.35.144::INSTR') | ||
| + | |||
| + | app.exec_()</source> | ||
| + | |||
| + | =liens= | ||
| + | *[[Media:Dg822_programming.pdf]] | ||
| + | *[[Media:MSO_DS1000Z_ProgrammingGuide_EN.pdf]] | ||
| + | *https://pyvisa.readthedocs.io/en/latest/introduction/communication.html | ||
| + | *https://connect.ed-diamond.com/GNU-Linux-Magazine/glmf-124/controle-d-instruments-scientifiques-les-protocoles-gpib-vxi11-et-usbtmc | ||
| + | *https://iosignal.fi/wp-content/uploads/DG800_ProgrammingGuide_EN.pdf | ||
| + | *https://github.com/lxi-tools/lxi-tools | ||
| + | |||
| + | =Tests= | ||
banc de mesure : 1 scope DS1074 + 1 gbf DG822 | banc de mesure : 1 scope DS1074 + 1 gbf DG822 | ||
| Ligne 42 : | Ligne 80 : | ||
inst.write(commande) | inst.write(commande) | ||
</source> | </source> | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
Version du 5 février 2025 à 09:56
python et Qt
import sys
import pyvisa
from PySide2 import QtCore, QtGui, QtWidgets
from PySide2.QtWidgets import QApplication, QWidget, QFileDialog, QPushButton
from PySide2.QtUiTools import QUiLoader
def appui_bouton():
print("Appui sur le bouton")
print(inst.query('*IDN?'))
loader = QUiLoader()
app = QtWidgets.QApplication(sys.argv)
window = loader.load("form.ui", None)
window.my_push_button = window.findChild(QPushButton, "pushButton_2")
window.show()
window.my_push_button.clicked.connect(appui_bouton)
materiel=pyvisa.ResourceManager()
print(materiel.list_resources())
inst=materiel.open_resource('TCPIP::10.98.35.144::INSTR')
app.exec_()
liens
- Media:Dg822_programming.pdf
- Media:MSO_DS1000Z_ProgrammingGuide_EN.pdf
- https://pyvisa.readthedocs.io/en/latest/introduction/communication.html
- https://connect.ed-diamond.com/GNU-Linux-Magazine/glmf-124/controle-d-instruments-scientifiques-les-protocoles-gpib-vxi11-et-usbtmc
- https://iosignal.fi/wp-content/uploads/DG800_ProgrammingGuide_EN.pdf
- https://github.com/lxi-tools/lxi-tools
Tests
banc de mesure : 1 scope DS1074 + 1 gbf DG822
le script (basique ...) qui gère le tout :
#!/bin/bash
IPSCOPE=192.168.1.111
freq=100
while true; do
# 1 sinus ampl=5V, offset nul, dephasage nul
./dg822_write.py ":sour1:appl:harm $freq,5,0,0"
sleep 2
# demande un AUTo mode au scope
lxi scpi -a $IPSCOPE "AUT"
sleep 5
let "freq += 100"
done
les commandes python :
#!/usr/bin/python3
import sys
import pyvisa
rm=pyvisa.ResourceManager()
inst=rm.open_resource('USB0::6833::1603::DG8A231301537::0::INSTR')
print("commande = ",sys.argv[1])
commande=sys.argv[1]
inst.write(commande)