VISA operation

  

VISA operation

VISA operating table

Operating Table:

1, VISA resource template:

viClose (vi): Close-specific dialogue channel.

viGetAttribute (vi, attribute, attrState): access to resources state property value.

viSetAttribute (vi, attribute, attrState): Set the status attribute value of the resource.

viStatusDesc (vi, status, desc): Get Returns the status description string.

viTerminate (vi, degree, jobId): VISA resource request or a termination of the normal operation of all dialogue channels.

viLock (vi, lockType, timeout, requestId, accessKey): set up a resource access mode.

viUnlock (vi): Cancel resource access mode.

viEnableEvent (vi, eventType, mechanism, context): allow specific event notification.

viDisableEvent (vi, eventType, mechanism): do not allow specific event notification.

viDiscardEvents (vi, eventType, mechanism): Refresh on a dialogue channel event occurs.

viWaitOnEvent (vi, ineventTypeList, timeout, outEventType, outContext): wait for the occurrence of a specific event.

viInstallHandler (vi, eventType, handler, userHandle): Installation callback event handler.

viUnInstallHandler (vi, eventType, handler, userHandle): unload callback event handler.

2, VISA Explorer:

viOpenDefaultRM (sesn): Open the default Explorer dialogue channel resources.

viOpen (sesn, rsrcname, accessMode, timeout, vi): open dialogue channel-specific resources.

viFindRsrc (sesn, expr, findList, retcnt, instrDesc): VISA query system resource locator.

viFindNext (findList, instrDesc): return to the previous query to look up resources.

3, instrument control and management:

viRead (vi, buf, count, retCount): read data from the synchronizing device.

viReadAsync (vi, buf, count, jobId): read data from the asynchronous device.

viWrite (vi, buf, count, retCount): synchronously writing the data into the device.

viWriteAsync (vi, buf, count, jobId): The data is asynchronously written into the device.

viAssertTrigger (vi, protocol): a protocol specific hardware or software trigger confirmation.

viReadSTB (vi, status): read the status byte service request.

viClear (vi): removing device.

viSetBuf (vi, mask, size): Set formatted I / O buffer size.

viFlush (vi, mask): manually refresh formatted I / O buffers.

viPrintf (vi, writeFmt, arg1, arg2 ...): according to the set format data transfer device.

viVPrintf (vi, writeFmt, params): according to format transmit data to the device.

viScanf (vi, readFmt, arg1, arg2 ...): read data from the device according to the set format.

viVScanf (vi, readFmt, params): read data from the device according to the set format.

viQuery (vi, writeFmt, readFmt, arg1, arg2 ...): setting the format of the device according to read and write data.

viVQuery (vi, writeFmt, readFmt, params): setting the format of the device according to read and write data.

viIn8 (vi, space, offset, value): read the 8 bits (bytes) from the bus interface unit.

viIn16 (vi, space, offset, value): 16-bit read (word) of data from the bus interface unit.

viIn32 (vi, space, offset, value): 32-bit read (double word) data from the bus interface unit.

 

viOut8 (vi, space, offset, value): 8 write (byte) data to the bus interface unit.

viOut16 (vi, space, offset, value): write 16-bit (word) data to the bus interface unit.

viOut32 (vi, space, offset, value): write 32-bit (double word) data to the bus interface unit.

viMoveIn8 (vi, space, offset, length, buf8): Mobile 8 (byte) unit data from the memory device to the local memory.

viMoveIn16 (vi, space, offset, length, buf8): Mobile 16 (word) from the memory unit data to the local storage device.

viMoveIn32 (vi, space, offset, length, buf8): Mobile 32 (double word) from the memory unit data to the local storage device.

viMoveOut8 (vi, space, offset, length, buf8): Mobile 8 (byte) unit data from the memory to the local storage device.

viMoveOut16 (vi, space, offset, length, buf8): Mobile 16 (word) from the memory unit data to a local storage device.

