Professional Documents
Culture Documents
UNIVERSIDAD DE ALCALA
DEPARTAMENTO DE ELECTRONICA
Escuela Politcnica e
UNIVERSIDAD DE ALCALA
LABWINDOWS/CVI:
Producto de national instrument (www.ni.com) Entorno de integrado de desarrollo para programadores Orientado para aplicaciones de adquisicin de datos y control de o instrumentos Compatible ANSI C gran exibilidad Caracter sticas generales: Desarrollo interactivo de programas Librer de funciones as Herramientas software para adquisicin, anlisis y presentacin de o a o datos
Javier Gamo Aranda Introduccin a LabWindows/CVI o 2
DEPARTAMENTO DE ELECTRONICA
Escuela Politcnica e
UNIVERSIDAD DE ALCALA
Introduccin a LabWindows/CVI o
DEPARTAMENTO DE ELECTRONICA
Escuela Politcnica e
UNIVERSIDAD DE ALCALA
Introduccin a LabWindows/CVI o
DEPARTAMENTO DE ELECTRONICA
Escuela Politcnica e
UNIVERSIDAD DE ALCALA
Ventana Source (.c) o Cdigo compatible ANSI C editable por el usuario Herramientas de generacin automtica de cdigo! o a o o o o Utilidades de edicin & depuracin de cdigo
Introduccin a LabWindows/CVI o
DEPARTAMENTO DE ELECTRONICA
Escuela Politcnica e
UNIVERSIDAD DE ALCALA
EJERCICIO 1: Modicar sample1.c de forma que: 1. Represente grcamente los datos (pista: usar Function Panel YGraphPopup) a 2. Calcule e imprima en Standard Input/Output la media de los nmeros (pista: u usar Function Panel Mean)
Javier Gamo Aranda Introduccin a LabWindows/CVI o 6
DEPARTAMENTO DE ELECTRONICA
Escuela Politcnica e
UNIVERSIDAD DE ALCALA
SOLUCION EJERCICIO 1:
Introduccin a LabWindows/CVI o
DEPARTAMENTO DE ELECTRONICA
Escuela Politcnica e
UNIVERSIDAD DE ALCALA
Introduccin a LabWindows/CVI o
DEPARTAMENTO DE ELECTRONICA
Escuela Politcnica e
UNIVERSIDAD DE ALCALA
1. Project Window: File Open User Interface (*.uir) template.uir 2. UIR Window: Create Command Button Adquirir , Salir 3. UIR Window: Create Graph
Javier Gamo Aranda Introduccin a LabWindows/CVI o 9
DEPARTAMENTO DE ELECTRONICA
Escuela Politcnica e
UNIVERSIDAD DE ALCALA
Callback Function: AcquireData (a rellenar ms tarde) a File Save As (ejemplo2.uir) Preview User Interface Header ejemplo2.h, generado automtia camente Code Preferences Default Control Events EVENT COMMIT,
EVEN RIGHT CLICK
DEPARTAMENTO DE ELECTRONICA
Escuela Politcnica e
UNIVERSIDAD DE ALCALA
DEPARTAMENTO DE ELECTRONICA
Escuela Politcnica e
UNIVERSIDAD DE ALCALA
SOLUCION EJERCICIO 2:
#include #include #include #include <ansi_c.h> <cvirte.h> <userint.h> "sample4.h" /* Needed if linking in external compiler; harmless otherwise */ static int panelHandle; int i; double datapoints[100]; int main (int argc, char *argv[]) { if (InitCVIRTE (0, argv, 0) == 0) /* Needed if linking in external compiler; harmless o therwise */ return -1; /* out of memory */ if ((panelHandle = LoadPanel (0, "sample4.uir", PANEL)) < 0) return -1; DisplayPanel (panelHandle); RunUserInterface (); return 0; } int CVICALLBACK Shutdown (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_COMMIT: QuitUserInterface (0); break; case EVENT_RIGHT_CLICK: break; } return 0; } int CVICALLBACK AcquireData (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_COMMIT: for (i=0; i<100; i++) { datapoints[i] = rand()/32767.0; } PlotY (panelHandle, PANEL_WAVEFORM, datapoints, 100, VAL_DOUBLE, VAL_THIN_LINE, VAL_EMPTY_SQUARE, VAL_SOLID, 1, VAL_RED); break; case EVENT_RIGHT_CLICK: break; } return 0; }
Introduccin a LabWindows/CVI o
12
DEPARTAMENTO DE ELECTRONICA
Escuela Politcnica e
UNIVERSIDAD DE ALCALA
EJERCICIO 3:
Modicar ejemplo2.prj para implementar la siguiente interfaz de usuario:
Incluir <cvi tutorial>\scope.fp Funciones: scope init, scope config, scope read waveform Mximo y m a nimo: MaxMin1D Utilizar SetCtrlVal y GetCtrlVal adecuadamente
Introduccin a LabWindows/CVI o
13
DEPARTAMENTO DE ELECTRONICA
Escuela Politcnica e
UNIVERSIDAD DE ALCALA
SOLUCION EJERCICIO 3:
Introduccin a LabWindows/CVI o
14