57
9/6/2012 1 ENGG*4420 ENGG*4420 ENGG*4420 ENGG*4420 Real Time System Design Real Time System Design Real Time System Design ([email protected]) ([email protected] ) FVMI 219A (Connected to 219) FVMI 219A (Connected to 219) FVMI 219A (Connected to 219) Friday 2:30 - 5:20 Friday 2:30 - 5:20 Friday 2:30 - 5:20 Monday 2:30 5:20 Monday 2:30 5:20 Monday 2:30 5:20 1 ENGG*4420 Lab 1 1

Real Time System Design - University of Guelph LABs PPP/Lab … · ENGG*4420 Real Time System Design ([email protected] ) FVMI 219A (Connected to 219) Friday 2:30 -5:20 Monday 2:30

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Real Time System Design - University of Guelph LABs PPP/Lab … · ENGG*4420 Real Time System Design (mmayhew@uoguelph.ca ) FVMI 219A (Connected to 219) Friday 2:30 -5:20 Monday 2:30

9 /6 /2 0 1 2

1

ENGG*4420ENGG*4420ENGG*4420ENGG*4420ENGG*4420

Real Time System DesignReal Time System DesignReal Time System Design

([email protected])([email protected])

FVMI 219A (Connected to 219)FVMI 219A (Connected to 219)FVMI 219A (Connected to 219)

Friday 2:30 - 5:20Friday 2:30 - 5:20Friday 2:30 - 5:20Friday 2:30 - 5:20

Monday 2:30 – 5:20Monday 2:30 – 5:20Monday 2:30 – 5:20Monday 2:30 – 5:20

1ENGG*4420 Lab 1 1

Page 2: Real Time System Design - University of Guelph LABs PPP/Lab … · ENGG*4420 Real Time System Design (mmayhew@uoguelph.ca ) FVMI 219A (Connected to 219) Friday 2:30 -5:20 Monday 2:30

9 /6 /2 0 1 2

2

Today’s ActivitiesToday’s ActivitiesToday’s ActivitiesToday’s Activities

� General Introduction� General Introduction� General Introduction� General Introduction

� Lab 1 Introduction� Lab 1 Introduction� Lab 1 Introduction� Lab 1 Introduction

� Fill in Fob form� Fill in Fob form� Fill in Fob form� Fill in Fob form

� Make groups (min 2 students, max 3)� Make groups (min 2 students, max 3)� Make groups (min 2 students, max 3)� Make groups (min 2 students, max 3)

� Start work on Lab 1� Start work on Lab 1� Start work on Lab 1� Start work on Lab 1

2ENGG*4420 Lab 1 2

Page 3: Real Time System Design - University of Guelph LABs PPP/Lab … · ENGG*4420 Real Time System Design (mmayhew@uoguelph.ca ) FVMI 219A (Connected to 219) Friday 2:30 -5:20 Monday 2:30

9 /6 /2 0 1 2

3

General IntroductionGeneral IntroductionGeneral IntroductionGeneral Introduction

� Course consists of 4 labs:� Course consists of 4 labs:� Course consists of 4 labs:� Course consists of 4 labs:� Modeling the PT 326 Process Trainer.� Modeling the PT 326 Process Trainer.� Modeling the PT 326 Process Trainer.

� Real-Time Automotive Suspension � Real-Time Automotive Suspension � Real-Time Automotive Suspension Simulator.Simulator.Simulator.

� Real-Time Control of a Hot Air Plant � Real-Time Control of a Hot Air Plant � Real-Time Control of a Hot Air Plant using RTOS uC/OSII.using RTOS uC/OSII.using RTOS uC/OSII.

� Multi-Core Real-Time Suspension � Multi-Core Real-Time Suspension � Multi-Core Real-Time Suspension Control using LabVIEW Real-Time OS.Control using LabVIEW Real-Time OS.Control using LabVIEW Real-Time OS.

3ENGG*4420 Lab 1 3

Page 4: Real Time System Design - University of Guelph LABs PPP/Lab … · ENGG*4420 Real Time System Design (mmayhew@uoguelph.ca ) FVMI 219A (Connected to 219) Friday 2:30 -5:20 Monday 2:30

9 /6 /2 0 1 2

4

� Demos and reports are due at the same� Demos and reports are due at the same� Demos and reports are due at the sametime.

� Demos and reports are due at the sametime.time.time.

� Both a hard copy of the report and an� Both a hard copy of the report and an� Both a hard copy of the report and anelectronic copy should be submitted.electronic copy should be submitted.electronic copy should be submitted.

� Lab 1: Week 4, Sep. 28th/Oct. 1st� Lab 1: Week 4, Sep. 28th/Oct. 1st� Lab 1: Week 4, Sep. 28 /Oct. 1

Lab 2: Week 6, Oct. 12th/Oct. 15th� Lab 2: Week 6, Oct. 12th/Oct. 15th� Lab 2: Week 6, Oct. 12th/Oct. 15th� Lab 2: Week 6, Oct. 12 /Oct. 15

� Lab 3: Week 9, Nov. 2nd/Nov. 5th� Lab 3: Week 9, Nov. 2nd/Nov. 5th� Lab 3: Week 9, Nov. 2nd/Nov. 5th

� Lab 4: Week 12, Nov. 23rd/Nov. 26th� Lab 4: Week 12, Nov. 23rd/Nov. 26th� Lab 4: Week 12, Nov. 23rd/Nov. 26th

4ENGG*4420 Lab 1 4

Page 5: Real Time System Design - University of Guelph LABs PPP/Lab … · ENGG*4420 Real Time System Design (mmayhew@uoguelph.ca ) FVMI 219A (Connected to 219) Friday 2:30 -5:20 Monday 2:30

9 /6 /2 0 1 2

5

MarkingMarkingMarkingMarking

� Labs 1 and 2 - 8% each.� Labs 1 and 2 - 8% each.� Labs 1 and 2 - 8% each.� Labs 1 and 2 - 8% each.

4% for the demo, � 4% for the demo, � 4% for the demo, � 4% for the demo,

� 4% for the report.� 4% for the report.� 4% for the report.

� Labs 3 and 4 - 12% each.� Labs 3 and 4 - 12% each.� Labs 3 and 4 - 12% each.

� 6% for the demo, � 6% for the demo, � 6% for the demo, � 6% for the demo,

� 6% for the report.� 6% for the report.� 6% for the report.� 6% for the report.

5ENGG*4420 Lab 1 5

Page 6: Real Time System Design - University of Guelph LABs PPP/Lab … · ENGG*4420 Real Time System Design (mmayhew@uoguelph.ca ) FVMI 219A (Connected to 219) Friday 2:30 -5:20 Monday 2:30

9 /6 /2 0 1 2

6

Group Evaluation FormsGroup Evaluation FormsGroup Evaluation FormsGroup Evaluation Forms

� A group work evaluation form MUST be� A group work evaluation form MUST be� A group work evaluation form MUST besubmitted with every lab report.submitted with every lab report.submitted with every lab report.

� http://www.soe.uoguelph.ca/webfiles/rmure� http://www.soe.uoguelph.ca/webfiles/rmure� http://www.soe.uoguelph.ca/webfiles/rmuresan/ENG3490-W06.htmsan/ENG3490-W06.htmsan/ENG3490-W06.htm

