Unformatted text preview: CSE/EE 5/7385 Microprocessor Architecture and Interfacing Laboratory 7: ARM MCBSTM32C Interfacing This lab will acquaint you with interfacing experiments on the ARM Cortex MCBSTM32C using the C programming language. It focuses on writing, building, downloading to flash and debugging programs on the MCBSTM32C. Link to source, headers and startup files: Reference: -‐ The file GLCD_SPI_STM32.c includes functions for the STM32 LCD -‐ Joystick: PART 1: Counter program STEP 1: Connect and power the board . Connect the ULINK-‐ME adapter to the PC via a standard USB cable 1. . Connect power from your PC to the board using the USB cable 2. STEP 2: Create the project . Create a directory for the project named: ‘counter’ . Start Keil µVision . Create a new Project File in Project -‐ New -‐ µVision Project, name the project ‘counter’ and save it in your project directory. . Select a microcontroller from the Device Database. Under STMicroelectronics, Choose the STM32F107VC . Answer No if prompted to add the startup code . To organize the project files create 2 groups: Create a group named ‘Source’ (This group will contain your source code) Create a group named ‘Startup’ (This group will contain your startup files) Header files Copy the files Font_6x8_h.h, Font_16x24_h.h and GLCD.h to the project directory Startup files . Copy the files startup_stm32f10x_cl.s and system_stm32f10x_cl.c to the project directory . Add the files startup_stm32f10x_cl.s and system_stm32f10x_cl.c to group ‘Startup’ Source files . Copy the files GLCD_SPI_STM32.c and counter.c to the project directory . Add the 02 files GLCD_SPI_STM32.c and counter.c to group ‘Source’ STEP 3: Write the code for the counter . The partial code for the counter is provided in the file counter.c file . Complete the code in counter.c so that your program does the following: 1. Configure the LCD to SMU colors (Background: blue, Text color: red) 2. Display your first name on line 0 of the LCD 3. Display your last name on line 1 of the LCD 4. Display your student ID on line 2 of the LCD 5. Flash LEDs PE8, PE9 … PE15 sequentially 6. Display the counter value corresponding to each LED on line 3 of the LCD. LED Counter value PE8 0 PE9 1 PE10 2 PE11 3 PE12 4 PE13 5 PE14 6 PE15 7 1 STEP 4: Build and Flash the program . Build the program, Project – Build target . Program it to the on-‐chip Flash ROM, Flash – Download . Press the reset button on the board DEMONSTRATION: Demonstrate your result to the lab instructor Print and submit the file counter.c PART 2: Bar Graph and Joystick STEP 1: Create a project . Name the project bargraph . Follow the same steps provided in part 1 to create the project and add files STEP 2: Write the code to display a Bar graph on the LCD . The partial code for the bar graph is provided in the file bargraph.c file . Complete the code in bargraph.c so that the program does the following: 1. Display an horizontal bar graph of width 200px and height 40px on the LCD 2. When moving the joystick to the right, the bar graph width should increase to the right 3. When moving the joystick to the left, the bar graph width should decrease to the left STEP 3: Build and Flash the program . Build the program, Project – Build target . Program it to the on-‐chip Flash ROM, Flash – Download . Press the reset button on the board DEMONSTRATION: Demonstrate your result to the lab instructor Print and submit the file bargraph.c 2 ...
View Full Document
- Fall '08