ece 4510 introduction to lab final reviewbazuinb/ece4510/review_labfinal.pdf · ece 4510...

21
Material from or based on: The HCS12/9S12: An Introduction to Software & Hardware Interfacing, Thomson Delmar Learning, 2006. ECE 4510 Introduction to Microprocessors Lab Final Review Dr. Bradley J. Bazuin Associate Professor Department of Electrical and Computer Engineering College of Engineering and Applied Sciences

Upload: nguyendung

Post on 24-May-2018

224 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: ECE 4510 Introduction to Lab Final Reviewbazuinb/ECE4510/Review_LabFinal.pdf · ECE 4510 Introduction to Microprocessors Lab Final Review ... 4) Polled I/O ... Interfacing a keypad

Material from or based on: The HCS12/9S12: An Introduction to Software & Hardware Interfacing, Thomson Delmar Learning, 2006.

ECE 4510 Introduction to Microprocessors

Lab Final Review

Dr. Bradley J. BazuinAssociate Professor

Department of Electrical and Computer EngineeringCollege of Engineering and Applied Sciences

Page 2: ECE 4510 Introduction to Lab Final Reviewbazuinb/ECE4510/Review_LabFinal.pdf · ECE 4510 Introduction to Microprocessors Lab Final Review ... 4) Polled I/O ... Interfacing a keypad

Material from or based on: The HCS12/9S12: An Introduction to Software & Hardware Interfacing, Thomson Delmar Learning, 2006.

Ground Rules

• What you should bring– All the hardware: development boards and complete parts kit– USB drive with all previous lab and project information (code,

reports, schematics, etc.)

• What else you might want to bring– Textbook and data sheets for the HC12 and parts– Written lab reports and schematics– Organized code library of useful stuff on your USB drive

• As a rule: open book, open notes, your own USB memory stick and a lab computer that has the required software and tools.

ECE 4510 2

Page 3: ECE 4510 Introduction to Lab Final Reviewbazuinb/ECE4510/Review_LabFinal.pdf · ECE 4510 Introduction to Microprocessors Lab Final Review ... 4) Polled I/O ... Interfacing a keypad

Material from or based on: The HCS12/9S12: An Introduction to Software & Hardware Interfacing, Thomson Delmar Learning, 2006.

What makes a good lab final ?

• A question with multiple parts that:– Involves one element that is new

• Has a hardware build that has not been done in a lab yet.• Requires some type of timing relationship between output or input

signals that must be accomplished to operate.• Will require the construction of a main software program and possibly

one or two functions to operate the new hardware.– Involves multiple element that are familiar

• Incorporate peripheral elements involving hardware and software that have been accomplished in a lab or project.

• Existing software initialization and operational function calls can be readily copied and used in the code.

– Has identifiable levels of operational success so that scoring can be directly related to what has been accomplished.

ECE 4510 3

Page 4: ECE 4510 Introduction to Lab Final Reviewbazuinb/ECE4510/Review_LabFinal.pdf · ECE 4510 Introduction to Microprocessors Lab Final Review ... 4) Polled I/O ... Interfacing a keypad

Material from or based on: The HCS12/9S12: An Introduction to Software & Hardware Interfacing, Thomson Delmar Learning, 2006.

Studying vs. Organizing

• Studying is great but …• Reviewing and organizing all the work requested and

performed in the labs and projects may be better.– If a lab and task is mentioned, can you find the schematic and code

quickly?– If a hardware item is mentioned (for example an LM35), can you

find the schematic and code that is needed to use it?

ECE 4510 4

Page 5: ECE 4510 Introduction to Lab Final Reviewbazuinb/ECE4510/Review_LabFinal.pdf · ECE 4510 Introduction to Microprocessors Lab Final Review ... 4) Polled I/O ... Interfacing a keypad

Material from or based on: The HCS12/9S12: An Introduction to Software & Hardware Interfacing, Thomson Delmar Learning, 2006.

Laboratory Review

1) Introduction to the 9S12DP256: Program Development Environment2) Parallel Input/Output and Software Delay Loops3) Advanced Input and Output Devices4) Polled I/O Interface, Non-TTL Output Interface and Generating Periodic

