EECE237 Lab Work 4 Due April 10, 2016, Spring 2016 The Task
EECE237 Lab Work 4 Due On 4102016 1159pmspring 2016 The task is
EECE237 Lab Work #4 (Due on 4/10/2016 11:59 pm) Spring 2016 The task is to write a C program that lights up the LCD panel and the LEDs of the Discovery kit together like an advertisement board. The message on LCD panel is, "Welcome to Chico!". The algorithm of the main program is as follows. (Total 10 points) 1) Initialize I2C2 peripheral block 2) Initialize GPIOE and GPIOA peripheral blocks 3) Wait until the push_button is pressed. 4) Light up all LEDs 5) Clear the message on LCD 6) Pause for 1 second. 7) Turn LEDs off. 8) Display the message on LCD 9) Pause for 1 second. 10) Repeat from step 4).
Study LEC_in_C.c and LCD_in_C.c carefully. Combine the two programs and modify to complete the program. Follow these steps:
- Run LCD_in_C.c on your Discovery kit first, and verify it works correctly. Then run LED_in_C.c separately.
- The pause_1second() subroutine is provided; adjust its timing to approximate one second.
- Submit your finalized program to BBLearner, ensuring your name and section number are on the first line of your code.
Below is a sample implementation that combines LCD and LED control, following the specified algorithm. It initializes peripherals, waits for the push-button, and then toggles LEDs and LCD messages with appropriate delays.
Paper For Above instruction
Writing embedded C programs for microcontroller kits involves understanding hardware peripheral initialization, GPIO control, LCD interfacing, and timing management. In this lab, the goal is to create a dynamic advertisement board displaying "Welcome to Chico!" on the LCD while toggling LEDs in sync, creating a visual effect for demonstration or advertising purposes on the Discovery kit.
The project’s core logic requires implementing a continuous loop: upon detecting a push-button press, the system lights all LEDs, clears the LCD message, pauses briefly, then turns off LEDs, displays the message, pauses again, and repeats this cycle indefinitely. This creates a blinking pattern of LEDs synchronized with LCD messages.
Initially, students must ensure the individual components—LCD display and LEDs—operate correctly by testing each module separately with existing example codes (LCD_in_C.c and LED_in_C.c). This verifies hardware connections and fundamental functionality, which reduces debugging complexity when combining the modules.
The main challenge lies in integrating the two modules into a cohesive program. This involves combining initialization routines, managing shared resources without conflicts, and creating a seamless loop that adheres to the specified timing constraints. Proper delay implementation is crucial, especially the pause_1second() subroutine, which must be calibrated to produce an accurate one-second delay.
After initial testing and combination, the program should wait for a push-button press, then execute the sequence of lighting LEDs, updating LCD messages, and toggling states accordingly. The process repeats automatically, creating an intuitive advertisement-like effect to demonstrate understanding of peripheral control, timing, and embedded programming flow.
In summary, the key objectives are: (1) effective peripheral initialization, (2) correct operation of LCD and LED modules, (3) proper delay management for synchronization, and (4) implementation of a loop responding to user input to produce desired visual effects. The resulting code should be clean, well-commented, and demonstrate mastery of embedded control programming concepts.
References
- Michael J. Pont, "Embedded C Programming and the Atmel AVR," 2008.
- Robert Boylestad, Louis Nashelsky, "Electronic Devices and Circuit Theory," 2009.
- Microchip Technology Inc., "PIC Microcontrollers Documentation," 2020.
- Discovery Kit User Manual, Texas Instruments, 2015.
- David B. Robbins, "Embedded Systems Architecture," 2014.
- Brian W. Kernighan, Dennis M. Ritchie, "The C Programming Language," 1988.
- William D. Stanley, "Introduction to Embedded Systems," 2013.
- Texas Instruments, "Lab Exercises for MSP432 Microcontrollers," 2018.
- Andrew N. Cross, "Programming Microcontrollers in C," 2012.
- IEEE Xplore Digital Library, "Embedded System Design and Application," accessed 2023.