viMoveOut32 (vi, space, offset, length, buf8): Mobile 32 (double word) from the memory unit data to a local storage device.

viMapAddress (vi, mapSpace, mapBase, mapSize, access, suggested, address): mapped memory space.

viUnMapAddress (vi): cancel the memory map.

viPeek8 (vi, addr, val8): 8-bit data read from a particular address.

viPeek16 (vi, addr, val16): 16-bit data read from a particular address.

viPeek32 (vi, addr, val32): 32-bit data read from a particular address.

viPoke8 (vi, addr, val8): 8-bit data written to a specific address.

viPoke16 (vi, addr, val16): write 16-bit data to a specific address.

viPoke32 (vi, addr, val32): 32-bit write data to a specific address.

viMemAlloc (vi, size, offset): allocate memory from the memory device.

viMemFree (vi, offset): free the memory allocation.

 

 

 

Attribute table:
. 1, the VISA resource templates:
VI_ATTR_MAX_QUEUE_LENGTH any time a particular conversation channel maximum event queue length
VI_ATTR_RM_SESSION Explorer dialogue channel
VI_ATTR_RSRC_IMPL_VERSION resource version
VI_ATTR_RSRC_LOCK_STATE access resource lock mode (into three values listed in the table)
VI_ATTR_RSRC_MANF_ID manufacturer numeral
VI_ATTR_RSRC_MANF_NAME manufacturer name
VI_ATTR_RSRC_NAME resource name
VI_ATTR_RSRC_SPEC_VERSION VISA canonical version of
the private data VI_ATTR_USER_DATA resource-specific dialogue channel used
2, instrument control resources:
General instrument control attribute:
VI_ATTR_INTF_TYPE dialogue channel interface type
VI_ATTR_INTF_NUM interface board number
VI_ATTR_IO_PROT I / O protocol
VI_ATTR_RD_BUF_OPER_MODE read buffer operation mode
if the last byte has END VI_ATTR_SEND_END_EN character
VI_ATTR_SUPPRESS_END_EN prohibit END character
VI_ATTR_TERMCHAR terminator
VI_ATTR_TERMCHAR_EN terminator is allowed
VI_ATTR_TMO_VALUE timeout value
VI_ATTR_TRIG_ID current trigger mechanism
VI_ATTR_WR_BUF_OPER_MODE write buffer operation mode
GPIB instrument control attribute:
VI_ATTR_GPIB_PRIMARY_ADDR GPIB primary address
VI_ATTR_GPIB_SECONDARY GPIB secondary address
_ADDR
VI_ATTR_INTF_PAERNT_NUM GPIB board number
VXI instrument control attribute:
VI_ATTR_MAINFRAME_LA main chassis address
VI_ATTR_MANF_ID VXI device manufacturer identifier
VI_ATTR_MEM_BASE memory group address
VI_ATTR_MEM_SIZE memory size
VI_ATTR_MEM_SPACE memory type
VI_ATTR_MODEL_CODE devices numeral
VI_ATTR_SLOT VXI device slot
VI_ATTR_VXI_LA VXI logical device address
VI_ATTR_CMDR_LA VXI bus controller address
whether the person to be immediate VI_ATTR_IMMEDIATE_SERV
VI_ATTR_FDC_CHNL FDC data transfer channel
VI_ATTR_FDC_GEN_SIGNAL_EN whether to allow the transfer of data through the FDC
VI_ATTR_FDC_MODE FDC model
VI_ATTR_FDC_USE_PAIR one pair or a valid FDC
VI_ATTR_SRC_INCREMENT source offset
VI_ATTR_DEST_INCREMENT target offset
VI_ATTR_WIN_ACCESS current window access mode
VI_ATTR_WIN_BASE_ADDR Bus base address
VI_ATTR_WIN_SIZE current window length
asynchronous serial instrument control attribute:
VI_ATTR_ASRL_AVAIL_NUM byte receive buffer number
VI_ATTR_ASRL_BAUD baud rate
VI_ATTR_ASRL_DATA_BITS data bit
VI_ATTR_ASRL_END_IN mode read operation terminates
VI_ATTR_ASRL_END_OUT terminate the write operation mode
VI_ATTR_ASRL_FLOW_CNTRL flow control
VI_ATTR_ASRL_PARITY test polar
VI_ATTR_ASRL_STOP_BITS stop bit
VI_ATTR_DEST_INCREMENT target offset
VI_ATTR_FDC_CHNL FDC data transfer channel
VI_ATTR_FDC_GEN_SIGNAL_EN whether to allow the transfer of data through the FDC
VI_ATTR_FDC_MODE FDC model
VI_ATTR_FDC_USE_PAIR one pair or a FDC valid
      for the operating properties, usually with viSetAttribute (ViSession / ViEvent / ViFindList vi , ViAttr attribute, ViAttrState attrState) and viGetAttribute (ViSession / ViEvent / ViFindList vi , ViAttr attribute, ViPAttrState attrState) to set the properties of the acquisition, subject property can handle the device type, event type, resource object type, etc., should be treated points. As in Example 3.7 3.6 Example event interrupt subroutine of the main attributes is the type of event.