� Individual student contributions for each lab� Individual student contributions for each lab� Individual student contributions for each labshould not vary beyond a small amount.should not vary beyond a small amount.should not vary beyond a small amount.

� E.g. +/10% on 100% scale.� E.g. +/10% on 100% scale.� E.g. +/10% on 100% scale.

� For larger discrepancies, lab marks will be� For larger discrepancies, lab marks will be� For larger discrepancies, lab marks will bescaled down for lower contributionscaled down for lower contributionscaled down for lower contributionpercentages.percentages.percentages.

Page 7: Real Time System Design - University of Guelph LABs PPP/Lab … · ENGG*4420 Real Time System Design (mmayhew@uoguelph.ca ) FVMI 219A (Connected to 219) Friday 2:30 -5:20 Monday 2:30

9 /6 /2 0 1 2

7

Modeling the PT 326 Modeling the PT 326 Modeling the PT 326 Modeling the PT 326

Process TrainerProcess TrainerProcess TrainerProcess Trainer

Due Dates: Friday Sep. 28th, 2012Due Dates: Friday Sep. 28th, 2012Due Dates: Friday Sep. 28 , 2012

Monday Oct 1st, 2012Monday Oct 1st, 2012Monday Oct 1 , 2012

7ENGG*4420 Lab 1 7

Page 8: Real Time System Design - University of Guelph LABs PPP/Lab … · ENGG*4420 Real Time System Design (mmayhew@uoguelph.ca ) FVMI 219A (Connected to 219) Friday 2:30 -5:20 Monday 2:30

9 /6 /2 0 1 2

8

Lab 1 Development EnvironmentLab 1 Development EnvironmentLab 1 Development EnvironmentLab 1 Development Environment

� LabVIEW 2009 software� LabVIEW 2009 software� LabVIEW 2009 software

� Nios II IDE� Nios II IDE� Nios II IDE

Altera Nios II Embedded Evaluation � Altera Nios II Embedded Evaluation � Altera Nios II Embedded Evaluation � Altera Nios II Embedded Evaluation KitKitKit

8ENGG*4420 Lab 1 8

Page 9: Real Time System Design - University of Guelph LABs PPP/Lab … · ENGG*4420 Real Time System Design (mmayhew@uoguelph.ca ) FVMI 219A (Connected to 219) Friday 2:30 -5:20 Monday 2:30

9 /6 /2 0 1 2

9

Lab 1 – Simple Hot Air BlowerLab 1 – Simple Hot Air BlowerLab 1 – Simple Hot Air BlowerLab 1 – Simple Hot Air BlowerPT 326 Process TrainerPT 326 Process TrainerPT 326 Process TrainerPT 326 Process Trainer

9ENGG*4420 Lab 1 9

Page 10: Real Time System Design - University of Guelph LABs PPP/Lab … · ENGG*4420 Real Time System Design (mmayhew@uoguelph.ca ) FVMI 219A (Connected to 219) Friday 2:30 -5:20 Monday 2:30

9 /6 /2 0 1 2

1 0

Architecture for Labs 1 & 3Architecture for Labs 1 & 3Architecture for Labs 1 & 3Architecture for Labs 1 & 3

10ENGG*4420 Lab 1 10

Page 11: Real Time System Design - University of Guelph LABs PPP/Lab … · ENGG*4420 Real Time System Design (mmayhew@uoguelph.ca ) FVMI 219A (Connected to 219) Friday 2:30 -5:20 Monday 2:30

9 /6 /2 0 1 2

11

Control of a Thermal SystemControl of a Thermal SystemControl of a Thermal SystemControl of a Thermal System

LabVIEWLabVIEWLabVIEW

AlteraAlteraAltera

Page 12: Real Time System Design - University of Guelph LABs PPP/Lab … · ENGG*4420 Real Time System Design (mmayhew@uoguelph.ca ) FVMI 219A (Connected to 219) Friday 2:30 -5:20 Monday 2:30

9 /6 /2 0 1 2

1 2

Plant ModelPlant ModelPlant ModelPlant Model

KeVSτ

=KeV

Sdτ

=KeVi

d

Equation (6)

+=KeVi

τEquation (6)

+=sV τ

Equation (6)

+=sVO τ +sVO τ +sVO τ

Page 13: Real Time System Design - University of Guelph LABs PPP/Lab … · ENGG*4420 Real Time System Design (mmayhew@uoguelph.ca ) FVMI 219A (Connected to 219) Friday 2:30 -5:20 Monday 2:30

9 /6 /2 0 1 2

1 3

LabVIEW Plant ImplementationLabVIEW Plant ImplementationLabVIEW Plant ImplementationLabVIEW Plant Implementation

� The Plant system is defined in LV� The Plant system is defined in LV� The Plant system is defined in LV� The Plant system is defined in LVusing transfer function VIs.using transfer function VIs.using transfer function VIs.

Setup Plant Transfer Function Execute Plant SystemSetup Plant Transfer Function Execute Plant System

Page 14: Real Time System Design - University of Guelph LABs PPP/Lab … · ENGG*4420 Real Time System Design (mmayhew@uoguelph.ca ) FVMI 219A (Connected to 219) Friday 2:30 -5:20 Monday 2:30

9 /6 /2 0 1 2

1 4

Control SystemControl SystemControl SystemControl System

� PID-based control system� PID-based control system� PID-based control system� PID-based control system

� Proportional� Proportional� Proportional

� Integral� Integral� Integral

� Derivative� Derivative� Derivative

� Control is based on an Error signal� Control is based on an Error signal� Control is based on an Error signal

Implemented in LabVIEW using the� Implemented in LabVIEW using the� Implemented in LabVIEW using the� Implemented in LabVIEW using thePID VIPID VIPID VI

Set PointSet PointOutput

Set Point

Process VariableOutput

Process VariableOutput

Process Variable

Page 15: Real Time System Design - University of Guelph LABs PPP/Lab … · ENGG*4420 Real Time System Design (mmayhew@uoguelph.ca ) FVMI 219A (Connected to 219) Friday 2:30 -5:20 Monday 2:30

9 /6 /2 0 1 2

1 5

Lab EquationsLab EquationsLab EquationsLab Equations

� Unclear formulas for lab 1 in printed� Unclear formulas for lab 1 in printed� Unclear formulas for lab 1 in printedmanual.

� Unclear formulas for lab 1 in printedmanual.manual.manual.

� Eqn. 2(a), heat loss in control volume:� Eqn. 2(a), heat loss in control volume:� Eqn. 2(a), heat loss in control volume:� Eqn. 2(a), heat loss in control volume:

1Tq ∆=

1T

Rqt ∆=

1T

Rqt ∆=

R

� Eqn. 8(a), general formula for response� Eqn. 8(a), general formula for response� Eqn. 8(a), general formula for responseof first order system with dead time:of first order system with dead time:of first order system with dead time:

