Google

main
dspblog
cyclic_signals
FFT_interpolation
FFT_interpolation_how_does_it_work
FFT_smoothness_cyclic
discrete_time_reconstruction
discrete_time_reconstruction2
Nyquist_on_the_edge
FFT_delay_special_case
Fourier_reconstruction
pulse_and_Nyquist
FFT_complexError
matlabOctave
matlab_upsampling
matlab_downsampling
FFT_delay
FFT_filter_example
FFT_interpolation_example
FFT_bin_frequencies
fit_signal
FFT_peaksearch_audio_example
matlab_binary_readwrite
Octavesvg
C
FFTW_example
looprecord
SNR
SNR3
SNR_example_96kAudio
SNR_FFT_correlation_example
lua
luagpib
luasplit
luadump
mnoofltk
wxLuaDll
wxLua_loadAsDll
wxLua_HelloWorld
wxLua_simpleButton
wxLua_resourceManagement
wxLua_XMLparser
DSP
IQ_LO
IQ_LO_2
optimum_receiver
DSP_basics
sampleRateChange_terms
dirac_pulse
freqresp_s
zfilter_example
freqresp_z
freqresp_z_sign
misc
zero_forcing_equalizer_example
nonminphase_inverse
periodic_spectrum
lagrange_multipliers
Entropy
RC_chopper
TRex450_setup
EP100
EP100SE
EP100Gremlins
essential_spares
tail_rotor
motoradjustment
blade_balancing
blade_repair
GAUI_SAE12A
Walkera43


valid html (click to verify)



prevupnextdisable ads

luagpib

Overview

A library for the lua programming language to access measurement instruments via the GPIB bus.
The package contains a compiled lua interpreter. It does not require any other software besides an installed GPIB card supporting the NI488 standard.

Example


-- ***************************************************************
-- * Load GPIB dll interface
-- ***************************************************************   
require('gpib_libloader')

-- ***************************************************************
-- * Query *IDN? response
-- ***************************************************************   
local h=ibdev(0, 19) -- board 0 addr 19
ibwrt(h, "*IDN?")
print(gpib.ibrd(h))

-- ***************************************************************
-- * Clean up
-- ***************************************************************   
ibloc(h) -- return local control
ibonl(h, 0) -- close instrument connection
gpib.shutdown() -- unload DLL

Download the example here

Download

Download the whole package here (contains executable and source)

Using luagpib

A lua interpreter is included in the bin directory.
Run it from the command line, and give for example the test.lua program as a 2nd argument:

When no GPIB card is found, an error message as shown results.
If the necessary drivers are not found, there will be a different error about a missing DLL.

Reference

A good description of the gpib functions can be found from the linux-GPIB documentation.
At least Agilent and National Instruments cards are shipped with a command reference in the software package.
  • ibdev(pad, sad)
  • ibwrt(ud, str)
  • ibrd(ud)
  • ibrdn(ud, len) Reads exactly n bytes
  • iberr() Returns content of iberr
  • ibsta() Returns table with contents of ibsta register
  • ibonl(ud, a)
  • ibloc(ud, a)
  • shutdown() Releases the dll
  • sleep(x) Delays execution for x ms

compiling luagpib

Luagpib is compiled using Mingw on Windows.
From the command line, type

make clean
make

By default it compiles against the included lua 5.1 interpreter.
It also works with wxlua, if the lua dll and the headers are replaced with their wxLua counterparts.


prevupnextdisable ads

© Markus Nentwig 2007-2008
The content of this page is provided without any warranty and may not be reproduced without permission.

Comments? Questions?

Please send me a mail! mnentwig@elisanet.fi