Outputs5) ECT Input Capture, PWM and SCI Messaging6) μC/OS-II, a real-time operating system7) Serial Peripheral Interface (SPI) and Digital-to-Analog Converter (DAC).8) Serial Peripheral Interface (SPI), Digital-to-Analog Converter (DAC),

Analog-to-Digital Converter (ADC), and Temperature.9) Inter-Integrated Circuit (I2C) Interface and Real-Time Clock/Calendar.10) Distance Measurement Using Ultrasound.11) Control Area Network (CAN) Interface.

ECE 4510 5

Page 6: ECE 4510 Introduction to Lab Final Reviewbazuinb/ECE4510/Review_LabFinal.pdf · ECE 4510 Introduction to Microprocessors Lab Final Review ... 4) Polled I/O ... Interfacing a keypad

Material from or based on: The HCS12/9S12: An Introduction to Software & Hardware Interfacing, Thomson Delmar Learning, 2006.

Project Review

1) One Dimensional Ping Pong2) A Microcontroller Calculator with LCD Display3) Moving an Object on a Conveyor Belt

ECE 4510 6

Page 7: ECE 4510 Introduction to Lab Final Reviewbazuinb/ECE4510/Review_LabFinal.pdf · ECE 4510 Introduction to Microprocessors Lab Final Review ... 4) Polled I/O ... Interfacing a keypad

Material from or based on: The HCS12/9S12: An Introduction to Software & Hardware Interfacing, Thomson Delmar Learning, 2006.

Laboratory One

• Introduction to the 9S12DP256: Program Development Environment and Flash Programming

• Objectives:1. To learn the use of the ICC12 Integrated Development Environment

(IDE) along with the NOICE12 Background Debug Module (BDM) and software.

2. To practice with the Editor, the Assembler, and the C Compiler of the IDE and with the NOICE12 commands.

3. To familiarize with HC12 assembly programming and with the syntax of a simple C program.

4. To practice the use of the ICC12-BDM12SX-NOICE12 environment for program development

5. To familiarize with programming of the Flash Memory of the 9S12DP256 Microcontroller.

ECE 4510 7

Page 8: ECE 4510 Introduction to Lab Final Reviewbazuinb/ECE4510/Review_LabFinal.pdf · ECE 4510 Introduction to Microprocessors Lab Final Review ... 4) Polled I/O ... Interfacing a keypad

Material from or based on: The HCS12/9S12: An Introduction to Software & Hardware Interfacing, Thomson Delmar Learning, 2006.

Laboratory Two

• Parallel Input/Output and Software Delay Loops• Objectives:

1. Basic Parallel input and output: Reading input from a DIP switch and providing `output to an LED bar.

2. To develop and demonstrate a software time delay loop.3. To check the waveform and timing of the port signals by using a logic analyzer.4. To execute code that uses the internal Real-Time-Interrupt for delay.5. Replacing a software delay loop with an interrupt driven loop.6. More complex input: Interfacing a keypad and using the keypad to select the LED

display.

• Hardware Build:i. Interface two LED bars using 8 of the 10-bit LEDs available on each bar to the

parallel I/O port as shown in class and specified in your Prelab Assignment.ii. Interface an 8-bit DIP switch to the parallel I/O port as shown in class and

specified in your Prelab Assignment.iii. Interface the keypad to the parallel I/O port as shown in class and specified in

your Prelab Assignment.ECE 4510 8

Page 9: ECE 4510 Introduction to Lab Final Reviewbazuinb/ECE4510/Review_LabFinal.pdf · ECE 4510 Introduction to Microprocessors Lab Final Review ... 4) Polled I/O ... Interfacing a keypad

Material from or based on: The HCS12/9S12: An Introduction to Software & Hardware Interfacing, Thomson Delmar Learning, 2006.

Laboratory Three

• Advanced Input and Output Devices• Objectives:

1. To implement output signal timing sequences.2. Generating parallel signals to drive external devices3. To implement a 5x7 Matrix Display.4. Application of advanced input/output devices (keypads and matrix

displays).• Hardware Build:

i. Maintain the LED bars, one DIP switch and keypad based on Lab 2.ii. MIC5891 interfacing and operation.iii. 74HCT595 interfacing and operation.iv. ULN2803APG wiringv. Three 5x7 matrix display wiring and operation.

ECE 4510 9

Page 10: ECE 4510 Introduction to Lab Final Reviewbazuinb/ECE4510/Review_LabFinal.pdf · ECE 4510 Introduction to Microprocessors Lab Final Review ... 4) Polled I/O ... Interfacing a keypad

Material from or based on: The HCS12/9S12: An Introduction to Software & Hardware Interfacing, Thomson Delmar Learning, 2006.

Laboratory Four

• Polled I/O Interface, Non-TTL Output Interface and Generating Periodic Outputs

• Objectives:1. To investigate the time delay related to sampling or polling a digital

input.2. To investigate the time delay related to interrupts.3. Driving an external relay.4. Generation of various periodic waveform outputs.

• Hardware Build:i. Maintain the LED bars, one DIP switch and keypad based on Lab 2.ii. MIC5891 interfacing and operation.iii. 74HCT595 interfacing and operation.iv. ULN2803APG wiringv. Three 5x7 matrix display wiring and operation.

ECE 4510 10

Page 11: ECE 4510 Introduction to Lab Final Reviewbazuinb/ECE4510/Review_LabFinal.pdf · ECE 4510 Introduction to Microprocessors Lab Final Review ... 4) Polled I/O ... Interfacing a keypad

Material from or based on: The HCS12/9S12: An Introduction to Software & Hardware Interfacing, Thomson Delmar Learning, 2006.

Laboratory Five

• ECT Input Capture, PWM and SCI Messaging• Objectives:

1. To use the Input Capture function of the ECT Module to measure the period time and the pulse width of a digital signal.

2. Applying a numerical filter to the measured data.3. To use the PWM Module to generate a periodic digital output signal with

a programmable duty cycle. 4. To use both of the SCI Modules to send and receive messages over an

asynchronous serial RS-232 communications port.• Hardware Build:

i. Maintain hardware from pervious labs. ii. Using an external waveform function generator as a signal and interrupt

source. iii. RS-232 transceiver for SCI1 communications.iv. HC12 to HC12 communications

ECE 4510 11

Page 12: ECE 4510 Introduction to Lab Final Reviewbazuinb/ECE4510/Review_LabFinal.pdf · ECE 4510 Introduction to Microprocessors Lab Final Review ... 4) Polled I/O ... Interfacing a keypad

Material from or based on: The HCS12/9S12: An Introduction to Software & Hardware Interfacing, Thomson Delmar Learning, 2006.

Laboratory Six

• Project #1 Demonstration and μC/OS-II, a real-time operating system• Objectives:

1. To familiarize with some of the features of the uCOS-II RT Kernel2. To use some of the facilities provided by μC/OS-II.

3. Demonstrate Project #1

• Hardware Build:i. Maintain hardware from pervious labs.

ECE 4510 12

Page 13: ECE 4510 Introduction to Lab Final Reviewbazuinb/ECE4510/Review_LabFinal.pdf · ECE 4510 Introduction to Microprocessors Lab Final Review ... 4) Polled I/O ... Interfacing a keypad

Material from or based on: The HCS12/9S12: An Introduction to Software & Hardware Interfacing, Thomson Delmar Learning, 2006.

Laboratory Seven

• Serial Peripheral Interface (SPI) and Digital-to-Analog Converter (DAC).

• Objectives:1. To learn about and program the Serial Peripheral Interface (SPI) 2. To develop a C program that will act as a master and a slave for

transmitting or receiving data over two SPI interfaces.3. To create an analog output waveform using a Digital-to-Analog

Converter (DAC). • Hardware Build:

i. Voltage reference. ii. Hardware design and support elements for an AD7390 DAC.

ECE 4510 13

Page 14: ECE 4510 Introduction to Lab Final Reviewbazuinb/ECE4510/Review_LabFinal.pdf · ECE 4510 Introduction to Microprocessors Lab Final Review ... 4) Polled I/O ... Interfacing a keypad

Material from or based on: The HCS12/9S12: An Introduction to Software & Hardware Interfacing, Thomson Delmar Learning, 2006.

Laboratory Eight

• Serial Peripheral Interface (SPI), Digital-to-Analog Converter (DAC), Analog-to-Digital Converter (ADC), and Temperature.

• Objectives:1. To learn about and program the Serial Peripheral Interface (SPI) 2. To develop a C program that will act as a master and a slave for

transmitting or receiving data over two SPI interfaces.3. To measure the analog output waveform using an Analog-to-Digital

Converter (ADC). 4. To use the Analog-to-Digital Converter (ADC) to measure sensor data.

• Hardware Build:i. Voltage reference. ii. Hardware design and support elements for an AD7390 DAC. iii. Hardware design and support elements for an AD7705 ADC.iv. Hardware design and support elements for an LM35.

ECE 4510 14

Page 15: ECE 4510 Introduction to Lab Final Reviewbazuinb/ECE4510/Review_LabFinal.pdf · ECE 4510 Introduction to Microprocessors Lab Final Review ... 4) Polled I/O ... Interfacing a keypad

Material from or based on: The HCS12/9S12: An Introduction to Software & Hardware Interfacing, Thomson Delmar Learning, 2006.

Laboratory Nine

• Inter-Integrated Circuit (I2C) Interface and Real-Time Clock/Calendar.• Objectives:

1. To learn about and program the Inter-Integrated Circuit (I2C) Interface. 2. To develop a C program that will act as a master and a slave for

transmitting or receiving data over the I2C interface.3. To setup a real-time clock/calendar peripheral for microcontroller

system.4. To use the RTCC as a clock and clock alarm.

• Hardware Build:i. Hardware design and support elements (crystal) for an MCP7490M. ii. The dip switches, 5x7matrix, LED array and IRQ interrupt as desired.iii. The external relay driver circuit.

ECE 4510 15

Page 16: ECE 4510 Introduction to Lab Final Reviewbazuinb/ECE4510/Review_LabFinal.pdf · ECE 4510 Introduction to Microprocessors Lab Final Review ... 4) Polled I/O ... Interfacing a keypad

Material from or based on: The HCS12/9S12: An Introduction to Software & Hardware Interfacing, Thomson Delmar Learning, 2006.

Laboratory Ten

• Distance Measurement Using Ultrasound.• Objectives:

1. To interface a digital proximity sensor to the 9S12DP512 microcontroller2. To display distance using the 5x7 matrix display3. To develop a C program that will take distance measurements of objects

in close proximity, computed the temperature compensated distance and display the measured values on a 3-digit display

• Hardware Build:i. PING Interface. ii. Temperature measurement using the LM35 and ADC. iii. The 5x7matrix, LED array and IRQ interrupt as desired.

ECE 4510 16

Page 17: ECE 4510 Introduction to Lab Final Reviewbazuinb/ECE4510/Review_LabFinal.pdf · ECE 4510 Introduction to Microprocessors Lab Final Review ... 4) Polled I/O ... Interfacing a keypad

Material from or based on: The HCS12/9S12: An Introduction to Software & Hardware Interfacing, Thomson Delmar Learning, 2006.

Laboratory Eleven

• Control Area Network (CAN) Interface.• Objectives:

1. To understand the basics of a CAN interface2. To use a CAN Module of the 9S12DP512 microcontroller to implement

a CAN communications port3. To develop a C program that will send and receive messages over a CAN

communications port• Hardware Build:

i. Electrical connections for MSCAN0 and MSCAN1 channels. ii. PING Interface. iii. Temperature measurement using the LM35 and ADC. iv. The 5x7matrix, LED array and IRQ interrupt as desired.

ECE 4510 17

Page 18: ECE 4510 Introduction to Lab Final Reviewbazuinb/ECE4510/Review_LabFinal.pdf · ECE 4510 Introduction to Microprocessors Lab Final Review ... 4) Polled I/O ... Interfacing a keypad

Material from or based on: The HCS12/9S12: An Introduction to Software & Hardware Interfacing, Thomson Delmar Learning, 2006.

Project #1: One Dimensional Ping Pong

• Objectives:The project is intended to have student teams independently apply their hardware and software design experience from labs 1-4 to develop a game, one dimensional ping pong.

1. Using parallel I/O pins and the LED bar, make the lights turn on one at a time from right-to-left and left-to-right.

2. Use the ECT to have the lights stay on at each position for a defined period of time. The longer the process continues, the shorter the on-time should be.

3. Use the IRQ interrupt to indicate when the LED bar light in either the farthest right or farthest left position is on.

4. Use the 5x7 matrix display to provide information and the current score to the user. The current score should consist of a count of how many times the LED as moved from one side of the LED bar to the other. Information should include when to start the game (ready) and when it is over (end). Useful information may also include the previous score or a “light show” of LED patterns prior to the start or after the end.

5. (ECE 4510 Optional/ECE 5530 required) The SCI0 port can be used to output messages to a PC terminal window allowing text to be sent and received . The SCI0 port can be used to provide start and stop information as an alternative to the 5x7 matrix displays. The SCI0 could also be used to display the highest score achieved or other text messages. (e.g. enter the users name, instructions, etc.)

6. Make a one-dimensional Ping-Pong game with the above pieces.

ECE 4510 18

Page 19: ECE 4510 Introduction to Lab Final Reviewbazuinb/ECE4510/Review_LabFinal.pdf · ECE 4510 Introduction to Microprocessors Lab Final Review ... 4) Polled I/O ... Interfacing a keypad

Material from or based on: The HCS12/9S12: An Introduction to Software & Hardware Interfacing, Thomson Delmar Learning, 2006.

Project #2: A Microcontroller Calculator with LCD Display

• Objectives:The project is intended to have student teams independently apply their hardware and software design experience to develop a stand-alone four function calculator.

1. Use the 2 line by 16 character (2x16) LCD display to display the computation being performed on one line and the result on the second line.

2. Use the keypad as numerical inputs (0-9) and the character keys (A-F) to define the operation to be performed, the equal sign to compute the function, and a shift function for extended operations (as required/desired).

3. Use other course part kit components as needed and useful..

ECE 4510 19

Page 20: ECE 4510 Introduction to Lab Final Reviewbazuinb/ECE4510/Review_LabFinal.pdf · ECE 4510 Introduction to Microprocessors Lab Final Review ... 4) Polled I/O ... Interfacing a keypad

Material from or based on: The HCS12/9S12: An Introduction to Software & Hardware Interfacing, Thomson Delmar Learning, 2006.

Project #3: Moving an Object on a Conveyor Belt• Objectives:

The theme of the project is to move an object that has been placed on a continuous conveyor belt from a start position to specified sequence of defined positions on the conveyor belt. In addition, appropriate industrial warnings for a conveyor system will be provided and a log of location and positioning tasks performed will be recorded and printed to a terminal.

1. PING.2. H-Bridge motor control3. Start butten4. Warning alarm tone and lights5. Emergency stop6. Log operation to the terminal.7. Provide an operational display of current function/task.8. Provide a means to input new tasking

ECE 4510 20

Page 21: ECE 4510 Introduction to Lab Final Reviewbazuinb/ECE4510/Review_LabFinal.pdf · ECE 4510 Introduction to Microprocessors Lab Final Review ... 4) Polled I/O ... Interfacing a keypad

Material from or based on: The HCS12/9S12: An Introduction to Software & Hardware Interfacing, Thomson Delmar Learning, 2006.

End of Semester Time Table

• Next Week– Monday: Hardware Review 1st & 2nd Lab Finals– Wednesday: Software Review Project #3 Due– Thursday: 3rd and 4th Lab Finals– Friday: Final Exam Review Project #3 Report Due

• Finals Week– Wednesday: Exam at 12:30

• Final day to submit lab reports see Lalith

• Grades Posted 30 April at noonECE 4510 21