Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help I tried to do it but I need help Required Parts: Tiva LaunchPad TM4C123, one switch, 2-220 resistors, one red LED, jumpers,

I need help I tried to do it but I need help

Required Parts: Tiva LaunchPad TM4C123, one switch, 2-220 resistors, one red LED, jumpers, and breadboard. Objective The first lab is intended to familiarize the student with the software development steps and to learn simple programming structure in C. In this lab you will write a program to blink an LED to send out an SOS Morse code. System Requirements The designed system will blink an SOS Morse code message when a switch input is pressed. The Morse code message should be implemented as follows: Blinking Morse code SOS ( . . . _ _ _ . . . ) DOT, DOT, DOT, DASH, DASH, DASH, DOT, DOT, DOT. DOT is on for second and DASH is on for second, with second between them. At the end of SOS, the program has a delay of 2 seconds before repeating. The message will continue to repeat as long as the switch is pressed. When the switch is released the LED should be off. Procedure You will be building the SOS Morse system using an LED and a switch connected to your Tiva LaunchPad.

Write C code that inputs from PE3 and outputs to PE1.

Use the provided delay function to implement the delay. You will need to modify the function where you pass a TimeVal indicating the required delay. The function will return once the delay time has elapsed.

this is the main.c file

// 1. Pre-processor DirectivesSection

// Constant declarations to access port registers using // symbolic names instead of addresses

#define SYSCTL_RCGC2_R (*((volatile unsigned long *)0x400FE108)) #define GPIO_PORTE_DATA_R (*((volatile unsigned long *)0x400243FC)) #define GPIO_PORTE_DIR_R (*((volatile unsigned long *)0x40024400)) #define GPIO_PORTE_AFSEL_R (*((volatile unsigned long *)0x40024420)) #define GPIO_PORTE_DEN_R (*((volatile unsigned long *)0x4002451C)) #define GPIO_PORTE_LOCK_R (*((volatile unsigned long *)0x40024520)) #define GPIO_PORTE_CR_R (*((volatile unsigned long *)0x40024524)) #define GPIO_PORTE_AMSEL_R (*((volatile unsigned long *)0x40024528)) #define GPIO_PORTE_PCTL_R (*((volatile unsigned long *)0x4002452C))

// 2. Declarations Section // Global Variables if any

// Insert Function Prototypes here void PortE_Init(void); void Delay(unsigned long frequency);

// 3. Subroutines Section // MAIN: Mandatory for a C Program to be executable int main(void){

// Initialize the ports here while(1){

// Insert your code here I need help from here I did this but I am not sure and it is incomplete if((GPIO_PORTE_DATA_R&0X08)==0X08) {GPIO_PORTE_DATA=0x08; } else{ GPIO_PORTE_DATA=0; } } }

// Insert a subroutine to initialize ports for input and output // Please modify the following code to initialize your choice of PINs // Inputs: None // Outputs: None // Notes: ... // Insert a function to initialize port E here void PortE_Init(void){ volatile unsigned long delay; I did this but iam not sure SYSCTL_RCGC2_R|=0X00000010 //Turn on portE clock GPIO_PORTE_DIR_R=0X02 //PE0 output,PE3 input GPIO_PORTE_DEN_R=0X10 //enable portE PE0 and PE3 GPIO_PORTE_AMSEL_R=0x00 //disbale analag GPIO_PORTE_AFSEL_R=0X00 //no alternate functions for PortE

} // MODIFY and use the following delay function to create delay periods // Assume it takes 0.1 sec to count from 145448 down to zero // Inputs: Modify as needed // Outputs: None // Notes: ... I need help here

void Delay(unsigned long TimeVal){

while(TimeVal){ TimeVal--; } }

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

Build It For The Real World A Database Workbook

Authors: Wilson, Susan, Hoferek, Mary J.

1st Edition

0073197599, 9780073197593

More Books

Students also viewed these Databases questions