MSP - 05 - InstrDriv Debugg SemProj 20180312

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 32

MSP přednáška 5

Přístrojové ovadače v CVI, zadání sem.projektu


Přístrojové ovladače
www.ni.com/idnet
Ladicí nástroje

doc. Ing. Petr Bilík, Ph.D., katedra 450, FEI, VŠB-TU Ostrava
Knihovna, Strom fcí, Fční panel
• Knihovny jsou umístěny ve složce Libraries
• Strom fcí je uložen na disku *.fp
• Pro hierarchický pohled na knihovnu existují „Classes“

doc. Ing. Petr Bilík, Ph.D., katedra 450, FEI, VŠB-TU Ostrava
Knihovny
• Standartní funkce a
knihovny jazyka C a
knihovny dodávané
se CVI jsou umístěny
ve složce Libraries
• Seznam dostupných
knihoven je možné
upravit pomocí volby
z kontextového menu
Customize Library
Menu

doc. Ing. Petr Bilík, Ph.D., katedra 450, FEI, VŠB-TU Ostrava
Instruments
• Obsahuje stromy funkcí všech knihoven a
přístrojových ovladačů, které byly během spuštění
CVI otevřeny a nahrány do paměti
• Strom funkcí je možné do složky Instruments
přidat prostřednictvím nabídky z menu Instruments
-> Load, nebo přímo otevřením fp souboru.

doc. Ing. Petr Bilík, Ph.D., katedra 450, FEI, VŠB-TU Ostrava
Virtual Instrument Software Architecture (VISA)

VISA

Serial GPIB USB Ethernet PXI

• Platform independent • Interface independent


• Must know SCPI command set to
• VISA is the backbone of the IVI program directly with VISA
and VXIplug&play instrument
drivers

doc. Ing. Petr Bilík, Ph.D., katedra 450, FEI, VŠB-TU Ostrava
VISA terminologie

• Resource—Instrument, serial port, or parallel port


• Session—Connection to a resource (comm channel)
• Instrument Descriptor—Resource location
– Format: Interface Type::Address::INSTR
– Examples:

doc. Ing. Petr Bilík, Ph.D., katedra 450, FEI, VŠB-TU Ostrava
VISA Resource Name

• Contains interface information


• Use a VISA alias to give an instrument a meaningful
name
Interface Resource Name Grammar
Serial ASRL[board][::INSTR]

GPIB GPIB[board]::primary address[::INSTR]

VXI VXI[board]::VXI logical address [::INSTR]

PXI PXI[bus]::device[::function][::INSTR]

GPIB-VXI GPIB-VXI[board][::GPIB-VXI primary


address]::VXI logical address[::INSTR]

doc. Ing. Petr Bilík, Ph.D., katedra 450, FEI, VŠB-TU Ostrava
Communicating with VISA

doc. Ing. Petr Bilík, Ph.D., katedra 450, FEI, VŠB-TU Ostrava
Instrument Driver Model

doc. Ing. Petr Bilík, Ph.D., katedra 450, FEI, VŠB-TU Ostrava
Instrument Driver Component Functions
(cont.)
• Initialize—Initialize software connection to
instrument
• Configure—Configure instrument
• Action/Status—Initiate/terminate operations and
obtain status information

doc. Ing. Petr Bilík, Ph.D., katedra 450, FEI, VŠB-TU Ostrava
Instrument Driver Component Functions
(cont.)
• Measurement—Transfer data to or from instrument
• Utility—Perform variety of operations
• Close—Terminate software connection and free the
resources
• Attribute—Manage instrument attribute values and
states

doc. Ing. Petr Bilík, Ph.D., katedra 450, FEI, VŠB-TU Ostrava
Instrument Drivers

What is an Instrument Driver?


• Collection of functions
• Organized as a separate module
– .c
– .lib
– .obj
– .dll
• Function panel (.fp) front end

doc. Ing. Petr Bilík, Ph.D., katedra 450, FEI, VŠB-TU Ostrava
Instrument Driver Files
Files must reside in the same directory
1. Source code.c, .obj, 1. Documentation files—.doc,
.dll, .lib .html
2. Include file.h 2. Attribute file.sub (IVI)
3. Function panels.fp

doc. Ing. Petr Bilík, Ph.D., katedra 450, FEI, VŠB-TU Ostrava
Instrument Driver Files (cont.)
Instrument Driver
Include File
Function Instname.h
Panels
Attach
Source Code
Instname.fp
Instname.c
Instname.subIVI
(Instname.obj)
Integrated Help (Instname.dll)
Instname.doc (Instname.lib)
Instname.html

