litepoint python SCPI通信

litepoint IQXEL80 使用Ctype 与仪器键实现scpi通信

from ctypes import *

iq = cdll.LoadLibrary(r"IQmeasure.dll")

# how to using logger for test iqmeasure
# test iqmeasure_scpi test command
#


# 调用方法
init_result = iq.LP_Init(c_int(1), c_int(1)) #SCPI
print('init_result:', init_result)  # init_result: 0
# 该方法中,返回0为成功
# 原C++文档中,该方法如下:
# int LP_Init(int IQtype = IQTYPE_XEL,int testerControlMethod = 1);
# 有返回值
# 设置返回值类型


# iq.LP_GetErrorString.restype = c_char_p
# # # 设置初始值类型
# iq.LP_GetErrorString.argtypes = [c_int]
# msg = iq.LP_GetErrorString(c_int(10))
# print(msg)  # b'Invalid analysis type'
# # # 转换为string
# str_msg = msg.decode("utf-8")
# print(str_msg)  # VSA number is out of range. Try 1-4.
# 原C++文档中,该方法如下:
# char* LP_GetErrorString(int err)
ip = b"192.168.10.250"
rc = iq.LP_InitTester(c_char_p(ip))
print(rc)
print("LP_InitTesterN")
# 参数值为*类型
# 使用byref(),包装对应类型即可
# iq.LP_SetTesterMode(c_int(0), byref(c_int(1)), c_int(1))
# 原C++文档中,该方法如下:
# int LP_SetTesterMode( int signalMode = UP_TO_80MHZ_SIGNAL, int *selectedModules = NULL, int numOfSelectedModules = 1 );

version = create_string_buffer(255)
# print("get ver", version)
rc = iq.LP_GetVersion(version, 255)
version_result = version.value.decode("utf-8")
print("get ver",version_result)
 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值