Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use Code warrior C to do part 2. I attached the code part 1. Use the same format. You can use case (0), case(1), case(2).

image text in transcribed
Use Code warrior C to do part 2. I attached the code part 1. Use the same format. You can use case (0), case(1), case(2). Please do not answer this questions if you do not know the answers.
image text in transcribed
image text in transcribed
image text in transcribed
ENGR347 Lab Project Intro to embedded C code and functions In a previous lab, you learned how to detect switches, blink LEDs, and use delays, making use of subroutines for good structure. In this lab, you will learn basic C language and make use of functions to perform the desired tasks. Part 1) Write a MAIN function, GPIO functions, and a delay function that does the following: Initialize GPIO for PORTB Perform other initialization functions if needed While (1) Set GPIO Bits Delay. I0ms(50) Clr GPIO Bits Delay10ms(50) set all 4 bits-1 // delay 10*50ms= 500ms clear all 4 bits 0 // delay 10*50ms= 500ms EndWhile This should blink the LEDs at a rate of a half second per blink. Allow your instructor to verify the delay timing. Part 2) After your delay timing has been tweaked, add the following functions and make the changes required in main to perform as follows: MAIN P-Code Perform Initialization (GPIO and stack) While (1) meaning always true) switch state Read Switches0 Wreturns switch settings in variable called switch state If switch state left Scroll Left(l) scroll LEDs left 1 bit Delay 10ms(25) 250 ms Else If switch state right Scroll Right() scroll LEDs right 1 bit Delay10ms(25) Else If switch stateboth left and right Set GPIO Bits Delay.. 10ms(50) ClrGPIO Bits() Delay. I0ms(50) I/ set all 4 bits 1 // delay 10*50ms = 500ms // clear all 4 bits = 0 //delay 10*50ms = 500ms - Else All LEDs O Endif turn all LEDS off Endif Endif EndWhile

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spatio Temporal Database Management International Workshop Stdbm 99 Edinburgh Scotland September 10 11 1999 Proceedings Lncs 1678

Authors: Michael H. Bohlen ,Christian S. Jensen ,Michel O. Scholl

1999th Edition

3540664017, 978-3540664017

More Books

Students also viewed these Databases questions

Question

3. Have we aligned IT with our business strategy and goals?

Answered: 1 week ago

Question

Question Can a Roth IRA invest in stock of the IRA owners business?

Answered: 1 week ago