microwave oven controller

17
Microwave Oven Controller University Of Central Oklahoma ENGR 3613 Dr. Yuhao Jiang April 23rd, 2012

Upload: hoang

Post on 16-Feb-2016

114 views

Category:

Documents


3 download

DESCRIPTION

University Of Central Oklahoma ENGR 3613 Dr. Yuhao Jiang April 23rd, 2012. Microwave Oven Controller. Group Members. Baker, Andrew Galloway, John . OBJECTIVE. Design code for the Dragon12+ development board that will act as a microwave oven controller. Must accept user input - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Microwave Oven Controller

Microwave Oven Controller

University Of Central OklahomaENGR 3613

Dr. Yuhao JiangApril 23rd, 2012

Page 2: Microwave Oven Controller

Group Members

Baker, Andrew

Galloway, John

Page 3: Microwave Oven Controller

OBJECTIVE

Design code for the Dragon12+ development board that will act as a microwave oven controller. Must accept user input Must be able to count down from a given

time Must provide graphical feedback Must have multiple functions

Page 4: Microwave Oven Controller

INTRODUCTION

We broke the project down into several different steps: Displaying current time on 7-segment

display▪ Utilizing the on-board Real Time Clock (RTC)

Reading in user input and calculating the appropriate time needed to complete function

Timer functions

Page 5: Microwave Oven Controller

EQUIPMENT

Freescale Code Warrior IDE software Dragon12+ USB Development Board

On-board LCD screen On-board 7-segment displays On-board Real Time Clock On-board USB to TTL converter

Page 6: Microwave Oven Controller

Real Time Clock

The Dragon12+ board has a built in DS1307 Real Time Clock. This chip utilizes the I2C bus to communicate

with the HCS12 microcontroller▪ The chip can be programmed as well as read on

the same bus, but uses 2 different bus addresses for this function

Since we hadn’t covered I2C is class, we decided to use a “soft I2C” instead, which isn’t as flexible as the hardware I2C, but would work for our applications.

Page 7: Microwave Oven Controller

Soft I2C

The firmware was adapted from our senior design project (which heavily uses I2C)

This code “acts” as a hardware I2C except some functions such as interrupts, clock stretching, and bus collision avoidance aren’t implemented.

Page 8: Microwave Oven Controller

I2C Timing Diagrams

Images taken from NXP PCA8575 Datasheet

Page 9: Microwave Oven Controller

DS1307 Data Packet Formatting

Images taken from DS1307 Datasheet

Page 10: Microwave Oven Controller

Code to get time from RTC

The process to get the I2C data is quite simple when it is broken down into different functions. This process is called roughly every second to keep the display updated to +/- 1 second time.

START i2c_start() i2c_ tx(0xD0)

i2c_ tx(0x01)i2c_stop()i2c_start()

i2c_ tx(0xD1) i2c_ rx(1) i2c_ rx(0)

i2c_stop()END

1 2

345

6 7 8

9

Page 11: Microwave Oven Controller

Reading User Input

The on-board keypad was used for user input. We had previously written a function (for a lab) that could be called that would return what key, if any, was pressed. We had to modify this slightly to prevent the processor from taking multiple readings from a single key press, though this was simple to overcome by putting a hold in the code until all keys were released.

Page 12: Microwave Oven Controller

Reading User InputStart

A is Pressed B is Pressed D is PressedC is Pressed

Sends 01:00 toTimer Function

LCD Displays"Popcorn"

Converts weightinto time and

sends XX:XX toTimer Function

LCD Displays "Beef Weight"

User Enters 4Digit Number

Converts weightinto time and

sends XX:XX toTimer Function

LCD Displays"ChickenWeight"

User Enters 4Digit Number

Sends time inXX:XX format toTimer Function

User Enters 4Digit Number

LCD Displays"Cooking

Time"

Page 13: Microwave Oven Controller

Reading User Input

The function that was built also corrects for the difference in silkscreen printed on the Dragon12+ board vs numbering the keys from zero starting in the upper left hand corner. If a letter key or special function key (* or #) were pressed, a number was returned outside of the range of the keypad numbers, for example 10 would be returned if A was pressed, 11 returned if B was pressed, etc.

StartCall to functionto get button

info

Is thereturnedvalue -1?

Store the returnedvalue (corrected to

silkscreen numbers)

Yes

No

Call to functionto get button

info

Is thereturnedvalue -1?

Yes

No

Page 14: Microwave Oven Controller

Countdown Code

Convert Secondsto Array and

Display on LED

Display Timeand Wait

End For Loopand Clear LCD

subtractsecond each

second

converts toseconds and

uses as length offor loop

Time Input in4 element

array

Start

Page 15: Microwave Oven Controller

RESULTS

Program successfully performs as a human interface to control a microwave oven. It can accept multiple inputs (Popcorn,

Beef, Chicken, User defined time) It counts down the time and displays

remaining time as required It shows the current time when not in

use

Page 16: Microwave Oven Controller

DISCUSSION

Problems encountered: The first attempt at the I2C firmware

was unsuccessful▪ We had to directly change the registers to

change pin states rather than try and automate the process

Most of the code was taken from our previous labs for microprocessors We were able to do this since we always

tried to write the code in the most general case

Page 17: Microwave Oven Controller

Questions?