Event Table:
VI_EVENT_SERVICE_REQ event notification service request
VI_EVENT_VXI_SIGP VXI bus interrupt signal or trigger event
VI_EVENT_TRIG hardware trigger generator
VI_EVENT_IO_COMPLETION asynchronous I / O operation has been completed
event handling sub event queuing event callback mode, the specific embodiment shown in Example 3.4 to 3.7.

Operating Table:
1, VISA resource templates:
viClose (vi): Close-specific dialogue channel.
viGetAttribute (vi, attribute, attrState) : access to resources state property value.
viSetAttribute (vi, attribute, attrState) : Set the status attribute value of the resource.
viStatusDesc (vi, status, desc) : Get Returns the status description string.
viTerminate (vi, degree, jobId) : VISA resource request or a termination of the normal operation of all dialogue channels.
viLock (vi, lockType, timeout, requestId, accessKey): set up a resource access mode.
viUnlock (vi): Cancel resource access mode.
viEnableEvent (vi, eventType, mechanism, context): allow specific event notification.
viDisableEvent (vi, eventType, mechanism) : do not allow specific event notification.
viDiscardEvents (vi, eventType, mechanism) : Refresh on a dialogue channel event occurs.
viWaitOnEvent (vi, ineventTypeList, timeout, outEventType, outContext): wait for the occurrence of a specific event.
viInstallHandler (vi, eventType, handler, userHandle): Installation callback event handler.
viUnInstallHandler (vi, eventType, handler, userHandle): unload callback event handler.
2, VISA Explorer:
viOpenDefaultRM (SESN): Open the default Explorer dialogue channel resources.
viOpen (sesn, rsrcname, accessMode, timeout, vi): open dialogue channel-specific resources.
viFindRsrc (sesn, expr, findList, retcnt, instrDesc): VISA query system resource locator.
viFindNext (findList, instrDesc): return to the previous query to look up resources.
3, the control management Instrument:
Viread (VI, buf, COUNT, retCount): read data from the synchronizing device.
viReadAsync (vi, buf, count, jobId): read data from the asynchronous device.
viWrite (vi, buf, count, retCount): synchronously writing the data into the device.
viWriteAsync (vi, buf, count, jobId): The data is asynchronously written into the device.
viAssertTrigger (vi, protocol): a protocol specific hardware or software trigger confirmation.
viReadSTB (vi, status): read the status byte service request.
viClear (vi): removing device.
viSetBuf (vi, mask, size) : Set formatted I / O buffer size.
viFlush (vi, mask): manually refresh formatted I / O buffers.
viPrintf (vi, writeFmt, arg1, arg2 ...): according to the set format data transfer device.
viVPrintf (vi, writeFmt, params) : according to format transmit data to the device.
viScanf (vi, readFmt, arg1, arg2 ...): read data from the device according to the set format.
viVScanf (vi, readFmt, params) : read data from the device according to the set format.
viQuery (vi, writeFmt, readFmt, arg1, arg2 ...): setting the format of the device according to read and write data.
viVQuery (vi, writeFmt, readFmt, params): setting the format of the device according to read and write data.
viIn8 (vi, space, offset, value): read the 8 bits (bytes) from the bus interface unit.
viIn16 (vi, space, offset, value): 16-bit read (word) of data from the bus interface unit.
viIn32 (vi, space, offset, value): 32-bit read (double word) data from the bus interface unit.