τ td +−τ td +−

)1)(originalinfinite( τ

τ td

eVVKV

+−

−∆+∆=∆ )1)(originalinfinite( τO eVVKV −∆+∆=∆ )1)(originalinfinite( τO eVVKV −∆+∆=∆

Page 16: Real Time System Design - University of Guelph LABs PPP/Lab … · ENGG*4420 Real Time System Design (mmayhew@uoguelph.ca ) FVMI 219A (Connected to 219) Friday 2:30 -5:20 Monday 2:30

9 /6 /2 0 1 2

1 6

Lab 1 Requirements/StepsLab 1 Requirements/StepsLab 1 Requirements/StepsLab 1 Requirements/Steps

� Step 1: Study and understand the� Step 1: Study and understand the� Step 1: Study and understand the� Step 1: Study and understand theimplementation files provided:implementation files provided:implementation files provided:

� Hot Air Plant Model CD Vis Lab1.vi.� Hot Air Plant Model CD Vis Lab1.vi.� Hot Air Plant Model CD Vis Lab1.vi.

� Engg4420_example.c� Engg4420_example.c� Engg4420_example.c

� Engg4420_example.h� Engg4420_example.h� Engg4420_example.hC:\engg4420_lab1_labview� C:\engg4420_lab1_labview� C:\engg4420_lab1_labview

� C:\engg4420_lab1� C:\engg4420_lab1� C:\engg4420_lab1

16ENGG*4420 Lab 1 16

Page 17: Real Time System Design - University of Guelph LABs PPP/Lab … · ENGG*4420 Real Time System Design (mmayhew@uoguelph.ca ) FVMI 219A (Connected to 219) Friday 2:30 -5:20 Monday 2:30

9 /6 /2 0 1 2

1 7

Lab 1 Requirements/StepsLab 1 Requirements/StepsLab 1 Requirements/StepsLab 1 Requirements/Steps

� Step 2: Tune the PID controller� Step 2: Tune the PID controller� Step 2: Tune the PID controllerusing the Ziegler and Nichols

� Step 2: Tune the PID controllerusing the Ziegler and Nicholsusing the Ziegler and Nicholsusing the Ziegler and Nicholsmethod.method.method.� Perform BOTH open loop, and closed� Perform BOTH open loop, and closed� Perform BOTH open loop, and closedloop tuning procedures.loop tuning procedures.loop tuning procedures.

� Step 3: Establish communication� Step 3: Establish communication� Step 3: Establish communication� Step 3: Establish communicationbetween LabVIEW and Altera.between LabVIEW and Altera.between LabVIEW and Altera.

Step 4: Graph the plant output on� Step 4: Graph the plant output on� Step 4: Graph the plant output on� Step 4: Graph the plant output onthe Altera LCD.the Altera LCD.the Altera LCD.

17ENGG*4420 Lab 1 17

Page 18: Real Time System Design - University of Guelph LABs PPP/Lab … · ENGG*4420 Real Time System Design (mmayhew@uoguelph.ca ) FVMI 219A (Connected to 219) Friday 2:30 -5:20 Monday 2:30

9 /6 /2 0 1 2

1 8

Introduction to LabVIEWIntroduction to LabVIEWIntroduction to LabVIEWIntroduction to LabVIEW

18ENGG*4420 Lab 1 18

Page 19: Real Time System Design - University of Guelph LABs PPP/Lab … · ENGG*4420 Real Time System Design (mmayhew@uoguelph.ca ) FVMI 219A (Connected to 219) Friday 2:30 -5:20 Monday 2:30

9 /6 /2 0 1 2

1 9

LabVIEWLabVIEWLabVIEWLabVIEW

� Graphical development environment.� Graphical development environment.� Graphical development environment.� Graphical development environment.

� Used for measurements, data� Used for measurements, data� Used for measurements, data� Used for measurements, dataacquisition, measurement analysis,acquisition, measurement analysis,acquisition, measurement analysis,report generation, plant modeling,report generation, plant modeling,report generation, plant modeling,report generation, plant modeling,control systems, Embedded Design,control systems, Embedded Design,control systems, Embedded Design,Signal Processing etc…Signal Processing etc…Signal Processing etc…Signal Processing etc…

� Dataflow Language� Dataflow Language� Dataflow LanguageDataflow Language

www.ni.com/labviewwww.ni.com/labviewwww.ni.com/labview

19ENGG*4420 Lab 1 19

Page 20: Real Time System Design - University of Guelph LABs PPP/Lab … · ENGG*4420 Real Time System Design (mmayhew@uoguelph.ca ) FVMI 219A (Connected to 219) Friday 2:30 -5:20 Monday 2:30

9 /6 /2 0 1 2

2 0

LabVIEW Virtual Instruments LabVIEW Virtual Instruments LabVIEW Virtual Instruments LabVIEW Virtual Instruments (VIs)(VIs)(VIs)(VIs)(VIs)

� Built in functions used to develop� Built in functions used to develop� Built in functions used to develop� Built in functions used to developapplications.applications.applications.

� Each VI requires a specific number of� Each VI requires a specific number of� Each VI requires a specific number of

inputs.inputs.inputs.inputs.

Select a VI and press “ctrl+H” for information�Select a VI and press “ctrl+H” for information�Select a VI and press “ctrl+H” for information

regarding the VI.regarding the VI.regarding the VI.

20ENGG*4420 Lab 1 20

Page 21: Real Time System Design - University of Guelph LABs PPP/Lab … · ENGG*4420 Real Time System Design (mmayhew@uoguelph.ca ) FVMI 219A (Connected to 219) Friday 2:30 -5:20 Monday 2:30

9 /6 /2 0 1 2

2 1

Front PanelFront PanelFront PanelFront Panel

� Contains the user interface.� Contains the user interface.� Contains the user interface.� Contains the user interface.

21ENGG*4420 Lab 1 21

Page 22: Real Time System Design - University of Guelph LABs PPP/Lab … · ENGG*4420 Real Time System Design (mmayhew@uoguelph.ca ) FVMI 219A (Connected to 219) Friday 2:30 -5:20 Monday 2:30

9 /6 /2 0 1 2

2 2

Block DiagramBlock DiagramBlock DiagramBlock Diagram

� Contains the VIs and the necessary� Contains the VIs and the necessary� Contains the VIs and the necessary� Contains the VIs and the necessaryconnections.connections.connections.

� Execution Control (loops, case� Execution Control (loops, case� Execution Control (loops, casestructures, formula node, etc…).structures, formula node, etc…).structures, formula node, etc…).

� Arithmetic Operations, Functions,� Arithmetic Operations, Functions,� Arithmetic Operations, Functions,Communication.Communication.Communication.

22ENGG*4420 Lab 1 22

Page 23: Real Time System Design - University of Guelph LABs PPP/Lab … · ENGG*4420 Real Time System Design (mmayhew@uoguelph.ca ) FVMI 219A (Connected to 219) Friday 2:30 -5:20 Monday 2:30

9 /6 /2 0 1 2

2 3

Altera Nios II EmbeddedAltera Nios II EmbeddedAltera Nios II EmbeddedAltera Nios II EmbeddedEvaluation KitEvaluation KitEvaluation KitEvaluation Kit

23ENGG*4420 Lab 1 23

Page 24: Real Time System Design - University of Guelph LABs PPP/Lab … · ENGG*4420 Real Time System Design (mmayhew@uoguelph.ca ) FVMI 219A (Connected to 219) Friday 2:30 -5:20 Monday 2:30

9 /6 /2 0 1 2

2 4

Altera Nios II Board DevicesAltera Nios II Board DevicesAltera Nios II Board DevicesAltera Nios II Board Devices

16 MB of Intel P30/P33 flash.� 16 MB of Intel P30/P33 flash.� 16 MB of Intel P30/P33 flash.� 16 MB of Intel P30/P33 flash.� 32 MB of DDR SDRAM.� 32 MB of DDR SDRAM.� 32 MB of DDR SDRAM.� Color LCD touch-screen display. � Color LCD touch-screen display. � Color LCD touch-screen display. � USB connector. � USB connector. � USB connector. � USB connector. � Serial connector.� Serial connector.� Serial connector.� 10/100 Ethernet physical layer/media � 10/100 Ethernet physical layer/media � 10/100 Ethernet physical layer/media

access control (PHY/MAC).access control (PHY/MAC).access control (PHY/MAC).� Six push buttons total.� Six push buttons total.� Six push buttons total.

Seven LEDs total.� Seven LEDs total.� Seven LEDs total.� Seven LEDs total.� Embedded FPGA board. � Embedded FPGA board. � Embedded FPGA board.

24ENGG*4420 Lab 1 24

Page 25: Real Time System Design - University of Guelph LABs PPP/Lab … · ENGG*4420 Real Time System Design (mmayhew@uoguelph.ca ) FVMI 219A (Connected to 219) Friday 2:30 -5:20 Monday 2:30

9 /6 /2 0 1 2

2 5

Altera Nios II IDEAltera Nios II IDEAltera Nios II IDEAltera Nios II IDE

� Altera -> Nios II EDS 8.0 -> Nios II� Altera -> Nios II EDS 8.0 -> Nios II� Altera -> Nios II EDS 8.0 -> Nios II� Altera -> Nios II EDS 8.0 -> Nios IIIDE 8.0IDE 8.0IDE 8.0

� Examples are located at� Examples are located at� Examples are located at‘C:\Altera\80\nios2eds\examples’‘C:\Altera\80\nios2eds\examples’‘C:\Altera\80\nios2eds\examples’‘C:\Altera\80\nios2eds\examples’

� Follow ‘ENGG4420_example.c’ for� Follow ‘ENGG4420_example.c’ for� Follow ‘ENGG4420_example.c’ for� Follow ‘ENGG4420_example.c’ forrelevant operations.relevant operations.relevant operations.

LCD + Multitasking + Serial Comm.� LCD + Multitasking + Serial Comm.� LCD + Multitasking + Serial Comm.� LCD + Multitasking + Serial Comm.

25ENGG*4420 Lab 1 25

Page 26: Real Time System Design - University of Guelph LABs PPP/Lab … · ENGG*4420 Real Time System Design (mmayhew@uoguelph.ca ) FVMI 219A (Connected to 219) Friday 2:30 -5:20 Monday 2:30

9 /6 /2 0 1 2

2 6

� uC/OS-II is a highly portable, very scalable,� uC/OS-II is a highly portable, very scalable,� uC/OS-II is a highly portable, very scalable,preemptive real-time, deterministic, multitaskingpreemptive real-time, deterministic, multitaskingpreemptive real-time, deterministic, multitaskingkernel.kernel.kernel.

� It can manage up to 64 tasks.� It can manage up to 64 tasks.� It can manage up to 64 tasks.

� Certain task priority levels are reserved.� Certain task priority levels are reserved.� Certain task priority levels are reserved.

� Lower Number = Higher Priority.� Lower Number = Higher Priority.� Lower Number = Higher Priority.

It has connectivity with uC/GUI and uC/FS.� It has connectivity with uC/GUI and uC/FS.� It has connectivity with uC/GUI and uC/FS.

� It is ported to more than 100 microprocessors� It is ported to more than 100 microprocessorsand microcontrollers.

� It is ported to more than 100 microprocessorsand microcontrollers.and microcontrollers.

� It supports all type of processors from 8 to 64� It supports all type of processors from 8 to 64bits.

� It supports all type of processors from 8 to 64bits.bits.

26ENGG*4420 Lab 1 26

Page 27: Real Time System Design - University of Guelph LABs PPP/Lab … · ENGG*4420 Real Time System Design (mmayhew@uoguelph.ca ) FVMI 219A (Connected to 219) Friday 2:30 -5:20 Monday 2:30

9 /6 /2 0 1 2

2 7

How to implement Lab1?How to implement Lab1?How to implement Lab1?How to implement Lab1?

1. Read chapter 1 of the lab manual.1. Read chapter 1 of the lab manual.1. Read chapter 1 of the lab manual.2. Preparation 1- Review the Implementation2. Preparation 1- Review the Implementation2. Preparation 1- Review the Implementation

of the Plant System.of the Plant System.of the Plant System.� Hot Air Plant Model Vis Lab1.vi� Hot Air Plant Model Vis Lab1.vi� Hot Air Plant Model Vis Lab1.vi� !Hot Air Plant Model CD Vis Lab1.vi!� !Hot Air Plant Model CD Vis Lab1.vi!

3. Preparation 2 – Review and Analyze the3. Preparation 2 – Review and Analyze the3. Preparation 2 – Review and Analyze theimplementation of the uC/OSII tasks.

3. Preparation 2 – Review and Analyze theimplementation of the uC/OSII tasks.implementation of the uC/OSII tasks.� ENGG4420_example.c� ENGG4420_example.c� ENGG4420_example.c� ENGG4420_example.h� ENGG4420_example.h� ENGG4420_example.h

4. Preparation 3 – Establish connection4. Preparation 3 – Establish connection4. Preparation 3 – Establish connectionbetween LabVIEW and Altera board.between LabVIEW and Altera board.between LabVIEW and Altera board.

27ENGG*4420 Lab 1 27

Page 28: Real Time System Design - University of Guelph LABs PPP/Lab … · ENGG*4420 Real Time System Design (mmayhew@uoguelph.ca ) FVMI 219A (Connected to 219) Friday 2:30 -5:20 Monday 2:30

9 /6 /2 0 1 2

2 8

How to implement Lab1? Cont.How to implement Lab1? Cont.How to implement Lab1? Cont.How to implement Lab1? Cont.

5. Tuning (Lab Manual section 1.3 – pg. 12)5. Tuning (Lab Manual section 1.3 – pg. 12)5. Tuning (Lab Manual section 1.3 – pg. 12)

� Perform Open and Closed loop tuning methods� Perform Open and Closed loop tuning methods� Perform Open and Closed loop tuning methodsto derive a set of workable PID constants.to derive a set of workable PID constants.to derive a set of workable PID constants.

6. Implement the required communication6. Implement the required communication6. Implement the required communicationtasks in LabVIEW and NIOS-II.

6. Implement the required communicationtasks in LabVIEW and NIOS-II.tasks in LabVIEW and NIOS-II.tasks in LabVIEW and NIOS-II.

Talk to your TA if you are not familiar with Talk to your TA if you are not familiar with Talk to your TA if you are not familiar with

PID controlPID controlPID control

28ENGG*4420 Lab 1 28

Page 29: Real Time System Design - University of Guelph LABs PPP/Lab … · ENGG*4420 Real Time System Design (mmayhew@uoguelph.ca ) FVMI 219A (Connected to 219) Friday 2:30 -5:20 Monday 2:30

9 /6 /2 0 1 2

2 9

How to implement Lab1? Cont.How to implement Lab1? Cont.How to implement Lab1? Cont.How to implement Lab1? Cont.

6. Cont.6. Cont.6. Cont.6. Cont.

a) LabVIEW-> Transmit the plant outputa) LabVIEW-> Transmit the plant outputa) LabVIEW-> Transmit the plant outputvalue to the Altera board using serialvalue to the Altera board using serialvalue to the Altera board using serialcommunication.communication.communication.communication.

