node-ni-visa
v0.5.0
Published
Node.js module for NI-VISA (Virtual Instrument Software Architecture) library.
Downloads
28
Readme
Node NI-VISA
Node.js module for NI-VISA (Virtual Instrument Software Architecture) library.
Calling dynamic link libraries via Koffi.
Free commercial use, welcome to contribute.
Installation
Install NI-VISA runtime
Download and install NI-VISA runtime library.
Install node-ni-visa
# NPM
npm install node-ni-visa
# Yarn
yarn add node-ni-visa
# PNPM
pnpm install node-ni-visa
Usage
import * as NiVisa from 'node-ni-visa'
// Initialization NI-VISA driver
const driverSession = NiVisa.viOpenDefaultRM()
// Open VXI11 device communication session
const deviceSession = NiVisa.viOpen(driverSession, 'TCPIP0::192.168.10.100::inst0::INSTR')
// Write and read by SCPI
console.log('Write result:', NiVisa.viWrite(deviceSession, '*IDN?\n'))
console.log('Read result:', NiVisa.viRead(deviceSession))
// Query by SCPI
const queryMessage = '*IDN?\n'
console.log(`Query '${queryMessage}' -> '${NiVisa.query(deviceSession, queryMessage)}'`)
// Close device communication session
NiVisa.viClose(deviceSession)
// Close NI-VISA driver
NiVisa.viClose(driverSession)
Supported NI-VISA API
- viOpenDefaultRM
- viOpen
- viClose
- viWrite
- viRead
License
MIT
Thanks
Some NI-VISA API parameters refer to Peter Torelli's ni-visa project.