VB控制GPIB仪器的方式很简单,
创新互联秉承实现全网价值营销的理念,以专业定制企业官网,成都网站建设、做网站,小程序制作,网页设计制作,手机网站制作,营销型网站帮助传统企业实现“互联网+”转型升级专业定制企业官网,公司注重人才、技术和管理,汇聚了一批优秀的互联网技术人才,对客户都以感恩的心态奉献自己的专业和所长。
1、你得先在你的电脑上安装一块GPIB接口卡,使之成为GPIB主控机,你需要根据你的电脑上安装接口,如果是较老的电脑,上面只有ISA总线,那么我推荐你选择电子科技大学自动化工程学院的ES1400GPIB接口卡或者Agilent公司的HP82335(但这两种接口卡都已停产,能不能找到就要看运气了,而且现在好像都升旁不再提供技术支持了);如果是较新的电脑,上面有USB接口,那我推荐仍然是上面两个地方出的EC1401-2/Agilent82357A型USB-GPIB接口,还有一款NI公司的USB-GPIB接口卡,具体型号我忘记了;
2、硬件装好后,如果是ES1400/HP82335,他们不需要安装驱动软件,直接将接口卡附带的函数库拷入你自己的工程目录下就可直接使用,但需要你的操作系统是WIN2000以下,WIN2000以上由于微软对IO操作进行了一系列封装,它们的函数库是无法正常运作的。如果是EC1401-2/Agilent82357A就简单了,它们闷笑岩都提供了相应的驱动软件,按提示进行安装就可以了;
3、驱动软件安装好后,接下来的程序设计就看自己的了,这些接口卡都提供了各种编程环境下的例程,你可以照葫芦画瓢写自己的,我推荐你使用VB配合NI CVI控件来进蚂御行设计,CVI提供了很多专门为仪器控制设计的控件,做出的程序界面漂亮而且符合仪器使用者习惯;
4、关于价格,ES1400(2600),EC1401-2(3600),HP82335(4300),Agilent82357A(5000以上),这些价格都是我记忆中的,不一定准确;
5、你还得根据你控制的仪器购买相应数目的GPIB接口电缆,电缆分1米、2米两种;
6、当然,也可以像楼上那样,直接用串口进行控制,一般的GPIB仪器都提供了RS232接口
很多有用的工具箱,转载自振动论坛,要赶紧收藏起来,免得过期后不能下载
ADCPtools - acoustic doppler current profiler data processing
AFDesign - designing analog and digital filters
AIRES - automatic integration of reusable embedded software
Air-Sea - air-sea flux estimates in oceanography
Animation - developing scientific animations
ARfit - estimation of parameters and eigenmodes of multivariate autoregressive methods
ARMASA - power spectrum estimation
AR-Toolkit - computer vision tracking
Auditory - auditory models
b4m - interval arithmetic
Bayes Net - inference and learning for directed graphical models
Binaural Modeling - calculating binaural cross-correlograms of sound
Bode Step - design of control systems with maximized feedback
Bootstrap - for resampling, hypothesis testing and confidence interval estimation
BrainStorm - MEG and EEG data visualization and processing
BSTEX - equation viewer
CALFEM - interactive program for teaching the finite element method
Calibr - for calibrating CCD cameras
Camera Calibration
Captain - non-stationary time series analysis and forecasting
CHMMBOX - for coupled hidden Markov modeling using maximum likelihood EM
Classification - supervised and unsupervised classification algorithms
CLOSID
Cluster - for analysis of Gaussian mixture models for data set clustering
Clustering - cluster analysis
ClusterPack - cluster analysis
COLEA - speech analysis
CompEcon - solving problems in economics and finance
Complex - for estimating temporal and spatial signal complexities
Computational Statistics
Coral - seismic waveform analysis
DACE - kriging approximations to computer models
DAIHM - data assimilation in hydrological and hydrodynamic models
Data Visualization
DBT - radar array processing
DDE-BIFTOOL - bifurcation analysis of delay differential equations
Denoise - for removing noise from signals
DiffMan - solving differential equations on manifolds
Dimensional Analysis -
DIPimage - scientific image processing
Direct - Laplace transform inversion via the direct integration method
DirectSD - analysis and design of computer controlled systems with process-oriented models
DMsuite - differentiation matrix suite
DMTTEQ - design and test time domain equalizer design methods
DrawFilt - drawing digital and analog filters
DSFWAV - spline interpolation with Dean wave solutions
DWT - discrete wavelet transforms
EasyKrig
Econometrics
EEGLAB
EigTool - graphical tool for nonsymmetric eigenproblems
EMSC - separating light scattering and absorbance by extended multiplicative signal correction
Engineering Vibration
FastICA - fixed-point algorithm for ICA and projection pursuit
FDC - flight dynamics and control
FDtools - fractional delay filter design
FlexICA - for independent components analysis
FMBPC - fuzzy model-based predictive control
ForWaRD - Fourier-wavelet regularized deconvolution
FracLab - fractal analysis for signal processing
FSBOX - stepwise forward and backward selection of features using linear regression
GABLE - geometric algebra tutorial
GAOT - genetic algorithm optimization
Garch - estimating and diagnosing heteroskedasticity in time series models
GCE Data - managing, analyzing and displaying data and metadata stored using the GCE data structure specification
GCSV - growing cell structure visualization
GEMANOVA - fitting multilinear ANOVA models
Genetic Algorithm
Geodetic - geodetic calculations
GHSOM - growing hierarchical self-organizing map
glmlab - general linear models
GPIB - wrapper for GPIB library from National Instrument
GTM - generative topographic mapping, a model for density modeling and data visualization
GVF - gradient vector flow for finding 3-D object boundaries
HFRadarmap - converts HF radar data from radial current vectors to total vectors
HFRC - importing, processing and manipulating HF radar data
Hilbert - Hilbert transform by the rational eigenfunction expansion method
HMM - hidden Markov models
HMMBOX - for hidden Markov modeling using maximum likelihood EM
HUTear - auditory modeling
ICALAB - signal and image processing using ICA and higher order statistics
Imputation - analysis of incomplete datasets
IPEM - perception based musical analysis
JMatLink - Matlab Java classes
Kalman - Bayesian Kalman filter
Kalman Filter - filtering, smoothing and parameter estimation (using EM) for linear dynamical systems
KALMTOOL - state estimation of nonlinear systems
Kautz - Kautz filter design
Kriging
LDestimate - estimation of scaling exponents
LDPC - low density parity check codes
LISQ - wavelet lifting scheme on quincunx grids
LKER - Laguerre kernel estimation tool
LMAM-OLMAM - Levenberg Marquardt with Adaptive Momentum algorithm for training feedforward neural networks
Low-Field NMR - for exponential fitting, phase correction of quadrature data and slicing
LPSVM - Newton method for LP support vector machine for machine learning problems
LSDPTOOL - robust control system design using the loop shaping design procedure
LS-SVMlab
LSVM - Lagrangian support vector machine for machine learning problems
Lyngby - functional neuroimaging
MARBOX - for multivariate autogressive modeling and cross-spectral estimation
MatArray - analysis of microarray data
Matrix Computation - constructing test matrices, computing matrix factorizations, visualizing matrices, and direct search optimization
[url=]MCAT[/url] - Monte Carlo analysis
MDP - Markov decision processes
MESHPART - graph and mesh partioning methods
MILES - maximum likelihood fitting using ordinary least squares algorithms
MIMO - multidimensional code synthesis
Missing - functions for handling missing data values
M_Map - geographic mapping tools
MODCONS - multi-objective control system design
MOEA - multi-objective evolutionary algorithms
MS - estimation of multiscaling exponents
Multiblock - analysis and regression on several data blocks simultaneously
Multiscale Shape Analysis
Music Analysis - feature extraction from raw audio signals for content-based music retrieval
MWM - multifractal wavelet model
NetCDF
Netlab - neural network algorithms
NiDAQ - data acquisition using the NiDAQ library
NEDM - nonlinear economic dynamic models
NMM - numerical methods in Matlab text
NNCTRL - design and simulation of control systems based on neural networks
NNSYSID - neural net based identification of nonlinear dynamic systems
NSVM - newton support vector machine for solving machine learning problems
NURBS - non-uniform rational B-splines
N-way - analysis of multiway data with multilinear models
OpenFEM - finite element development
PCNN - pulse coupled neural networks
Peruna - signal processing and analysis
PhiVis - probabilistic hierarchical interactive visualization, i.e. functions for visual analysis of multivariate continuous data
Planar Manipulator - simulation of n-DOF planar manipulators
PRTools - pattern recognition
psignifit - testing hyptheses about psychometric functions
PSVM - proximal support vector machine for solving machine learning problems
Psychophysics - vision research
PyrTools - multi-scale image processing
RBF - radial basis function neural networks
RBN - simulation of synchronous and asynchronous random boolean networks
ReBEL - sigma-point Kalman filters
Regression - basic multivariate data analysis and regression
Regularization Tools
Regularization Tools XP
Restore Tools
Robot - robotics functions, e.g. kinematics, dynamics and trajectory generation
Robust Calibration - robust calibration in stats
[url=]RRMT[/url] - rainfall-runoff modelling
SAM - structure and motion
Schwarz-Christoffel - computation of conformal maps to polygonally bounded regions
SDH - smoothed data histogram
SeaGrid - orthogonal grid maker
SEA-MAT - oceanographic analysis
SLS - sparse least squares
SolvOpt - solver for local optimization problems
SOM - self-organizing map
SOSTOOLS - solving sums of squares (SOS) optimization problems
Spatial and Geometric Analysis
Spatial Regression
Spatial Statistics
Spectral Methods
SPM - statistical parametric mapping
SSVM - smooth support vector machine for solving machine learning problems
STATBAG - for linear regression, feature selection, generation of data, and significance testing
StatBox - statistical routines
Statistical Pattern Recognition - pattern recognition methods
Stixbox - statistics
SVM - implements support vector machines
SVM Classifier
Symbolic Robot Dynamics
TEMPLAR - wavelet-based template learning and pattern classification
TextClust - model-based document clustering
TextureSynth - analyzing and synthesizing visual textures
TfMin - continous 3-D minimum time orbit transfer around Earth
Time-Frequency - analyzing non-stationary signals using time-frequency distributions
Tree-Ring - tasks in tree-ring analysis
TSA - uni- and multivariate, stationary and non-stationary time series analysis
TSTOOL - nonlinear time series analysis
T_Tide - harmonic analysis of tides
UTVtools - computing and modifying rank-revealing URV and UTV decompositions
Uvi_Wave - wavelet analysis
varimax - orthogonal rotation of EOFs
VBHMM - variation Bayesian hidden Markov models
VBMFA - variational Bayesian mixtures of factor analyzers
VMT - VRML Molecule Toolbox, for animating results from molecular dynamics experiments
VOICEBOX
VRMLplot - generates interactive VRML 2.0 graphs and animations
VSVtools - computing and modifying symmetric rank-revealing decompositions
WAFO - wave analysis for fatique and oceanography
WarpTB - frequency-warped signal processing
WAVEKIT - wavelet analysis
WaveLab - wavelet analysis
Weeks - Laplace transform inversion via the Weeks method
WetCDF - NetCDF interface
WHMT - wavelet-domain hidden Markov tree models
WInHD - Wavelet-based inverse halftoning via deconvolution
WSCT - weighted sequences clustering toolkit
XMLTree - XML parser
YAADA - analyze single particle mass spectrum data
ZMAP - quantitative seismicity analysis
请参考:
当我把一些旧的VB6项目转变成VS2008时会出现, “Declare”语句中不支持“As Any”的错误说明, 例如在National Instrument中有一个VBib-32.vb中有大量的这样一类的语句:
Declare Function ibcmda32 Lib "Gpib-32.dll" Alias "ibcmda" (ByVal ud AsInteger, ByRef sstr As Any, ByVal cnt As Integer) As Integer
如何办?
有两种办法:
一, 使用具体的参数
例如字符串, 就用string, 那么上面的ByRef as Any, 就写成ByRef as string, 或者
二, 使用特殊说明MarshalAsAttribute
System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.AsAny)
把这段语句放在相应之处, 然后把Any改成祥磨Object, 于是最上面的说明语句滑歼写成谨让斗
Declare Function ibcmda32 Lib "Gpib-32.dll" Alias "ibcmda" (ByVal ud AsInteger, System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.AsAny) ByRef sstr As Object, ByVal cnt As Integer) As Integer
对于ByVal也是一样
Public Declare Function GetPrivateProfileString Lib "kernel32" Alias"GetPrivateProfileStringA" (ByVal lpApplicationName As String, System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.AsAny) ByVal lpKeyName As Object, ByVal lpDefault As String,ByVal lpReturnedString As String, ByVal nSize As Integer, ByVal lpFileName AsString) As Integer
MSDN官方说明, 可以简写成:
Declare Sub SetData Lib "..\LIB\UnmgdLib.dll" ( ByVal x As Short, MarshalAsAttribute(UnmanagedType.AsAny)ByVal o As Object)
这种方法本人实际使用, 可行.
你需要了解硬件和软件问题
1)硬件:你先确认一下,光谱仪和计羡虚算机是通过什么接口兄迹燃来通讯的(例如RS232 RS485 RS422 等)
2)州扰软件:通讯协议(例如Modbus canbus Profibus control-net 等)
或者光谱仪供应商提供驱动程序(DLL动态连接库)
然后再用VB VC 等编程软件来开发你的控制程序