Skip to content
Navigation Menu
Toggle navigation
Sign in
Product
Actions
Automate any workflow
Packages
Host and manage packages
Security
Find and fix vulnerabilities
Codespaces
Instant dev environments
GitHub Copilot
Write better code with AI
Code review
Manage code changes
Issues
Plan and track work
Discussions
Collaborate outside of code
Explore
All features
Documentation
GitHub Skills
Blog
Solutions
By size
Enterprise
Teams
Startups
By industry
Healthcare
Financial services
Manufacturing
By use case
CI/CD & Automation
DevOps
DevSecOps
Resources
Topics
AI
DevOps
Innersource
Open Source
Security
Software Development
Explore
Learning Pathways
White papers, Ebooks, Webinars
Customer Stories
Partners
Open Source
GitHub Sponsors
Fund open source developers
The ReadME Project
GitHub community articles
Repositories
Topics
Trending
Collections
Enterprise
Enterprise platform
AI-powered developer platform
Available add-ons
Advanced Security
Enterprise-grade security features
GitHub Copilot
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Pricing
Search or jump to...
Search code, repositories, users, issues, pull requests...
Search syntax tips
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Sign in
Sign up
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
Lee-7723
/
Python-SCPI
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
1
Code
Issues
0
Pull requests
0
Actions
Projects
0
Security
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security
Insights
Files
master
Breadcrumbs
Python-SCPI
/
SCPI_demo.py
Blame
Blame
Latest commit
History
History
14 lines (12 loc) · 939 Bytes
master
Breadcrumbs
Python-SCPI
/
SCPI_demo.py
Top
File metadata and controls
Code
Blame
14 lines (12 loc) · 939 Bytes
Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import
pyvisa
#官方文档 https://pyvisa.readthedocs.io/
#N6700C电源的编程文档 https://www.keysight.com/us/en/assets/9018-03617/programming-guides/9018-03617.pdf
rm
=
pyvisa
.
ResourceManager
()
rm
.
list_resources
()
#此处应列出已连接的设备,后面���要根据此处列出的设备端口写具体代码
inst
=
rm
.
open_resource
(
'USB0::0x2A8D::0x0002::MY56013232::0::INSTR'
)
inst
.
write
(
':Voltage 9,(@1);:Current 1,(@1);:output:state on,(@1)'
)
#SCPI语句,设置Channel1电压为9v,状态为开启
out
=
inst
.
query
(
':Measure:Voltage? (@1);:Measure:Current? (@1); :Output:State? (@1)'
)
#读取Ch1的电压电流值和工作状态
print
(
out
)
#输出形式为一串字符串,转换为数据处理需要用python进行字符串处理
volt
=
float
(
inst
.
query
(
':Measure:Voltage? (@1);'
))
curr
=
float
(
inst
.
query
(
':Measure:Current? (@1);'
))
print
(
'volt='
+
str
(
volt
)
+
'
\n
'
+
'current='
+
str
(
curr
))
print
(
'power='
+
str
(
volt
*
curr
))
You can’t perform that action at this time.