b) Altera-> Receive the transmittedb) Altera-> Receive the transmittedb) Altera-> Receive the transmittedvalue and graph it on the LCD in RT.value and graph it on the LCD in RT.value and graph it on the LCD in RT.value and graph it on the LCD in RT.

c) Altera-> Send the output value backc) Altera-> Send the output value backc) Altera-> Send the output value backto LabVIEW.to LabVIEW.to LabVIEW.to LabVIEW.

d) LabVIEW -> Read the plant valued) LabVIEW -> Read the plant valued) LabVIEW -> Read the plant valuefrom serial IO and process it.from serial IO and process it.from serial IO and process it.from serial IO and process it.

29ENGG*4420 Lab 1 29

Page 30: Real Time System Design - University of Guelph LABs PPP/Lab … · ENGG*4420 Real Time System Design (mmayhew@uoguelph.ca ) FVMI 219A (Connected to 219) Friday 2:30 -5:20 Monday 2:30

9 /6 /2 0 1 2

3 0

Implementation SuggestionsImplementation SuggestionsImplementation SuggestionsImplementation Suggestions

� Use synchronization semaphores to� Use synchronization semaphores to� Use synchronization semaphores to� Use synchronization semaphores toorganize the communication process.organize the communication process.organize the communication process.

� Create a new RxTx_uart task on the� Create a new RxTx_uart task on the� Create a new RxTx_uart task on theAltera board. Set a delay on the taskAltera board. Set a delay on the taskAltera board. Set a delay on the taskAltera board. Set a delay on the taskthat matches the LabVIEW samplethat matches the LabVIEW samplethat matches the LabVIEW sampleinterval.interval.interval.interval.