viOut8 (vi, space, offset, value): 8 write (byte) data to the bus interface unit.
viOut16 (vi, space, offset, value): write 16-bit (word) data to the bus interface unit.
viOut32 (vi, space, offset, value): write 32-bit (double word) data to the bus interface unit.


viMoveIn8 (vi, space, offset, length, buf8): Mobile 8 (byte) unit data from the memory device to the local memory.
viMoveIn16 (vi, space, offset, length, buf8): Mobile 16 (word) from the memory unit data to the local storage device.
viMoveIn32 (vi, space, offset, length, buf8): Mobile 32 (double word) from the memory unit data to the local storage device.
viMoveOut8 (vi, space, offset, length, buf8): Mobile 8 (byte) unit data from the memory to the local storage device.
viMoveOut16 (vi, space, offset, length, buf8): Mobile 16 (word) from the memory unit data to a local storage device.
viMoveOut32 (vi, space, offset, length, buf8): Mobile 32 (double word) from the memory unit data to a local storage device.
viMapAddress (vi, mapSpace, mapBase, mapSize, access, suggested, address): mapped memory space.
viUnMapAddress (vi): cancel the memory map.
viPeek8 (vi, addr, val8) : 8-bit data read from a particular address.
viPeek16 (vi, addr, val16) : 16-bit data read from a particular address.
viPeek32 (vi, addr, val32) : 32-bit data read from a particular address.
viPoke8 (vi, addr, val8) : 8-bit data written to a specific address.
viPoke16 (vi, addr, val16) : write 16-bit data to a specific address.
viPoke32 (vi, addr, val32) : 32-bit write data to a specific address.
viMemAlloc (vi, size, offset) : allocate memory from the memory device.
viMemFree (vi, offset): free the memory allocation.
       In operation function sequence VISA definition, only a small part VISA specification, but there are some operating functions and not defined in the VISA specification, belonging to the own supplementary definition of software, such as opening a resource manager function viOpenDefaultRM () function Instrument System for call initialization, system resource management apparatus in association with the VISA software; viStatusDesc () function is called after the function call returns VISA, and the call returns a value of the previous input parameters as a function of VISA, acquiring a string of state description; viFindNext () function is a complementary viFindRsrc () function, VISA system resources for search; viMemAlloc () function and viMemFree () function is a memory device for memory operations. For VISA specification VISA instrument control resource organization and VISA particular interface for instrument control operation of resource definition, VISA1.1 are not defined in, which also provides direction for the future development of VISA software. You can see, the application VISA1.1 function, you can achieve the basic instrument system programming requirements, but for a particular operation, still need further expansion, VISA software itself is a continuous improvement and development of the product. If you want to modify and develop software VISA, VISA norms must be followed, and the development model based on VISA

 

 

 