doc. Ing. Petr Bilík, Ph.D., katedra 450, FEI, VŠB-TU Ostrava
Instruments – přístrojové ovladače
• Přístrojový ovladač – co to je?
• www.ni.com/idnet (Hewlett-Packard 34401A Multimeter)
• Přidání / odstranění přístr. Ovladače
• Struktura souborů a helpy
• Příklady

doc. Ing. Petr Bilík, Ph.D., katedra 450, FEI, VŠB-TU Ostrava
Instrument Driver Network (IDNET)

• Learn about drivers


• Get help with developing drivers
• Submit your driver to the network
• Download drivers
– NI Instrument Driver Library
– Alliance/Vendor supported
– Contributed library
– www.ni.com/downloads/instrument-
drivers
doc. Ing. Petr Bilík, Ph.D., katedra 450, FEI, VŠB-TU Ostrava
Loading an Instrument Driver

• Load instrument driver in the Library Tree prior to


use.
• Load an instrument driver in one of the following
ways:
– Right-click the Instruments folder in the Library Tree and
select Load Instrument.
– Select Instrument»Load from the menu bar.
– Add a function panel from the instrument driver to your
project. (recommended)

doc. Ing. Petr Bilík, Ph.D., katedra 450, FEI, VŠB-TU Ostrava
Instrument Driver Function Tree

doc. Ing. Petr Bilík, Ph.D., katedra 450, FEI, VŠB-TU Ostrava
Dokumentace
• V editačním módu:
– Function Help
– Control Help
• V editoru zdrojáku: Show Prototype Ctrl + Shift + Mezerník
• Dokumentaci stromu funkcí a všech jeho součástí lze vyexportovat do
textového souboru, nebo do html příkazy z menu Options -> Generate
Documentation

doc. Ing. Petr Bilík, Ph.D., katedra 450, FEI, VŠB-TU Ostrava
Editace vytořeného InstDriveru / Knihovny

Right-click the Instruments folder, select Edit


Instrument, and select the instrument driver you want
to edit.

doc. Ing. Petr Bilík, Ph.D., katedra 450, FEI, VŠB-TU Ostrava
Debugging—Compiling Files

Compiling your file checks for syntax errors.

doc. Ing. Petr Bilík, Ph.D., katedra 450, FEI, VŠB-TU Ostrava
Debugging—Excluding Lines

Excluding lines <Ctrl-E> is a fast way to comment out


lines of code.

doc. Ing. Petr Bilík, Ph.D., katedra 450, FEI, VŠB-TU Ostrava
Debugging—Breakpoints

Breakpoints pause your program at specified points.

doc. Ing. Petr Bilík, Ph.D., katedra 450, FEI, VŠB-TU Ostrava
Debugging—Single-Stepping

LabWindows/CVI allows you to single-step through your code.

Continue <F5>
Go to Cursor <F7>
Set Next Statement <Ctrl-Shift-F7>
Step Into <F8>
Step Over <F10>
Finish Function <Ctrl-F10>
Terminate Execution <Ctrl-F12>

doc. Ing. Petr Bilík, Ph.D., katedra 450, FEI, VŠB-TU Ostrava
Debugging—Conditional Breakpoints

LabWindows/CVI allows you to set conditional


breakpoints.

doc. Ing. Petr Bilík, Ph.D., katedra 450, FEI, VŠB-TU Ostrava
Debugging—Variables and Call Stack
Window
Displays the variables you have in your program.

doc. Ing. Petr Bilík, Ph.D., katedra 450, FEI, VŠB-TU Ostrava
Debugging—Variable Tooltips

Place your cursor over variables in the source code to


check the value of variables.

doc. Ing. Petr Bilík, Ph.D., katedra 450, FEI, VŠB-TU Ostrava
Debugging—Watch Window

Use the Watch window to select your own set of


variables and expressions to view.

doc. Ing. Petr Bilík, Ph.D., katedra 450, FEI, VŠB-TU Ostrava
Memory Display Window

• View and edit data in memory by address


• Useful with pointers and direct memory access
• View and edit data in
various formats such as
HEX, Dec, ASCII,
and so on

doc. Ing. Petr Bilík, Ph.D., katedra 450, FEI, VŠB-TU Ostrava
Debugging—Additional Views

doc. Ing. Petr Bilík, Ph.D., katedra 450, FEI, VŠB-TU Ostrava
Debugging—Specific Type

doc. Ing. Petr Bilík, Ph.D., katedra 450, FEI, VŠB-TU Ostrava
Debugging—Interactive Execution Window

Use the Interactive Execution window to test portions


of source code before including them in the primary
program.

doc. Ing. Petr Bilík, Ph.D., katedra 450, FEI, VŠB-TU Ostrava

You might also like