� Create a separate task on the Altera� Create a separate task on the Altera� Create a separate task on the Alteraboard for graphing the voltageCreate a separate task on the Alteraboard for graphing the voltageboard for graphing the voltageboard for graphing the voltagevalues.values.values.

Page 31: Real Time System Design - University of Guelph LABs PPP/Lab … · ENGG*4420 Real Time System Design (mmayhew@uoguelph.ca ) FVMI 219A (Connected to 219) Friday 2:30 -5:20 Monday 2:30

9 /6 /2 0 1 2

3 1

How to set up your AlteraHow to set up your AlteraHow to set up your AlteraHow to set up your AlteraProject: IMPORTANTProject: IMPORTANTProject: IMPORTANTProject: IMPORTANT

1. Navigate to:1. Navigate to:1. Navigate to:1. Navigate to:“C:\Altera\80\kits\cycloneIII_3c25_niosII\examples”“C:\Altera\80\kits\cycloneIII_3c25_niosII\examples”“C:\Altera\80\kits\cycloneIII_3c25_niosII\examples”

2. Right-click and copy the2. Right-click and copy the2. Right-click and copy the2. Right-click and copy the“application_selector” directory.“application_selector” directory.“application_selector” directory.

3. Create a project directory on your H-3. Create a project directory on your H-3. Create a project directory on your H-drive.drive.drive.drive.

4. Paste the “application_selector” into4. Paste the “application_selector” into4. Paste the “application_selector” into4. Paste the “application_selector” intoyour project folder.your project folder.your project folder.

Page 32: Real Time System Design - University of Guelph LABs PPP/Lab … · ENGG*4420 Real Time System Design (mmayhew@uoguelph.ca ) FVMI 219A (Connected to 219) Friday 2:30 -5:20 Monday 2:30

9 /6 /2 0 1 2

3 2

How to set up your AlteraHow to set up your AlteraHow to set up your AlteraHow to set up your AlteraProject Cont.Project Cont.Project Cont.Project Cont.

5. Open the NIOS-II IDE from the start5. Open the NIOS-II IDE from the start5. Open the NIOS-II IDE from the start5. Open the NIOS-II IDE from the startmenu (found in the “Altera” sub-menu (found in the “Altera” sub-menu (found in the “Altera” sub-menu).menu).menu).menu).

6. In the “Project Location” window,6. In the “Project Location” window,6. In the “Project Location” window,6. In the “Project Location” window,enter the name of your projectenter the name of your projectenter the name of your projectdirectory.directory.directory.directory.

• “H:\Your_project_directory\workspace”• “H:\Your_project_directory\workspace”• “H:\Your_project_directory\workspace”

Page 33: Real Time System Design - University of Guelph LABs PPP/Lab … · ENGG*4420 Real Time System Design (mmayhew@uoguelph.ca ) FVMI 219A (Connected to 219) Friday 2:30 -5:20 Monday 2:30

9 /6 /2 0 1 2

3 3

How to set up your AlteraHow to set up your AlteraHow to set up your AlteraHow to set up your AlteraProject Cont.Project Cont.Project Cont.Project Cont.

7. Click on the “Workbench” option in 7. Click on the “Workbench” option in 7. Click on the “Workbench” option in 7. Click on the “Workbench” option in the top right corner.the top right corner.the top right corner.

Page 34: Real Time System Design - University of Guelph LABs PPP/Lab … · ENGG*4420 Real Time System Design (mmayhew@uoguelph.ca ) FVMI 219A (Connected to 219) Friday 2:30 -5:20 Monday 2:30

9 /6 /2 0 1 2

3 4

How to set up your Altera How to set up your Altera How to set up your Altera How to set up your Altera Project Cont.Project Cont.Project Cont.Project Cont.

8. In the workbench, go to “Tools �8. In the workbench, go to “Tools �8. In the workbench, go to “Tools �8. In the workbench, go to “Tools �

Quartus II Programmer”.Quartus II Programmer”.Quartus II Programmer”.

9. In the Programmer window, click on 9. In the Programmer window, click on 9. In the Programmer window, click on “Hardware Setup”.“Hardware Setup”.“Hardware Setup”.“Hardware Setup”.

10.Choose “USB-Blaster”.10.Choose “USB-Blaster”.10.Choose “USB-Blaster”.10.Choose “USB-Blaster”.

Page 35: Real Time System Design - University of Guelph LABs PPP/Lab … · ENGG*4420 Real Time System Design (mmayhew@uoguelph.ca ) FVMI 219A (Connected to 219) Friday 2:30 -5:20 Monday 2:30

9 /6 /2 0 1 2

3 5

How to set up your Altera How to set up your Altera How to set up your Altera How to set up your Altera Project Cont.Project Cont.Project Cont.Project Cont.

11.Click “Auto-Detect” and highlight the 11.Click “Auto-Detect” and highlight the 11.Click “Auto-Detect” and highlight the 11.Click “Auto-Detect” and highlight the default entry.default entry.default entry.

12.Choose “Change File”12.Choose “Change File”12.Choose “Change File”

13.Navigate to: 13.Navigate to: 13.Navigate to: “C:\altera\80\kits\cycloneIII_3c25_Ni“C:\altera\80\kits\cycloneIII_3c25_Ni“C:\altera\80\kits\cycloneIII_3c25_Ni“C:\altera\80\kits\cycloneIII_3c25_NiosII\examples\application_selector”osII\examples\application_selector”osII\examples\application_selector”