Three, VISA (VPP-4)
VISA: Virtual the Instrumentation Software Architecture, namely Virtual Instrument Software Architecture, is the general term VPP system established by the Alliance of I / O interface software standards and related specifications.
VISA provides a standardized I / O interface software specifications for the virtual instrument. VISA is a uniform basis for the entire software industry.
Virtual Instrument Software Architecture of standard I / O interface software called VISA library.
1. VISA role of
providing a uniform basis for the entire software industry
for drivers, applications, regardless of interface type
only provides standard functions to users, not to achieve any specific instructions
for writing instrument drivers meet the VPP specification, to complete the command and data transfer between the computer and the instrument, to achieve control of the instrument.
VISA library as a low-level I / O interface software that runs on a computer system.
2. VISA characteristics
suitable for various types of equipment: VXI, PXI, GPIB, RS -232, TCP, USB ... ...
and hardware-independent interfaces
for both single- processor architecture but also for multi-processor or a distributed architecture
for multi kinds of network mechanisms
3. VISA library functions
resource management function
viOpenDefaultRM (ViPSession Rsrc_Manager_Handle);
viOpenDefaultRM (& defaultRMHandle);
ViStatus viOpen (ViSession Rsrc_Manager_Handle, ViRsrc Instrument_Descriptor, ViAccessMode Access_Mode, ViUInt32 Open_Timeout, ViPSession Instrument_Handle);
viOpen (defaultRMHandle, "VXI0::24::INSTR", VI_NULL, VI_NULL, &dmmHandle);
ViStatus viClose (ViSession Session_Handle);
viClose(dmmHandle);

Resource operation type function
register group instrument communication
viIn8, viIn16, viIn32
viIn16 (dmmHandle, VI_A16_SPACE, 0, & manufactureID);
viOut8, viOut16, viOut32
viOut16 (dmmHandle, VI_A16_SPACE,. 4, 0);
message-based instrument communication
Viread, viWrite
Viread (dmmHandle , ReadBuf, 100, & COUNT);
viWrite (dmmHandle, writebuf, 100, & COUNT);
formatting the I / O
viPrintf, viScanf
viPrintf (dmmHandle, "* the IDN \ n-?"); 
viScanf (dmmHandle, "% T", Result );


Resource template
event processing
viEnableEvent, viDisableEvent
viInstallHandler, viUninstallHandler
viWaitOnEvent
resource properties
viGetAttribute, viSetAttribute

VISA function of step operation of the instrument
to open the VISA Explorer handle used by the function: viOpenDefaultRM;
on the instrument handle, used by the function: viFindRsrc, viFindNext, viOpen like;
setting instrument status, the operation control apparatus, reading the measurement data , event processing machines, used by the function: viGetAttribute, viSetAttribute, viIn16, viOut16 , viPrintf, viScanf, viInstallHandler, viUninstallHandler, viEnableEvent, viDisableEvent, viWaitOnEvent etc;
release instrument handles, used function: viClose;
release VISA Explorer handles, function used: viClose.

VISA functions Application Example
void main (void)
{
  error = viOpenDefaultRM (& rsrcManager); / * Open VISA Explorer * /
  // rsrcManager as VISA resource manager handles obtained
  if (error = VI_SUCCESS!) / * If an error occurs, the popup error message dialog box, return * /
  {MessagePopup ( "error", "the Open the VISA the Resource Manager error!");
   return;
  }
  error = viOpen (rsrcManager, "VXI0 :: 16 :: INSTR", VI_NULL, VI_NULL, & instHandle) ; // instHandle to get a handle of the instrument

  IF (! error = VI_SUCCESS) { 
   MessagePopup ( "Error", "the Open Instrument Error!");
   return;
  }
  the else {/ * Get the instrument module code, provided the instrument operation timeout to 2000 ms * /
   viGetAttribute (instHandle, VI_ATTR_MODEL_CODE, the moduleID &); viSetAttribute (instHandle, VI_ATTR_TMO_VALUE, 2000);
  }
  viClose (instHandle); / * Close the instrument handle and the resource manager VISA * /
  viClose (rsrcManager);
}

Guess you like

Origin blog.csdn.net/thanklife/article/details/87865336