20
LabView Universal Driver Presentation Part A Shmulik & Pia Zobel Advisor : Mony Orbach

LabView Universal Driver Presentation Part A Shmulik & Pia Zobel Advisor: Mony Orbach

  • View
    226

  • Download
    1

Embed Size (px)

Citation preview

LabView Universal DriverPresentation Part A

Shmulik & Pia Zobel

Advisor:

Mony Orbach

Project Goal

• Build a universal driver to connect between LabView and any type of hardware

• This semester we built a specific driver for a Physics Momentum USB Chip

• Based on this driver, we are building the full driver

Driver Architecture

• The universal driver receives the interface from the user and builds a specific driver for each chip

• The specific driver is built from two parts:Pseudo hardware – VIs in LabViewSoftware – C++ code

• The two parts communicate through DLLs

Driver Architecture

Psuedo Hardware Architecture

• An application in LabView is called a VI - Virtual Instrument

• A VI is built from subVIs (i.e. other VIs )

This Semester’s Driver

• Built from four main VIs:Open DriverClose DriverWrite DriverRead Driver

Open Driver

Close Driver

Read Driver

Write Driver

Momentum USB Chip Driver

• A driver for a chip which measures position• The chip is connected to the computer through

the USB• Functionality:

I. Opens a connection to the chip

II. Configures it

III. Reads the data

IV. Closes the connection

Momentum Chip Hierarchy

Block Diagram

Block Diagram

Front Panel

Main Software Architecture

• The main program is activated by a DLL from LabView using createproccess()

• Runs in memory continuously

• Initializes the DLL

• Manages:Hardware – through Hardware DriverData in memory for application

Communication

• DLL – Dynamic Link Library

• Called from LabView through DLL VI

• Once the DLL is loaded into the memory,

any proccess can call DLL functions

DLL Interface

_declspec(dllexport) long open_driver(void);

_declspec(dllexport) long close_driver(void);

_declspec(dllexport) long read_driver(long , long );

_declspec(dllexport) long write_driver(long , CSTR );

Momentum Driver Interfaceclass Usb{

public:

static int iDevice_; // number of device

static DWORD numDevs_; // number of devices connected

Usb(); // default constructor

/class methods:

void openUsb;()

void closeUsb;()

BOOL readUsb(DWORD bytesToRead, void* read_buffer);

BOOL writeUsb(DWORD bytesToWrite, void* write_buffer);

BOOL setRecQueEventNot;()

void StopUntilRec_4;()

char* serialUsb;()

void errorUsb;()

FT_HANDLE getHandle;()

BOOL setLatency(int latency);

BOOL setTimeOut(int timeout);

~Usb;()

protected:

char serial_[16]; // serial number

BOOL deviceOpen_; // TRUE = open, FALSE = close

FT_HANDLE handle;_

//FT_Read/FT_Write parameters:

FT_STATUS r_w_status;_

DWORD num_bytes_s_r_;// number of bytes that was sent/recieved correctly

//

FT_ListDevices parameters:

FT_STATUS ftStatus;_

//Event notification paramaters

HANDLE hEvent;_

DWORD EventMask;_

//class protected methods

;}

Schedule

• 15/11/04 – Finish momentum driver

• 10/01/05 – Finish architecture of universal driver

• 28/02/05 – Finish writing code