14.Select: 14.Select: 14.Select: 14.Select: “cycloneIII_3c25_NiosII_application_“cycloneIII_3c25_NiosII_application_“cycloneIII_3c25_NiosII_application_selector.sof”selector.sof”selector.sof”selector.sof”

Page 36: Real Time System Design - University of Guelph LABs PPP/Lab … · ENGG*4420 Real Time System Design (mmayhew@uoguelph.ca ) FVMI 219A (Connected to 219) Friday 2:30 -5:20 Monday 2:30

9 /6 /2 0 1 2

3 6

How to set up your Altera How to set up your Altera How to set up your Altera How to set up your Altera Project Cont.Project Cont.Project Cont.Project Cont.

15.Click on “Start” to download the file 15.Click on “Start” to download the file 15.Click on “Start” to download the file 15.Click on “Start” to download the file to the FPGA.to the FPGA.to the FPGA.

Note: The Application Selector Must Be Note: The Application Selector Must Be Note: The Application Selector Must Be Downloaded Before You Will Be Able Downloaded Before You Will Be Able Downloaded Before You Will Be Able Downloaded Before You Will Be Able to Load Your Project On the Board!to Load Your Project On the Board!to Load Your Project On the Board!

Page 37: Real Time System Design - University of Guelph LABs PPP/Lab … · ENGG*4420 Real Time System Design (mmayhew@uoguelph.ca ) FVMI 219A (Connected to 219) Friday 2:30 -5:20 Monday 2:30

9 /6 /2 0 1 2

3 7

How to set up your Altera How to set up your Altera How to set up your Altera How to set up your Altera Project Cont.Project Cont.Project Cont.Project Cont.

16.In your 16.In your 16.In your 16.In your workbench, go to workbench, go to workbench, go to “File � Import”.“File � Import”.“File � Import”.“File � Import”.

17.Select “Altera 17.Select “Altera 17.Select “Altera 17.Select “Altera NIOS-II � Existing NIOS-II � Existing NIOS-II � Existing

NIOS II IDE NIOS II IDE NIOS II IDE NIOS II IDE project into project into project into workspace”.workspace”.workspace”.

Page 38: Real Time System Design - University of Guelph LABs PPP/Lab … · ENGG*4420 Real Time System Design (mmayhew@uoguelph.ca ) FVMI 219A (Connected to 219) Friday 2:30 -5:20 Monday 2:30

9 /6 /2 0 1 2

3 8

How to set up your Altera How to set up your Altera How to set up your Altera How to set up your Altera Project Cont.Project Cont.Project Cont.Project Cont.

18.Browse to you project directory.18.Browse to you project directory.18.Browse to you project directory.18.Browse to you project directory.

• “H:\your_project_directory\application_s• “H:\your_project_directory\application_s• “H:\your_project_directory\application_selector\software”elector\software”elector\software”

19.Import the “engg4420_lab1” folder.19.Import the “engg4420_lab1” folder.19.Import the “engg4420_lab1” folder.

20.When prompted, click “Yes” to20.When prompted, click “Yes” to20.When prompted, click “Yes” to“Release and/or Debug directories”.“Release and/or Debug directories”.“Release and/or Debug directories”.“Release and/or Debug directories”.

21.Repeat steps 16-21 for the21.Repeat steps 16-21 for the21.Repeat steps 16-21 for the21.Repeat steps 16-21 for the“engg4420_lab_1_syslib_folder”“engg4420_lab_1_syslib_folder”“engg4420_lab_1_syslib_folder”

Page 39: Real Time System Design - University of Guelph LABs PPP/Lab … · ENGG*4420 Real Time System Design (mmayhew@uoguelph.ca ) FVMI 219A (Connected to 219) Friday 2:30 -5:20 Monday 2:30

9 /6 /2 0 1 2

3 9

How to set up your Altera How to set up your Altera How to set up your Altera How to set up your Altera Project Cont.Project Cont.Project Cont.Project Cont.

22.You can now right click on the engg4420_lab122.You can now right click on the engg4420_lab122.You can now right click on the engg4420_lab1directory to build and run your project.directory to build and run your project.directory to build and run your project.

Page 40: Real Time System Design - University of Guelph LABs PPP/Lab … · ENGG*4420 Real Time System Design (mmayhew@uoguelph.ca ) FVMI 219A (Connected to 219) Friday 2:30 -5:20 Monday 2:30

9 /6 /2 0 1 2

4 0

How to set up your Altera How to set up your Altera How to set up your Altera How to set up your Altera Project Cont.Project Cont.Project Cont.Project Cont.

� Note: Whenever� Note: Whenever� Note: Whenever� Note: Wheneveryou open theyou open theyou open theNIOS-II IDE, youNIOS-II IDE, youNIOS-II IDE, youNIOS-II IDE, youwill need to switchwill need to switchwill need to switchthe workspace tothe workspace tothe workspace tothe workspace toyour H drive as theyour H drive as theyour H drive as theIDE will default toIDE will default toIDE will default tothe C-drive.IDE will default tothe C-drive.the C-drive.the C-drive.

Page 41: Real Time System Design - University of Guelph LABs PPP/Lab … · ENGG*4420 Real Time System Design (mmayhew@uoguelph.ca ) FVMI 219A (Connected to 219) Friday 2:30 -5:20 Monday 2:30

9 /6 /2 0 1 2

4 1

Notes - How to set up Hyper Notes - How to set up Hyper Notes - How to set up Hyper TerminalTerminalTerminalTerminal

� Start� All Programs �� Start� All Programs �� Start� All Programs �Accessories �Accessories �Accessories �Communication� Hyper Communication� Hyper Communication� Hyper Terminal � Assign a Terminal � Assign a Terminal � Assign a name to your hyper name to your hyper name to your hyper terminal � select COM1 terminal � select COM1 terminal � select COM1 � select 115200, 8, � select 115200, 8, None, 1, None.� select 115200, 8, None, 1, None.None, 1, None.None, 1, None.

41ENGG*4420 Lab 1 41

Page 42: Real Time System Design - University of Guelph LABs PPP/Lab … · ENGG*4420 Real Time System Design (mmayhew@uoguelph.ca ) FVMI 219A (Connected to 219) Friday 2:30 -5:20 Monday 2:30

9 /6 /2 0 1 2

4 2

Notes - LabVIEWNotes - LabVIEWNotes - LabVIEWNotes - LabVIEW

� Occasionally, you may need to� Occasionally, you may need to� Occasionally, you may need to� Occasionally, you may need toconvert data for interconnectivity.convert data for interconnectivity.convert data for interconnectivity.This can be done using theThis can be done using theThis can be done using theThis can be done using theconversion blocks (Mathematics �conversion blocks (Mathematics �conversion blocks (Mathematics �

Numeric � Conversion)Numeric � Conversion)Numeric � Conversion)Numeric � Conversion)

42ENGG*4420 Lab 1 42

Page 43: Real Time System Design - University of Guelph LABs PPP/Lab … · ENGG*4420 Real Time System Design (mmayhew@uoguelph.ca ) FVMI 219A (Connected to 219) Friday 2:30 -5:20 Monday 2:30

9 /6 /2 0 1 2

4 3

Notes - LabVIEWNotes - LabVIEWNotes - LabVIEWNotes - LabVIEW

� Local Variables can be� Local Variables can be� Local Variables can beused to give inputs toused to give inputs toused to give inputs tocontrols. They can beused to give inputs tocontrols. They can becontrols. They can becontrols. They can befound in the “Structures”found in the “Structures”found in the “Structures”section of the functionsection of the functionsection of the functionpalette. You can configurepalette. You can configurepalette. You can configurethem to be either read orthem to be either read orthem to be either read orwrite depending thewrite depending thewrite depending therequired operation.required operation.required operation.

43ENGG*4420 Lab 1 43

Page 44: Real Time System Design - University of Guelph LABs PPP/Lab … · ENGG*4420 Real Time System Design (mmayhew@uoguelph.ca ) FVMI 219A (Connected to 219) Friday 2:30 -5:20 Monday 2:30

9 /6 /2 0 1 2

4 4

Notes - LabVIEWNotes - LabVIEWNotes - LabVIEWNotes - LabVIEW

� Queues provide a means of transmitting data.� Queues provide a means of transmitting data.� Queues provide a means of transmitting data.

� Queues can be used as an alternative to local� Queues can be used as an alternative to local� Queues can be used as an alternative to localvariables for passing data between tasks/loops.variables for passing data between tasks/loops.variables for passing data between tasks/loops.

� After creating a queue, elements can be� After creating a queue, elements can be� After creating a queue, elements can bequeued and dequeued.queued and dequeued.queued and dequeued.

� FIFO nature.� FIFO nature.� FIFO nature.

� VIs in “Data Communication � Queue� VIs in “Data Communication � Queue� VIs in “Data Communication � Queue

Operations”.Operations”.Operations”.

Page 45: Real Time System Design - University of Guelph LABs PPP/Lab … · ENGG*4420 Real Time System Design (mmayhew@uoguelph.ca ) FVMI 219A (Connected to 219) Friday 2:30 -5:20 Monday 2:30

9 /6 /2 0 1 2

4 5

Notes - LabVIEWNotes - LabVIEWNotes - LabVIEWNotes - LabVIEW

� When setting up a feedback node,� When setting up a feedback node,� When setting up a feedback node,� When setting up a feedback node,you need to wire in a constant fromyou need to wire in a constant fromyou need to wire in a constant fromoutside the loop for initialization.outside the loop for initialization.outside the loop for initialization.outside the loop for initialization.

45ENGG*4420 Lab 1 45

Page 46: Real Time System Design - University of Guelph LABs PPP/Lab … · ENGG*4420 Real Time System Design (mmayhew@uoguelph.ca ) FVMI 219A (Connected to 219) Friday 2:30 -5:20 Monday 2:30

9 /6 /2 0 1 2

4 6

Notes - LabVIEWNotes - LabVIEWNotes - LabVIEWNotes - LabVIEW

� To easily locate VIs use the search� To easily locate VIs use the search� To easily locate VIs use the search� To easily locate VIs use the searchtool in the functions and controlstool in the functions and controlstool in the functions and controlspanels.panels.panels.panels.

46ENGG*4420 Lab 1 46

Page 47: Real Time System Design - University of Guelph LABs PPP/Lab … · ENGG*4420 Real Time System Design (mmayhew@uoguelph.ca ) FVMI 219A (Connected to 219) Friday 2:30 -5:20 Monday 2:30

9 /6 /2 0 1 2

4 7

Notes - LabVIEWNotes - LabVIEWNotes - LabVIEWNotes - LabVIEW

� The trace function can be used to� The trace function can be used to� The trace function can be used to� The trace function can be used totrack internal signals on the blocktrack internal signals on the blocktrack internal signals on the blockdiagram.diagram.diagram.diagram.

� Note that since execution is slowed down� Note that since execution is slowed down� Note that since execution is slowed downwhile running trace, timing andwhile running trace, timing andwhile running trace, timing andinterfacing will likely not work correctly.interfacing will likely not work correctly.interfacing will likely not work correctly.

Page 48: Real Time System Design - University of Guelph LABs PPP/Lab … · ENGG*4420 Real Time System Design (mmayhew@uoguelph.ca ) FVMI 219A (Connected to 219) Friday 2:30 -5:20 Monday 2:30

9 /6 /2 0 1 2

4 8

Note – LabVIEW examplesNote – LabVIEW examplesNote – LabVIEW examplesNote – LabVIEW examples

� LabVIEW� LabVIEW� LabVIEWexamples can

� LabVIEWexamples canexamples canexamples canbe found in thebe found in thebe found in the‘Help’ Menu‘Help’ Menu‘Help’ Menuunder ‘Findunder ‘Findunder ‘Findunder ‘FindExamples’.Examples’.Examples’.

Page 49: Real Time System Design - University of Guelph LABs PPP/Lab … · ENGG*4420 Real Time System Design (mmayhew@uoguelph.ca ) FVMI 219A (Connected to 219) Friday 2:30 -5:20 Monday 2:30

9 /6 /2 0 1 2

4 9

Note – LabVIEW examplesNote – LabVIEW examplesNote – LabVIEW examplesNote – LabVIEW examples

� Examples� Examples� Examplesusing specific

� Examplesusing specificusing specificusing specificVIs can beVIs can beVIs can befound throughfound throughfound throughthe ‘contextthe ‘contextthe ‘contextthe ‘contexthelp’.help’.help’.

Page 50: Real Time System Design - University of Guelph LABs PPP/Lab … · ENGG*4420 Real Time System Design (mmayhew@uoguelph.ca ) FVMI 219A (Connected to 219) Friday 2:30 -5:20 Monday 2:30

9 /6 /2 0 1 2

5 0

Notes – Serial CommunicationNotes – Serial CommunicationNotes – Serial CommunicationNotes – Serial Communication

� LV serial comm. is performed using NI� LV serial comm. is performed using NI� LV serial comm. is performed using NIVISA.

� LV serial comm. is performed using NIVISA.VISA.VISA.

� Perform the serial port write operation� Perform the serial port write operation� Perform the serial port write operation� Perform the serial port write operationusing a termination char.using a termination char.using a termination char.

See the “Advanced Serial Write and� See the “Advanced Serial Write and� See the “Advanced Serial Write and� See the “Advanced Serial Write andRead.vi” example.Read.vi” example.Read.vi” example.

Setup serial comm. Write to serial port Read from serial portSetup serial comm. Write to serial port Read from serial port

50ENGG*4420 Lab 1 50

Page 51: Real Time System Design - University of Guelph LABs PPP/Lab … · ENGG*4420 Real Time System Design (mmayhew@uoguelph.ca ) FVMI 219A (Connected to 219) Friday 2:30 -5:20 Monday 2:30

9 /6 /2 0 1 2

5 1

Note – Serial Communication Cont.Note – Serial Communication Cont.Note – Serial Communication Cont.

� Order of operations:� Order of operations:� Order of operations:� Configure serial port:� Configure serial port:� Configure serial port:

� Enable read on termination char.� Enable read on termination char.� Enable read on termination char.

� Set termination char.� Set termination char.� Set termination char.

� Set timeout.� Set timeout.� Set timeout.

� Define VISA resource (COM1 or COM2).� Define VISA resource (COM1 or COM2).� Define VISA resource (COM1 or COM2).

� Define Baud rate ….� Define Baud rate ….� Define Baud rate ….

� Define ‘write’ termination char.� Define ‘write’ termination char.� Define ‘write’ termination char.

� Define input buffer size.� Define input buffer size.� Define input buffer size.

� Write string (data must be in char not float).� Write string (data must be in char not float).� Write string (data must be in char not float).

� Close session at end.� Close session at end.� Close session at end.

Page 52: Real Time System Design - University of Guelph LABs PPP/Lab … · ENGG*4420 Real Time System Design (mmayhew@uoguelph.ca ) FVMI 219A (Connected to 219) Friday 2:30 -5:20 Monday 2:30

9 /6 /2 0 1 2

5 2

Things to Note in the Altera Things to Note in the Altera Things to Note in the Altera Things to Note in the Altera ExampleExampleExampleExample

� Task Creation� Task Creation� Task Creation

� Where are task stacks, priorities, etc. set?� Where are task stacks, priorities, etc. set?� Where are task stacks, priorities, etc. set?

� Where are tasks created and initialized?� Where are tasks created and initialized?� Where are tasks created and initialized?

� Semaphors and Mutexes� Semaphors and Mutexes� Semaphors and Mutexes

� How are they created?� How are they created?� How are they created?

� What functions are used to Pend and Post?� What functions are used to Pend and Post?� What functions are used to Pend and Post?

Timing� Timing� Timing

� What functions can be used for delays?� What functions can be used for delays?� What functions can be used for delays?

� LCD Functions� LCD Functions� LCD Functions

� Look at header file as well as the main code.� Look at header file as well as the main code.� Look at header file as well as the main code.

Page 53: Real Time System Design - University of Guelph LABs PPP/Lab … · ENGG*4420 Real Time System Design (mmayhew@uoguelph.ca ) FVMI 219A (Connected to 219) Friday 2:30 -5:20 Monday 2:30

9 /6 /2 0 1 2

5 3

Demo MarkingDemo MarkingDemo MarkingDemo Marking

� Front Panel� Front Panel� Front Panel

� All necessary controls/graphs present� All necessary controls/graphs present� All necessary controls/graphs present

� Tuning Procedure� Tuning Procedure� Tuning Procedure

� Open and Closed loop� Open and Closed loop� Open and Closed loop

� Functional PID settings� Functional PID settings� Functional PID settings

� Altera Board� Altera Board� Altera Board

Communication� Communication� Communication

� LCD Display� LCD Display� LCD Display

� Questions� Questions� Questions

� Answered individually, 2/3 chances� Answered individually, 2/3 chances� Answered individually, 2/3 chances

Page 54: Real Time System Design - University of Guelph LABs PPP/Lab … · ENGG*4420 Real Time System Design (mmayhew@uoguelph.ca ) FVMI 219A (Connected to 219) Friday 2:30 -5:20 Monday 2:30

9 /6 /2 0 1 2

5 4

Lab ReportLab ReportLab ReportLab Report

� General outline presented on Page 68 � General outline presented on Page 68 � General outline presented on Page 68 � General outline presented on Page 68 of Lab Manual (Appendix A).of Lab Manual (Appendix A).of Lab Manual (Appendix A).

� Introduction & Problem Description� Introduction & Problem Description� Introduction & Problem Description

� System Requirements� System Requirements� System Requirements

What do you have to implement?� What do you have to implement?� What do you have to implement?� What do you have to implement?

� Inputs� Inputs� Inputs

� Outputs� Outputs� Outputs

� Calculations� Calculations

� Relation to physical system, etc.� Relation to physical system, etc.� Relation to physical system, etc.

Page 55: Real Time System Design - University of Guelph LABs PPP/Lab … · ENGG*4420 Real Time System Design (mmayhew@uoguelph.ca ) FVMI 219A (Connected to 219) Friday 2:30 -5:20 Monday 2:30

9 /6 /2 0 1 2

5 5

Lab Report Cont.Lab Report Cont.Lab Report Cont.Lab Report Cont.

� Background� Background� Background

� Why use LabVIEW to simulate the system?� Why use LabVIEW to simulate the system?� Why use LabVIEW to simulate the system?

� PID tuning and comparison of results.� PID tuning and comparison of results.� PID tuning and comparison of results.

� Implementation� Implementation� Implementation

� Top-Down functional implementation� Top-Down functional implementation� Top-Down functional implementation

� Main modules and functions on each module� Main modules and functions on each module� Main modules and functions on each module

� Connections between modules� Connections between modules� Connections between modules

� Description of LabVIEW and Altera� Description of LabVIEW and Altera� Description of LabVIEW and AlteraImplementations.Implementations.Implementations.

� Discussion of simulation parameters.� Discussion of simulation parameters.� Discussion of simulation parameters.

Page 56: Real Time System Design - University of Guelph LABs PPP/Lab … · ENGG*4420 Real Time System Design (mmayhew@uoguelph.ca ) FVMI 219A (Connected to 219) Friday 2:30 -5:20 Monday 2:30

9 /6 /2 0 1 2

5 6

Lab Report Cont.Lab Report Cont.Lab Report Cont.Lab Report Cont.

� Include pictures of front panel, block� Include pictures of front panel, block� Include pictures of front panel, block� Include pictures of front panel, blockdiagram, and code snippets in maindiagram, and code snippets in maindiagram, and code snippets in mainreport where appropriate.report where appropriate.report where appropriate.report where appropriate.

� Full images of front panel, block� Full images of front panel, block� Full images of front panel, block� Full images of front panel, blockdiagram, and all Altera code indiagram, and all Altera code indiagram, and all Altera code inAppendix.Appendix.Appendix.Appendix.

Page 57: Real Time System Design - University of Guelph LABs PPP/Lab … · ENGG*4420 Real Time System Design (mmayhew@uoguelph.ca ) FVMI 219A (Connected to 219) Friday 2:30 -5:20 Monday 2:30

9 /6 /2 0 1 2

5 7

Deadlines and MarkingDeadlines and MarkingDeadlines and MarkingDeadlines and Marking

� Lab 1 is worth 8%.� Lab 1 is worth 8%.� Lab 1 is worth 8%.

� 4% for the report, and 4% for the demo.� 4% for the report, and 4% for the demo.� 4% for the report, and 4% for the demo.

� The Demo is due Sep. 28th/Oct 1st , 2012 in the� The Demo is due Sep. 28th/Oct 1st , 2012 in the� The Demo is due Sep. 28 /Oct 1 , 2012 in theLab.Lab.Lab.

� The Report is due Sep. 28th/Oct 1st, 2012 in the� The Report is due Sep. 28th/Oct 1st, 2012 in the� The Report is due Sep. 28th/Oct 1st, 2012 in theLab.Lab.Lab.

� Physical and Electronic copy.� Physical and Electronic copy.� Physical and Electronic copy.

� A signed group evaluation sheet must be� A signed group evaluation sheet must be� A signed group evaluation sheet must besubmitted with the lab report.submitted with the lab report.submitted with the lab report.

Do NOT include student numbers on lab report.� Do NOT include student numbers on lab report.� Do NOT include student numbers on lab report.

57ENGG*4420 Lab 1 57