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 • Must be able to count down from a given time • Must provide graphical feedback • Must have multiple functions
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
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
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.
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.
I2C Timing Diagrams Images taken from NXP PCA8575 Datasheet
DS1307 Data Packet Formatting Images taken from DS1307 Datasheet
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.
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.
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.
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
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