FYS3240 PC-based instrumentation and · PDF filePC-based instrumentation and microcontrollers...
Transcript of FYS3240 PC-based instrumentation and · PDF filePC-based instrumentation and microcontrollers...
![Page 1: FYS3240 PC-based instrumentation and · PDF filePC-based instrumentation and microcontrollers ... LabVIEW Graphical Programming, Fourth Edition, ... (sensor and measurement techniques)](https://reader034.fdocuments.net/reader034/viewer/2022052515/5a76ec317f8b9a9c548da77e/html5/thumbnails/1.jpg)
FYS3240
PC-based instrumentation and microcontrollers
Introduction
Spring 2012 – Lecture #1
Bekkeng 3.12.2012
![Page 2: FYS3240 PC-based instrumentation and · PDF filePC-based instrumentation and microcontrollers ... LabVIEW Graphical Programming, Fourth Edition, ... (sensor and measurement techniques)](https://reader034.fdocuments.net/reader034/viewer/2022052515/5a76ec317f8b9a9c548da77e/html5/thumbnails/2.jpg)
FYS 3240
Two main parts:
1. Computer based instrumentation and DAQ Data acquisition (DAQ) systems
LabVIEW
2. Practical introduction to microcontrollers for
instrumentation
![Page 3: FYS3240 PC-based instrumentation and · PDF filePC-based instrumentation and microcontrollers ... LabVIEW Graphical Programming, Fourth Edition, ... (sensor and measurement techniques)](https://reader034.fdocuments.net/reader034/viewer/2022052515/5a76ec317f8b9a9c548da77e/html5/thumbnails/3.jpg)
Curriculum
• Lectures
• Laboratory exercises
• The textbook readings complement the lectures
Textbooks:
• Ørjan G. Martinsen: PC-basert instrumentering og mikrokontrollere, 2006.
Gyldendal. ISBN: ISBN-13: 978-82-05-31569-3.
• Gary Johnson and Richard Jennings: LabVIEW Graphical Programming,
Fourth Edition, 2006. McGraw-Hill Professional. ISBN: 978-0071451468 .
![Page 4: FYS3240 PC-based instrumentation and · PDF filePC-based instrumentation and microcontrollers ... LabVIEW Graphical Programming, Fourth Edition, ... (sensor and measurement techniques)](https://reader034.fdocuments.net/reader034/viewer/2022052515/5a76ec317f8b9a9c548da77e/html5/thumbnails/4.jpg)
Lecturer
• Jan Kenneth Bekkeng (Senior Scientist FFI, Ass. prof-II UIO)
• Email:
– j.k.bekkeng[at]fys.uio.no
T&E
Sounding rockets
DAQ
![Page 5: FYS3240 PC-based instrumentation and · PDF filePC-based instrumentation and microcontrollers ... LabVIEW Graphical Programming, Fourth Edition, ... (sensor and measurement techniques)](https://reader034.fdocuments.net/reader034/viewer/2022052515/5a76ec317f8b9a9c548da77e/html5/thumbnails/5.jpg)
About the lectures and Labs
• Lectures given in Norwegian
• Notes will be made available on the course home page
• Important messages are made available at the course home page
• 2 lecture hours each week
• 4 (bachelor) / 5 (master) lab assignments - room V442
• Submit the lab reports including the source code to
[email protected] (lab teaching assistant)
• Nominally three weeks are assigned to each lab assignment
• All labs must be approved by 31. May !
Lab teaching assistant:
Name : Bent Furevik
E-mail : [email protected]
Phone : 99 367 368
![Page 6: FYS3240 PC-based instrumentation and · PDF filePC-based instrumentation and microcontrollers ... LabVIEW Graphical Programming, Fourth Edition, ... (sensor and measurement techniques)](https://reader034.fdocuments.net/reader034/viewer/2022052515/5a76ec317f8b9a9c548da77e/html5/thumbnails/6.jpg)
Atmel XMEGA-B1 Xplained evaluation kit
![Page 7: FYS3240 PC-based instrumentation and · PDF filePC-based instrumentation and microcontrollers ... LabVIEW Graphical Programming, Fourth Edition, ... (sensor and measurement techniques)](https://reader034.fdocuments.net/reader034/viewer/2022052515/5a76ec317f8b9a9c548da77e/html5/thumbnails/7.jpg)
About the lab work
• Lab0: LabVIEW introduction with exercises
– Learn basic application development with LabVIEW
• Lab 1: Simple I/O programming
– LEDs and switches
• Lab 2: Control an LCD display
• Lab 3: Control the ADC (analog to digital converter) –
• Lab 4: Project for Master (4240) students
– Select your own project in agreement with lab teaching assistant Bent Furevik
![Page 8: FYS3240 PC-based instrumentation and · PDF filePC-based instrumentation and microcontrollers ... LabVIEW Graphical Programming, Fourth Edition, ... (sensor and measurement techniques)](https://reader034.fdocuments.net/reader034/viewer/2022052515/5a76ec317f8b9a9c548da77e/html5/thumbnails/8.jpg)
Course background
• Assumes basic knowledge in electronics, computer
architecture and programming. This is covered e.g. by
– FYS1210 (basic electronics)
– FYS3230 (sensor and measurement techniques)
– A programming course (e.g. INF 1000)
– The textbook “PC-basert instrumentering og mikrokontrollere”
• The lectures will focus on:
– DAQ systems
– System design (hardware and software)
– Principles, concepts and implementation strategies
You will learn state-of-the-art technology (hardware and
software techniques) for DAQ-systems!
![Page 9: FYS3240 PC-based instrumentation and · PDF filePC-based instrumentation and microcontrollers ... LabVIEW Graphical Programming, Fourth Edition, ... (sensor and measurement techniques)](https://reader034.fdocuments.net/reader034/viewer/2022052515/5a76ec317f8b9a9c548da77e/html5/thumbnails/9.jpg)
Computer courses with more “theory”
& background information
• INF2270 – Datamaskinarkitektur
– C-programming
– Computer architecture
– Hardware and software interaction
• INF1060 - Introduksjon til operativsystemer og
datakommunikasjon
– C-programming
– OS
– Data communication
• INF3190 – Datakommunikasjon
– Data communication
![Page 10: FYS3240 PC-based instrumentation and · PDF filePC-based instrumentation and microcontrollers ... LabVIEW Graphical Programming, Fourth Edition, ... (sensor and measurement techniques)](https://reader034.fdocuments.net/reader034/viewer/2022052515/5a76ec317f8b9a9c548da77e/html5/thumbnails/10.jpg)
Other good books:
• LabVIEW for Everyone: Graphical Programming Made
Easy and Fun (3rd Edition) by Jeffrey Travis and Jim
Kring
• The LabVIEW Style Book by Peter A. Blume
• LabVIEW for Data Acquisition by Bruce Mihura (2001)
• The C Programming Language by Brian W. Kernighan,
Dennis M.Ritchie(1988)
![Page 11: FYS3240 PC-based instrumentation and · PDF filePC-based instrumentation and microcontrollers ... LabVIEW Graphical Programming, Fourth Edition, ... (sensor and measurement techniques)](https://reader034.fdocuments.net/reader034/viewer/2022052515/5a76ec317f8b9a9c548da77e/html5/thumbnails/11.jpg)
Topics you will learn about
• Computer buses and interfaces
• Microcontrollers
• LabVIEW programming
• Instrumentation and data acquisition (DAQ)
• Networked and distributed DAQ systems
• High-speed data streaming
• Parallel programming
• Real-Time and Embedded systems
• FPGAs and GPUs
• Instrumentation under Linux
![Page 12: FYS3240 PC-based instrumentation and · PDF filePC-based instrumentation and microcontrollers ... LabVIEW Graphical Programming, Fourth Edition, ... (sensor and measurement techniques)](https://reader034.fdocuments.net/reader034/viewer/2022052515/5a76ec317f8b9a9c548da77e/html5/thumbnails/12.jpg)
LabVIEW LEGO MINDSTORMS NXT Module
The Tilted Twister solves
Rubik’s Cubes in 6 minutes!
Can develop LabVIEW programs that run on a host computer and
communicate with an NXT brick. These programs also can run directly on the
NXT.
![Page 13: FYS3240 PC-based instrumentation and · PDF filePC-based instrumentation and microcontrollers ... LabVIEW Graphical Programming, Fourth Edition, ... (sensor and measurement techniques)](https://reader034.fdocuments.net/reader034/viewer/2022052515/5a76ec317f8b9a9c548da77e/html5/thumbnails/13.jpg)
Trends in Test and Measurement
• Multicore CPUs and Parallel programming
– Increased CPU performance without increased clock rates
• Software-Defined Instrumentation
– Can easily change functionality
• FPGA-Enabled Instrumentation
– High performance, True parallelism, High determinism, High
reliability, Reconfigurable
• 64 bit operating systems and support
– An “unlimited” address space allows much more RAM
(Random Access Memory) in the computer
• Wireless
![Page 14: FYS3240 PC-based instrumentation and · PDF filePC-based instrumentation and microcontrollers ... LabVIEW Graphical Programming, Fourth Edition, ... (sensor and measurement techniques)](https://reader034.fdocuments.net/reader034/viewer/2022052515/5a76ec317f8b9a9c548da77e/html5/thumbnails/14.jpg)
What is LabVIEW
Icon wire
Express VIs
Standard VIs
Data flow direction
![Page 15: FYS3240 PC-based instrumentation and · PDF filePC-based instrumentation and microcontrollers ... LabVIEW Graphical Programming, Fourth Edition, ... (sensor and measurement techniques)](https://reader034.fdocuments.net/reader034/viewer/2022052515/5a76ec317f8b9a9c548da77e/html5/thumbnails/15.jpg)
Example: a while loop in LabVIEW
![Page 16: FYS3240 PC-based instrumentation and · PDF filePC-based instrumentation and microcontrollers ... LabVIEW Graphical Programming, Fourth Edition, ... (sensor and measurement techniques)](https://reader034.fdocuments.net/reader034/viewer/2022052515/5a76ec317f8b9a9c548da77e/html5/thumbnails/16.jpg)
What is LabVIEW II
• LabVIEW is a graphical programming environment
– G programming language
• LabVIEW contains the same programming concepts found in
most traditional languages
– data types, loops, event handling, variables, recursion, and object-oriented
programming
• LabVIEW is the de facto standard for measurement, test, and
control systems (both in industry and academia)
• Graphical icons and wires resemble a flowchart
• Provides easy integration with thousands of hardware devices
• Contains large built-in libraries
• Available for multiple targets and OS (Windows, Mac, Linux
and RTOS)
http://www.ni.com/labview/whatis/
![Page 17: FYS3240 PC-based instrumentation and · PDF filePC-based instrumentation and microcontrollers ... LabVIEW Graphical Programming, Fourth Edition, ... (sensor and measurement techniques)](https://reader034.fdocuments.net/reader034/viewer/2022052515/5a76ec317f8b9a9c548da77e/html5/thumbnails/17.jpg)
LabVIEW Operating System (OS)
compatibility
![Page 18: FYS3240 PC-based instrumentation and · PDF filePC-based instrumentation and microcontrollers ... LabVIEW Graphical Programming, Fourth Edition, ... (sensor and measurement techniques)](https://reader034.fdocuments.net/reader034/viewer/2022052515/5a76ec317f8b9a9c548da77e/html5/thumbnails/18.jpg)
LabWindows/CVI from National
Instruments
• CVI is short for C for Virtual Instrumentation
• LabWindows/CVI is a software development
environment for C programmers
• LabWindows uses the same libraries and data
acquisition modules as the more famous
National Instrument product LabVIEW and is
thus highly compatible with it
• LabVIEW is targeted more at domain experts
and scientists and CVI more towards software
engineers that are more comfortable with text-
based linear languages such as C
![Page 19: FYS3240 PC-based instrumentation and · PDF filePC-based instrumentation and microcontrollers ... LabVIEW Graphical Programming, Fourth Edition, ... (sensor and measurement techniques)](https://reader034.fdocuments.net/reader034/viewer/2022052515/5a76ec317f8b9a9c548da77e/html5/thumbnails/19.jpg)
Instrument Control Overview
Control any instrument if you know the following:
– Type of connector on the instrument − Type of cables needed
– Electrical properties involved − Communication protocols used
– Software drivers available
Instruments Computer
![Page 20: FYS3240 PC-based instrumentation and · PDF filePC-based instrumentation and microcontrollers ... LabVIEW Graphical Programming, Fourth Edition, ... (sensor and measurement techniques)](https://reader034.fdocuments.net/reader034/viewer/2022052515/5a76ec317f8b9a9c548da77e/html5/thumbnails/20.jpg)
Real-Time Computing
• In computer science, real-time computing (RTC) is systems
that are subject to a "real-time constraint“- i.e., operational
deadlines from event to system response.
– the correctness depends not only on the logical result but also on
the time it was delivered
• By contrast, a non-real-time system is one for which there is no
deadline, even if fast response or high performance is desired
or preferred.
FYS4220
![Page 21: FYS3240 PC-based instrumentation and · PDF filePC-based instrumentation and microcontrollers ... LabVIEW Graphical Programming, Fourth Edition, ... (sensor and measurement techniques)](https://reader034.fdocuments.net/reader034/viewer/2022052515/5a76ec317f8b9a9c548da77e/html5/thumbnails/21.jpg)
Embedded Computing
• An embedded system is a computer system designed to
perform one or a few dedicated functions, often with real-
time computing constraints.
• Embedded systems span all aspects of modern life and there
are many examples of their use: mobile phones, MP3 players,
digital cameras, GPS receivers etc.
• Embedded processors can be microprocessors,
microcontrollers or FPGAs.
• The program instructions written for microcontrollers are
referred to as firmware, and are stored in read-only memory or
Flash memory chips.
• Embedded systems run with limited computer hardware
resources: limited memory, small or non-existent keyboard
and/or screen
FYS4220
![Page 22: FYS3240 PC-based instrumentation and · PDF filePC-based instrumentation and microcontrollers ... LabVIEW Graphical Programming, Fourth Edition, ... (sensor and measurement techniques)](https://reader034.fdocuments.net/reader034/viewer/2022052515/5a76ec317f8b9a9c548da77e/html5/thumbnails/22.jpg)
Data Acquisition (DAQ) & Control Systems
• The main application domain for Real-Time and Embedded computer systems is within Data Acquisition and Control.
• A dish washer system reads data from a timer, temperature and water level sensors, and controls the water valves and heater
• Data acquisition involves collecting signals from measurement sources and digitizing the signal for storage, analysis and presentation.
– For a Control System the processed data is also utilized for controlling the external process through a feedback loop
![Page 23: FYS3240 PC-based instrumentation and · PDF filePC-based instrumentation and microcontrollers ... LabVIEW Graphical Programming, Fourth Edition, ... (sensor and measurement techniques)](https://reader034.fdocuments.net/reader034/viewer/2022052515/5a76ec317f8b9a9c548da77e/html5/thumbnails/23.jpg)
Computer-based DAQ system
• Configuration
• Display
• Data Storage
FYS3240/4240
![Page 24: FYS3240 PC-based instrumentation and · PDF filePC-based instrumentation and microcontrollers ... LabVIEW Graphical Programming, Fourth Edition, ... (sensor and measurement techniques)](https://reader034.fdocuments.net/reader034/viewer/2022052515/5a76ec317f8b9a9c548da77e/html5/thumbnails/24.jpg)
Third generation PC (2004)
66
– 8
00
MH
z
![Page 25: FYS3240 PC-based instrumentation and · PDF filePC-based instrumentation and microcontrollers ... LabVIEW Graphical Programming, Fourth Edition, ... (sensor and measurement techniques)](https://reader034.fdocuments.net/reader034/viewer/2022052515/5a76ec317f8b9a9c548da77e/html5/thumbnails/25.jpg)
What is an Operating System (OS)?
• “An operating system (OS) is a collection of programs that acts
as an intermediary between the hardware and its user(s),
providing a high-level interface to low level hardware resources,
such as the CPU, memory, and I/O devices. The operating
system provides various facilities and services that make the
use of the hardware convenient, efficient and safe” Lazowska, E. D.:
Contemporary Issues in Operating Systems , in: Encyclopedia of Computer Science, Ralston, A., Reilly, E.
D. (Editors), IEEE Press, 1993, pp.980
• The OS hides the messy details
• The OS Presents a virtual machine, which is easier to use
• Each program gets time/space on the resource
![Page 26: FYS3240 PC-based instrumentation and · PDF filePC-based instrumentation and microcontrollers ... LabVIEW Graphical Programming, Fourth Edition, ... (sensor and measurement techniques)](https://reader034.fdocuments.net/reader034/viewer/2022052515/5a76ec317f8b9a9c548da77e/html5/thumbnails/26.jpg)
Protected mode
• In computing, protected mode is an operational mode of x86-
compatible central processing units (CPU)
– The term x86 refers to a family of instruction set architectures based
on the Intel 8086 CPU
– It allows system software to utilize features such as virtual memory,
paging, safe multi-tasking, and other features designed to increase
an operating system's control over application software.
• In protected mode, there are four privilege levels or rings,
numbered from 0 to 3, with ring 0 being the most privileged and
3 being the least. The use of rings allows for system software to
restrict tasks from accessing data or executing privileged
instructions.
• In most environments, the operating system and some device
drivers run in ring 0 and applications run in ring 3
![Page 27: FYS3240 PC-based instrumentation and · PDF filePC-based instrumentation and microcontrollers ... LabVIEW Graphical Programming, Fourth Edition, ... (sensor and measurement techniques)](https://reader034.fdocuments.net/reader034/viewer/2022052515/5a76ec317f8b9a9c548da77e/html5/thumbnails/27.jpg)
Windows architecture
• Ring 0 : ”all rights”
– operating system (kernel)
• Ring 3 : limited rights e.g. related to I/O
– Applications (user programs)
32 bit Windows XP
Privilege levels in Windows
• Need a device driver in order to
allow hardware I/O operations
from application programs
![Page 28: FYS3240 PC-based instrumentation and · PDF filePC-based instrumentation and microcontrollers ... LabVIEW Graphical Programming, Fourth Edition, ... (sensor and measurement techniques)](https://reader034.fdocuments.net/reader034/viewer/2022052515/5a76ec317f8b9a9c548da77e/html5/thumbnails/28.jpg)
Device Drivers
• In computing, a device driver or software driver is a computer
program allowing higher-level computer programs to interact
with a hardware device.
• A driver typically communicates with the device through the
computer bus or communications subsystem to which the
hardware connects. When a calling program invokes a routine
in the driver, the driver issues commands to the device. Once
the device sends data back to the driver, the driver may invoke
routines in the original calling program. Drivers are hardware-
dependent and operating-system-specific.
![Page 29: FYS3240 PC-based instrumentation and · PDF filePC-based instrumentation and microcontrollers ... LabVIEW Graphical Programming, Fourth Edition, ... (sensor and measurement techniques)](https://reader034.fdocuments.net/reader034/viewer/2022052515/5a76ec317f8b9a9c548da77e/html5/thumbnails/29.jpg)
Windows device drivers
![Page 30: FYS3240 PC-based instrumentation and · PDF filePC-based instrumentation and microcontrollers ... LabVIEW Graphical Programming, Fourth Edition, ... (sensor and measurement techniques)](https://reader034.fdocuments.net/reader034/viewer/2022052515/5a76ec317f8b9a9c548da77e/html5/thumbnails/30.jpg)
How to make a device driver for
Windows?
• Writing a device driver can be a challenge as it requires
windows (API) programming knowledge
• Different approaches to get the device driver you need:
– Make a complete device driver
– Make the device driver using a program to assist you
making the driver, e.g. a program called “Driver Agent”
– Use LabVIEW! LabVIEW includes custom made
drivers (for serial communication, TCP, UDP, USB,
DAQ etc) . In addition, device drivers for specific
instruments etc. can be downloaded from NI.
Therefore, usually no device driver has to be written!
![Page 31: FYS3240 PC-based instrumentation and · PDF filePC-based instrumentation and microcontrollers ... LabVIEW Graphical Programming, Fourth Edition, ... (sensor and measurement techniques)](https://reader034.fdocuments.net/reader034/viewer/2022052515/5a76ec317f8b9a9c548da77e/html5/thumbnails/31.jpg)
Using device drivers in LabVIEW
• All NI hardware is shipped with LabVIEW driver software
• After your hardware driver software is installed, it is integrated into
LabVIEW
• It provides a new palette for easy access to the functions
• You simply drag-and-drop the functions to your block diagram to
configure and control the hardware device
![Page 32: FYS3240 PC-based instrumentation and · PDF filePC-based instrumentation and microcontrollers ... LabVIEW Graphical Programming, Fourth Edition, ... (sensor and measurement techniques)](https://reader034.fdocuments.net/reader034/viewer/2022052515/5a76ec317f8b9a9c548da77e/html5/thumbnails/32.jpg)
LabVIEW Hardware targets
• Standard PC
• Real-time PC
• Embedded controller (in a PXI system)
• FPGA
• 8-, 16-, and 32-bit microprocessors
• ARM Microcontrollers
![Page 33: FYS3240 PC-based instrumentation and · PDF filePC-based instrumentation and microcontrollers ... LabVIEW Graphical Programming, Fourth Edition, ... (sensor and measurement techniques)](https://reader034.fdocuments.net/reader034/viewer/2022052515/5a76ec317f8b9a9c548da77e/html5/thumbnails/33.jpg)
Simple to advanced DAQ systems ….
• DAQ using the PC sound card
– AC, low frequencies (10 – 20 kHz)
• PC with plug-in PCI DAQ card(s)
• PC with a USB DAQ device
• DAQ system with multiple connected PXI systems
and hundreds of measurement channels
![Page 34: FYS3240 PC-based instrumentation and · PDF filePC-based instrumentation and microcontrollers ... LabVIEW Graphical Programming, Fourth Edition, ... (sensor and measurement techniques)](https://reader034.fdocuments.net/reader034/viewer/2022052515/5a76ec317f8b9a9c548da77e/html5/thumbnails/34.jpg)
Workstation vs. PC
• A workstation is a high-end computer designed for technical or
scientific applications, running numeric- and graphic-intensive
applications
– high-performance computing (HPC)
• Desktops PCs are all about flexibility – they are designed to
meet a much wider variety of computing needs
• As desktop PCs become faster and stronger, the lines between
a high-powered desktop and true workstations become more
blurred
• Workstations typically offered higher performance than
personal computers, especially with respect to CPU and
graphics, memory capacity and multitasking capability
• In addition, workstations typically have more slots for PCI and
PCI Express
![Page 35: FYS3240 PC-based instrumentation and · PDF filePC-based instrumentation and microcontrollers ... LabVIEW Graphical Programming, Fourth Edition, ... (sensor and measurement techniques)](https://reader034.fdocuments.net/reader034/viewer/2022052515/5a76ec317f8b9a9c548da77e/html5/thumbnails/35.jpg)
Workstation vs. PC II
HP Z800 Workstation
• 2 x Intel® Xeon® Six Core prosessor (5600 serie)
• 192 GB maksimalt minne (RAM)
• Rack-monterbart minitårn (for 19” rack)
•1 PCI
•1 PCI Express Gen1 (x8 mekanisk, x4 elektrisk)
•1 PCI Express Gen2 (x8 mekanisk, x4 elektrisk)
•2 PCI Express Gen2 (x16 mekanisk, x8 elektrisk)
•2 PCI Express Gen2 x16 (for grafikkort)
HP Compaq dc7900
• Intel® Core™2 Quad prosessor
• 16 GB maksimalt minne (RAM)
• 3 PCI
• 1 PCI Express x16
• 2 PCI Express x1
Note: With Windows 7, 192 GB is the physical memory limit for 64-bit
Windows (X64)
![Page 36: FYS3240 PC-based instrumentation and · PDF filePC-based instrumentation and microcontrollers ... LabVIEW Graphical Programming, Fourth Edition, ... (sensor and measurement techniques)](https://reader034.fdocuments.net/reader034/viewer/2022052515/5a76ec317f8b9a9c548da77e/html5/thumbnails/36.jpg)
Intel Processors