LabView Universal Driver Presentation 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 LabView Software – 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 Driver Close Driver Write Driver Read 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
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 Driver Data 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 Interface class 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