LCD_sendString("CSE 211 | Introduction to Embedded Systems");
LCD_moveCursor(1, 0);
LCD_sendString("Final Project");
In this project, we used Tiva™ C Series TM4C123G LaunchPad in order to develop Microwave Oven Controller1
in the first step, our goal was only to display a sequence of ASCII characters on the LCD, with the full control of it's position.
In LCD.c we started by initializing the used pins from PORT B and PORT F
we have known that the LCD functions will be used a lot in the project, so we needed to make the code reuseable and readable. so we followed the functional programming paradigm, so our code became nothing more than a set of functions that call each other2, we can summarize as following
-
LCD_vInit calls the initializing functions, clears the LCD and sets the cursor
-
LCD_cmd initializes the Command ports
-
sendPulse sends a pulse to the enable pin(E) in the LCD to enable it
-
tostring converts integer to string
-
LCD_sendChar print character to the LCD
-
LCD_sendString print string to the LCD
-
LCD_clearScreen Clears the LCD
-
LCD_moveCursor sets the cursor in the selected position on the LCD
we made some helper files and function to make the code reuseable and readable. so our code became nothing more than a set of functions that call each other2. We can summarize as following:
1. Timer.c
Instead of using meaningless delay such as looping in an empty loop, we have used the systick timer, giving us the choice from choosing between 2 modes in counting wait_secs for seconds, and wait_ms for milliseconds, and of course the number of counts in the selected mode.
2. DIO.c
Instead of using repeated and long port names and port regesters, we made this file to deal with ports more easly. Like for example when we need to initalize a port we use port_vInit. And when we need to write or read from a specific pin we use DIO_u8ReadPin or DIO_vWritePort, etc.
3. BITCTRL.h
we made this header file to deal with the problem of choosing which bit to work on, for example to set a BIT in specific register we use SET_BIT and for toggling a bit we use TOG_BIT, etc.
4.LED.c
In this file we made a function for in case we wanted to use a led in specific pin and port, so to initialize the pin connected to the led we use LED_vInit, and to light up the led we use LED_vON and the same for closing it LED_vOFF.
4.Switch.c
same as LED.c but for switches. We use switch_vint function to initialize a switch connected to a specific pin, and the same for switch_vint_pullup but include the enabling the pullup for the switch, and switch_vRead to check if the swich is pressed or not.
in keypad.c, we started by initializing the used pins from PORT A and PORT E
we have known that the Keypad functions will be used a lot in the project, so we needed to make the code reuseable and readable. so we followed the functional programming paradigm, so our code became nothing more than a set of functions that call each other2, we can summarize as following
The main Parsing process was implemented in cookingModes.c which take the user input search for the right mode after checking its availability. We also created LEDxBuzzer which enables the buzzer and the led during mode functions
1 The functionality of Microwave Oven Controller is limited for the time being duo to problems with intrrupts, but we will fix it as soon as possible↩
2 The implementation of many functions is nothing more than just calling another functions. ↩