pgzzVISA

package module
v0.0.0-...-14ff998 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 9, 2021 License: GPL-2.0 Imports: 3 Imported by: 0

README

pgzz

golang通过VISA32.dll实现仪表搜索、仪表设置和数据读取(GPIB/TCPIP),在是德科技的USB2GPIB卡测试有效。包含包和使用示例。

Documentation

Overview

开发者:海格通信---廖晓鹏 仪表查询与读写示例: 实际仪表操作中,查询与读写已可满足99%的业务需求。 实现方式很多,该示例采用调用VISA32.DLL动态函数库方式实现,应该是目前比较简单易用的实现方案。虽简单,但实际功效应该是一样的。 之前使用C.CString来传递参数(详见visa.go.bak),总感觉不太舒服,后更改为目前的方式。 API说明详见IO Libraries Suite自带文档Visa.chm

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bytes2string

func Bytes2string(data [256]byte) string

返回的数据后面有很多个0,截断处理会更好些。

func ClearFindList

func ClearFindList() uintptr

清除数据?

func CloseRM

func CloseRM() uintptr

关闭设备管理器

func FindRsrc

func FindRsrc() bool

查找仪表清单,并打印输出。 有时候刷新到旧的数据,看IO Libraries Suite也是一样的,断开后仍然有上一次的数据,只不过是错的。 关闭了仍然有信息。有可能需要调用viClear(ViSession vi); ----> Clear a device. This operation performs an IEEE 488.1-style clear of the device. 错误代码详见Visa.chm

func OpenRM

func OpenRM() uintptr

ret如果不为0,则连接失败,ret为缺陷代码。 打开设备管理器。类似初始化。

func ReadData

func ReadData(addr, m string) string

发送信息给仪表,并等待仪表返回数据。

func SendMsg

func SendMsg(addr, m string) string

发送信息给仪表 addr为仪器地址,m为需要发送的信息,如GPIB0::15::INSTR,send:DISP TX

Types

type MyString

type MyString struct {
	// Str *C.char	//完全不需要使用CGO。
	Str unsafe.Pointer
	Len int
}

新建类型,代替C.CString C.CString使用会产生拷贝,而且内存不会自动释放,需要进行free。

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL