Virtual Instrument System I/O interface software--visa (2)

Source: Internet
Author: User
Tags error code

3.3.2 Visa Resource Manager Resources

The Visa Resource Manager (VI_RSRC_VISA_RM) is the intermediate scheduler for visa resources, which plays an important role in working with all of the visa subsystem components throughout the system. The basic features of the resource Manager include:

1) Assigning resource addresses

2) Assign Resource identification number (ID)

3) Make an action call

4) Event Management

Figure 3.3 shows the central scheduling role of Visa Explorer in System configuration.

Figure 3.3 A diagram of the relationship between Visa Explorer and other resources

According to the visa specification, the Visa Explorer resource inherits all the attributes, events, and actions defined by the resource template and does not extend its own properties, events, and operations on the resource template itself. However, resource manager resources have their own semantics, which plays the role of root resources in the system resources.

3.3.3 Visa Instrument Control resources

Based on the visa resource template, Visa Instrument control resources define the properties, events, and operations that are unique to the instrument control. The functions defined in the Instrument Control resource are general instrument functions and are suitable for various instrument types.

Visa instrument control resources include:

N Write Resources

N Read Resources

n formatting I/O resources

N Trigger Resource

n Status/Service Request resource

N Cleanup Resources

N Advanced Access Resources

N Low-level access resources

n Device-specific command resources

N CPU Interface Resources

Visa instruments Control the relationship of each resource as shown in Figure 3.4.

Figure 3.4 Visa Instrument Control Resource Relationship Overview

In the visa instrument control resources, the CPU interface resource is relatively independent, and it has no internal connection with other instrument control resources. This is not to say that the CPU interface resources can not be called with other resources, but it can not invoke other instruments to control the operation of resources, nor can other instrument control resources to invoke its related operations. While the operations of formatting I/O resources are dependent on write resources and read resource operations, there is an internal correlation between them. Similarly, there is an internal correlation between advanced access resources and low-level access resources, triggering resources, State/Service request resources, and clearing resources and device-specific command resources.

N Write Resources (VI_RSRC_WR):

1. Resources Overview: The controller transmits arbitrary blocks of data to the device, which can interpret the received data blocks as messages, commands, or binary encoded data.

2. Resource attribute table and attribute description:

Property name Description

Vi_attr_fdc_access_mode FDC (high-speed data channel) buffer access mode

Vi_attr_fdc1_supp FDC version 1 is valid

Vi_attr_fdc2_supp FDC version 2 is valid

VI_ATTR_FDC_CHNL FDC Data Transfer channel

Vi_attr_fdc_gen_signal_en whether data is allowed to be transmitted via FDC

Vi_attr_fdc_mode FDC Mode

Vi_attr_fdc_use_pair a pair or an FDC is valid

Vi_attr_fdc_use_ver FDC Protocol version

Vi_attr_inp_rdy_notify_en whether data is valid for notification

Whether the Vi_attr_nrdy_abort_en device is notified when it is no longer receiving data

VI_ATTR_PHYS_ADDR Device Address

Vi_attr_repeat_addr_en whether to use duplicate addresses

Vi_attr_send_end_on whether the Terminator is confirmed

_termchar_en

Vi_attr_send_end_on whether end is the terminating character

Vi_attr_termchar Terminator

Vi_attr_tmo_unit Timeout Unit

Vi_attr_tmo_value Timeout value

Vi_attr_transfer_mech transfer mechanism (DMA or PIO)

Vi_attr_wr_prot Transfer Protocol

Vi_attr_cmdr_serv Master-Slave mode

Vi_attr_asrl_baud baud Rate

Vi_attr_asrl_data_bits Data bits

Vi_attr_asrl_parity Check Polarity

Vi_attr_asrl_stop_bits Stop Bit

Vi_attr_asrl_flow_cntrl Data Flow control status

3. The event that writes the resource definition is as follows:

Event description

Vi_event_io_completion asynchronous I/O operation completed

4. Write the resource definition operation as follows:

Viwrite (Vi,buf,count,retcount)

Viwriteasync (Vi,buf,count,jobid)

Viwritestatus (Vi,jobid,jobstatus)

4.1. Viwrite (Vi,buf,count,retcount)

1) Target: Synchronously write data to the device

2) Parameter table:

Parameter name input/output direction data type description

VI Input Visession Dialog channel identifier (handle)

BUF input VIBUF Data Block location

Count input ViUInt32 number of bytes written

Retcount output ViPUInt32 Actual bytes transferred

3) Return the status value:

Complete the Code:

Vi_success Synchronous write operation completed

Vi_warn_nrdy_abort Synchronous write operation exits, device is not ready to input data.

Error code:

Vi_error_inv_session VI cannot identify the proper channel of conversation

Vi_error_rsrc_locked Access lock mode does not support specific operations

Vi_error_tmo Timeout Error

Vi_error_raw_wr_prot the write protocol is compromised when transmitting

_viol

Vi_error_raw_rd_prot read protocol is corrupted when transmitting

_viol

Vi_error_outp_prot_viol output protocol error when transmitting

Vi_error_inp_prot_viol input protocol error during transfer

Vi_error_berr Bus Error when transmitting

User exits when Vi_error_abort is transferred

Vi_error_in_progress Synchronous Write executed

Vi_error_inv_setup setting error, unable to start write operation

4) Description: This operation writes data in BUF to the device, and any write resource channel can only log on to a synchronous write operation.

5) Related items: see Viwriteasync (), Viterminate (), Viwritestatus (), Viread (), Vireadasync ().

6) Implementation requirements: None.

4.2. Viwriteasync (Vi,buf,count,jobid)

1) Target: Asynchronously writes data to the device

2) Parameter table:

Parameter name input/output direction data type description

VI Input Visession Dialog channel identifier (handle)

BUF input VIBUF Data Block location

Count input ViUInt32 number of bytes written

JobId output vipjobid Asynchronous write job identifier

3) Return the status value:

Complete the Code:

Vi_success Asynchronous write operation completed

Error code:

Vi_error_inv_session VI cannot identify the proper channel of conversation

Vi_error_rsrc_locked Access lock mode does not support specific operations

Vi_error_queue_error cannot be queued for write operations

4) Description: This operation asynchronously writes the data in the BUF to the device, and any write resource channel can log on to multiple asynchronous write operations for queued processing.

5) Related items: see Viwrite (), Viterminate (), Viwritestatus (), Viread (), Vireadasync ().

6) Implementation requirements: None.

4.3. Viwritestatus (vi,jobid,jobstatus)

1) Target: Get write operation status

2) Parameter table:

Parameter name input/output direction data type description

VI Input Visession Dialog channel identifier (handle)

JobId input vijobid Write job identifier

Jobstatus output Vipjobstatus write operation status

3) Return the status value:

Complete the Code:

Vi_success Status Get Completed

Error code:

Vi_error_inv_session VI cannot identify the proper channel of conversation

Vi_error_rsrc_locked Access lock mode does not support specific operations

Improper Vi_error_inv_jobid Job Identifier

4) Description: When the operation is synchronous, the identifier is uniquely determined, is vi_sync, and when the operation is asynchronous, the identifier is the output parameter value of the operation.

5) Related items: See Viwriteasync ().

6) Implementation requirements: None.

N Read resources (VI_RSRC_RD):

1. Resources Overview: The controller reads any block of data from the device, and the controller interprets the received data block as a message, command, or binary encoded data.

2. Resource attribute table and attribute description:

Property name Description

Vi_attr_fdc_access_mode FDC (high-speed data channel) buffer access mode

Vi_attr_fdc1_avail FDC version 1 is valid

Vi_attr_fdc2_avail FDC version 2 is valid

VI_ATTR_FDC_CHNL FDC Data Transfer channel

Vi_attr_fdc_gen_signal_en whether data is allowed to be transmitted via FDC

Vi_attr_fdc_mode FDC Mode

Vi_attr_fdc_use_pair a pair or an FDC is valid

Vi_attr_fdc_use_ver FDC Protocol version

VI_ATTR_PHYS_ADDR Device Address

VI_ATTR_7_8_BIT_CMP Terminator Valid bit

Whether the Vi_attr_nrdy_abort_en device is notified when data is no longer being output

Vi_attr_outp_rdy_notify_en whether data is valid for notification

Vi_attr_rd_prot Transfer Protocol

Vi_attr_repeat_addr_en whether to use duplicate addresses

Vi_attr_suppress_end_on whether the Terminator is forbidden

Vi_attr_termchar Terminator

Vi_attr_termchar_en whether the Terminator is allowed

Vi_attr_tmo_unit Timeout Unit

Vi_attr_tmo_value Timeout value

Vi_attr_transfer_mech transfer mechanism (DMA or PIO)

Vi_attr_cmdr_serv Master-Slave mode

Vi_attr_asrl_baud baud Rate

Vi_attr_asrl_data_bits Data bits

Vi_attr_asrl_parity Check Polarity

Vi_attr_asrl_stop_bits Stop Bit

Vi_attr_asrl_flow_cntrl Data Flow control status

3. The events defined by the read resource are as follows:

Event description

Vi_event_io_completion asynchronous I/O operation completed

4. Read the resource definition operation as follows:

Viread (Vi,buf,count,retcount)

Vireadasync (Vi,buf,count,jobid)

Vireadstatus (Vi,jobid,jobstatus)

4.1. Viread (Vi,buf,count,retcount)

1) Target: Read data synchronously from device

2) Parameter table:

Parameter name input/output direction data type description

VI Input Visession Dialog channel identifier (handle)

BUF output VIBUF Data block location

Count input ViUInt32 bytes read out

Retcount output ViPUInt32 Actual bytes transferred

3) Return the status value:

Complete the Code:

Vi_success Synchronous Read Data completion

Vi_success_term_char a specific terminator is read

Vi_success_max_cnt reads the same number of bytes as Count

Vi_warn_nrdy_abort transmit exit, device is not ready to output data.

Error code:

Vi_error_inv_session VI cannot identify the proper channel of conversation

Vi_error_rsrc_locked Access lock mode does not support specific operations

Vi_error_tmo Timeout Error

Vi_error_raw_wr_prot the write protocol is compromised when transmitting

_viol

Vi_error_raw_rd_prot read protocol is corrupted when transmitting

_viol

Vi_error_outp_prot_viol output protocol error when transmitting

Vi_error_inp_prot_viol input protocol error during transfer

Vi_error_berr Bus Error when transmitting

User exits when Vi_error_abort is transferred

Vi_error_in_progress Synchronous Write executed

Vi_error_inv_setup setting error, unable to start write operation

4) Description: This operation will put the value read from the device in buf, any read resource channel can only log in to a synchronous read operation.

5) Related items: see Viwriteasync (), Viterminate (), Viwritestatus (), Vireadasync (), Vireadstatus ().

6) Implementation requirements: When one or more of the following three conditions are met, the read operation is considered complete: one is the end label is read, the other is the specific terminator is read, and the third is the same number of bytes to be read.

4.2. Vireadasync (Vi,buf,count,jobid)

1) Target: Read data asynchronously from the device

2) Parameter table:

Parameter name input/output direction data type description

VI Input Visession Dialog channel identifier (handle)

BUF output VIBUF Data block location

Count input ViUInt32 bytes read out

JobId output vipjobid Asynchronous read operation job identifier

3) Return the status value:

Complete the Code:

Vi_success asynchronous read operation completed

Error code:

Vi_error_inv_session VI cannot identify the proper channel of conversation

Vi_error_rsrc_locked Access lock mode does not support specific operations

Vi_error_queue_error cannot be queued for read operations

4) Description: This operation will put the data read from the device in the BUF, any read resource channel can log on multiple asynchronous read operations, queued processing.

5) Related items: see Viwrite (), Viterminate (), Viwriteasync (), Viread (), Vireadstatus ().

6) Implementation requirements: None.

4.3. Vireadstatus (vi,jobid,jobstatus)

1) Target: Get read operation status

2) Parameter table:

Parameter name input/output direction data type description

VI Input Visession Dialog channel identifier (handle)

JobId input Vijobid read operation job identifier

Jobstatus output Vipjobstatus read operation status

3) Return the status value:

Complete the Code:

Vi_success Status Get Completed

Error code:

Vi_error_inv_session VI cannot identify the proper channel of conversation

Vi_error_rsrc_locked Access lock mode does not support specific operations

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.