Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This project will further expose the student to the IAR Embedded Workbench and i

ID: 2084586 • Letter: T

Question

This project will further expose the student to the IAR Embedded Workbench and its use with the STM32F207ZG microcontroller, as well as exposing the student to the IDE's GUI. This will project will also expose the student to interfacing the microcontroller to hardware. IAR Tutorial. STM32F207ZG microcontroller reference manual, schematics, and data sheets as required. The IAR development board incorporates 8 ports. A through H. The development boards use many of the port pins for various purposes, but many pins are available for user use. You will use an octal latch to read and store the status of a set of DIP switches, and subsequently set the status of a set of bargraph LEDs. Install the DIP switch bank. 74LS373 octal latch, and the bargraph. You will also need resistor banks. Write the ARM assembly language program necessary to read and latch the DIP switch state in, and turn on the bargraph LEDs as specified. Install the DIP switches to be latched into the octal latch. Install the bargraph and associated electronics. Program the microcontroller to latch in the DIP switches immediately when the user button is pressed. If the user button is pressed for more than 1.5 seconds, read their state into the microcontroller. If any of the DIP switches are ON, turn the next-lower light on the bargraph. For example, if DIP switch 6 is ON, turn on bargraph 5. If all of the even-numbered DIP switches (0-indexed) are on, flash the board's STAT3 light 600 msec on, 600 msec off. If all of the odd-numbered DIP switches (0-indexed) are ON, turn on the board's STAT2 LED 400 msec on, 400 msec off, and flash the odd-numbered bargraph LEDs and even-numbered bargraph LEDs alternately at the same rate. ONLY read the DIP switches when the user button has been pressed for at least 1.5 seconds. As previously, the file has to be included in your source code. Find appropriate input pins for the 8 DIP switches and the octal latch's input enable pin. Also, find appropriate pins for the bargraphs. Ask the instructor for specific instruction re: how to use the DIP switches and bargraphs: each will use a resistor network for proper operation. Ports have to be enabled through RCC_AHB1 ENR. Sample code to read the user button, Write to output pins, and use timers is in your tutorial, as is the directions for setting port pins appropriately. To set the timer, you will also have to configure RCC_APB1ENR TIMx_CRI, TIMx_ARR, and TIMx_PSC, and TIMx_EGR (depending on how you implement the timer). You can check TIMx_CNT to detect if the timer has reached the desired value. Once you have completed the assignment, demonstrate the correct operation to the instructor. See next page for deliverables.

Explanation / Answer

The IAR development board has 8 ports A-H.

#include<st/iostm32f207zx.h>

#step 1 implementation

Latch = RCC_AHB1ENR port A; % port A has to be latched into octal latch.

userInput = RCC_AHB1ENR port B; %port b has been used for user input

installDIPSwitch; %install DIP switch

installBargraph; %install Bargraph

time = TIMx_CR1; %timer

if(userInput == 1) %when user input button is pressed

InitilizeTimer(time); %initialize the timer

#step 2 implementation

if(time < 1.5)

{

DIPSwitch = RCC_AHB1ENR; %install DIP switches

}

Else

readDIPState(DIPSwitch); %read state into microcontroller

end

#step 3 implementation

DIP = readDIPState(DIPSwitch); % read DIP switch

for(i=0;i<8;i++)

if(DIP(i) == 1) %if on

{

turnOnBargraph(i-1); %turn bargraph on

}

end

end

#step 4 Implementation

DIP = readDIPState(DIPSwitch); % read DIP switch

if(DIP == [1,0,1,0,1,0,1,0]) %checking the even switch status

{

flashBoradOn(0.6); %on flashboard for 600 msec

flashBoradOff(0.6); %off flashboard for 600 msec

}

elseif(DIP == [0,1,0,1,0,1,0,1]) %checking the odd switch status

{

flashBoradOn(0.4); %on flashboard for 400 msec

flashBoradOff(0.4); %off flashboard for 400 msec

}

end

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote