Overview
In this lab, you will use TI Code Composer Studio (CCS) to program the TC CC3220x LAUNCHXL to control an LED from the serial port using a state machine. This work will build on the concepts you learned during your activities in the zyBook this week.
During this milestone you will use CCS to edit, compile, and load code into the CC32xx board. You will then proceed to use it for debugging. Throughout this process, you explore the components of a CCS project and the CCS code generator (system config). You will also be able to learn more about the UART and GPIO drivers.
Goal: Your objective is to control the red LEDs in the lower right corner of the board (the corner opposite the USB connector). Use this to design a state machine to turn on an LED when a user types ON into the console and to turn off the LED when a user types OFF, using only one byte of RAM. Remember, you receive only one character at a time from the UART and it is not buffered. Then you will code the state machine you created.
Prompt
Begin your work by accessing the Milestone Two UART GPIO Lab Guide PDF document. While this document was written for a Windows interface, the tools can be used on Mac or Linux as well. Note that to accomplish the work outlined in the guide, you will need the following:
TI CC3220x LAUNCHXL
TI Code Composer Studio (installed)
USB connection between the PC and board
Specifically, you must address the following rubric criteria:
Develop code for all of the specified functionality. The goal of this criterion is for the code to result in the expected functionality (note how this is different from the state machine functionality). Both ON and OFF should operate as expected. In your video, show the terminal window and LED to make this clear.
Create code that reads characters from the UART. This must use only one byte at a time with no multi-byte buffering of the serial input. The characters are encoded back.
Create code that controls the LED on and off from the state machine. Note that this involves use of the GPIO peripheral. Partial credit may be awarded if the code does not work but you are able to successfully determine how to turn the LED on and off, then include it in the comments.
Implement (in code) the state machine functionality described by your documentation. The goal of this criterion is for the code to accurately reflect the state machine documentation, rather than for it to have perfect functionality.
Create state machine documentation to describe the operation that matches the technical specifications. This should be completed as a draw.io file and saved as a PDF.
Discuss the questions from the lab. Address all the questions thoroughly and thoughtfully, with supporting evidence from your work.
Apply coding best practices in formatting, commenting, and functional logic.
What to Submit
You will have four different file submissions for this milestone. Once you have completed your lab work, first zip your workspace and submit the zipped file for grading. Second, submit a 10-second video of the LEDs blinking on your board. If you encounter any difficulties filming the lights on your hardware component, reach out to your instructor. Third, submit a document containing your answers to the questions from the Milestone Two UART GPIO Lab Guide. Finally, submit a state machine diagram completed using draw.io and exported in PDF format.
Category: C Programming
1 Write a single C statement to accomplish each of the following: a) Define the
1 Write a single C statement to accomplish each of the following:
a) Define the variable number to be of type int and initialize it to 0.
b) Prompt the user to enter an integer. End your prompting message with a colon (:) followed by a space and leave the cursor positioned after the space.
c) Read an integer from the keyboard and store the value in integer variable a.
d) If number is not equal to 7, display “number is not equal to 7.”
e) Display “This is a C program.” on one line.
f) Display “This is a C program.” on two lines so the first line ends with C.
g) Display “This is a C program.” with each word on a separate line.
h) Display “This is a C program.” with the words separated by tabs.
2 Write a statement (or comment) to accomplish each of the following:
a) State that a program will calculate the product of three integers.
b) Prompt the user to enter three integers.
c) Define the variable x to be of type int and initialize it to 0.
d) Define the variable y to be of type int and initialize it to 0.
e) Define the variable z to be of type int and initialize it to 0.
f) Read three integers from the keyboard and store them in variables x, y and z.
g) Define the variable result, compute the product of the integers in the variables x, y and z, and use that product to initialize the variable result.
h) Display “The product is” followed by the value of the int variable result.
3 Using the statements you wrote in Exercise 2, write a complete program that calculates the product of three integers
4 Write a single C statement or line that accomplishes each of the following (subtasks a, b, c and d are unrelated)
a) Display the message “Enter two numbers.”
b) Assign the product of variables b and c to variable a.
c) State that a program performs a sample payroll calculation (i.e., use text that helps to document a program).
d) Input three integer values and place them in int variables a, b and c.
Develop a program that will determine the gross pay for each of several employee
Develop a program that will determine the gross pay for each of several employees. The company pays “straight time” for the first 40 hours worked by each employee and pays “time-and-a-half” for all hours worked in excess of 40 hours. You’re given a list of the company’s employees, the number of hours each worked last week and each employee’s hourly rate. Your program should use scanf to input this information for each employee and determine and display the employee’s gross pay. Here is a sample input/output dialog:
Enter # of hours worked (-1 to end): 39
Enter hourly rate of the worker ($00.00): 10.00
Salary is $390.00
Enter # of hours worked (-1 to end): 40
Enter hourly rate of the worker ($00.00): 10.00
Salary is $400.00
Enter # of hours worked (-1 to end): 41
Enter hourly rate of the worker ($00.00): 10.00
Salary is $415.00
Enter # of hours worked (-1 to end): -1Rubric
Rubric 1.1
Rubric 1.1
CriteriaRatingsPts
This criterion is linked to a Learning OutcomeDetailed comment to explain every step of the solution
2 ptsFull Marks
0 ptsNo Marks
2 pts
This criterion is linked to a Learning OutcomeSelf explanatory variable names and good coding format (empty lines, indentation ect)
2 ptsFull Marks
0 ptsNo Marks
2 pts
This criterion is linked to a Learning OutcomeProgram keep asking user’s input, the program exit when and only when user enter -1
5 ptsFull Marks
2 ptsPartial
Program keep asking user input, cannot exit or exit on other input besides 1
0 ptsNo Marks
5 pts
This criterion is linked to a Learning OutcomeSalary calculated correctly as the problem described
2 ptsFull Marks
0 ptsNo Marks
2 pts
This criterion is linked to a Learning OutcomeAll variables are defined with expected type
2 ptsFull Marks
1 ptsPartial
Variables are all defined as same data type
0 ptsNo Marks
2 pts
This criterion is linked to a Learning OutcomeOutput display format is the same as the example
2 ptsFull Marks
0 ptsNo Marks
2 pts
This criterion is linked to a Learning Outcomeprogram should include copywrite which contains the assignment number and your name
2 ptsFull Marks
0 ptsNo Marks
2 pts
Total Points: 17
A palindrome is a number or a text phrase that reads the same backward as forwar
A palindrome is a number or a text phrase that reads the same backward as forward. For example, each of the following five-digit integers is a palindrome: 12321, 55555, 45554 and 11611. Write a program that reads in a five digit integer and determines whether or not it’s a palindrome. [Hint: Use the division and remainder operators to separate the number into its individual digits.
Please enter a five digit integer: 12345
12345 is a not palindrome number
Please enter a five digit integer: 12321
12321 is a palindrome numberRubric
Rubric 1.2
Rubric 1.2
CriteriaRatingsPts
This criterion is linked to a Learning OutcomeDetailed comment to explain every step of the solution
2 ptsFull Marks
0 ptsNo Marks
2 pts
This criterion is linked to a Learning OutcomeSelf explanatory variable names and good coding format (empty lines, indentation ect)
2 ptsFull Marks
0 ptsNo Marks
2 pts
This criterion is linked to a Learning OutcomeUse division and remainder operators to separate the number into its individual digits
5 ptsFull Marks
0 ptsNo Marks
5 pts
This criterion is linked to a Learning OutcomeGenerate correct result
5 ptsFull Marks
0 ptsNo Marks
5 pts
This criterion is linked to a Learning Outcomeprogram should include copywrite which contains the assignment number and your name
2 ptsFull Marks
0 ptsNo Marks
2 pts
Total Points: 16
Write a program that prints the following diamond shape. Your printf statements
Write a program that prints the following diamond shape. Your printf statements may print either one asterisk (*) or one blank. Read an odd number in the range 1 to 19 to specify the number of rows in the diamond. Your program should then display a diamond of the appropriate size. Use nested for statements.
please enter number of rows (odd nummber): 4
please enter number of rows (odd nummber): 7
*
***
*****
*******
*****
***
*Rubric
Rubric 1.3
Rubric 1.3
CriteriaRatingsPts
This criterion is linked to a Learning OutcomeDetailed comment to explain every step of the solution
2 ptsFull Marks
0 ptsNo Marks
2 pts
This criterion is linked to a Learning OutcomeSelf explanatory variable names and good coding format (empty lines, indentation ect)
2 ptsFull Marks
0 ptsNo Marks
2 pts
This criterion is linked to a Learning OutcomeCheck use input is odd number, if not ask use to re-enter
4 ptsFull
0 ptsNo Marks
4 pts
This criterion is linked to a Learning OutcomeUse nested for statement
5 ptsFull Marks
0 ptsNo Marks
5 pts
This criterion is linked to a Learning OutcomePrint out the diamond pattern as exptected
5 ptsFull Marks
2 ptsPartial
print out some patten with empty space and stars, but not the correct patten
0 ptsNo Marks
5 pts
This criterion is linked to a Learning Outcomeprogram should include copywrite which contains the assignment number and your name
2 ptsFull Marks
0 ptsNo Marks
2 pts
Total Points: 20
PreviousNext
1 Write a single C statement to accomplish each of the following: a) Multiply th
1 Write a single C statement to accomplish each of the following:
a) Multiply the variable product by 2 using the *= operator.
b) Multiply the variable product by 2 using the = and * operators.
c) Test whether the value of the variable count is greater than 10. If it is, print “Count is greater than 10”.
d) Calculate the remainder after quotient is divided by divisor and assign the result to quotient. Write this statement two different ways.
e) Print the value 123.4567 with two digits of precision. What value is printed?
f) Print the floating-point value 3.14159 with three digits to the right of the decimal point. What value is printed?
2 Write a C statement to accomplish each of the following tasks.
a) Define variable x to be of type int and set it to 1.
b) Define variable sum to be of type int and set it to 0.
c) Add variable x to variable sum and assign the result to variable sum.
d) Print “The sum is: ” followed by the value of variable sum.
3 Combine the statements from Exercise 2 into a program that calculates the sum of the integers from 1 to 10. Use the while statement to loop through the calculation and increment statements. The loop should terminate when x becomes 11.
4 Write single C statements to perform each of the following tasks:
a) Input integer variable x with scanf. Use the conversion specification %d.
b) Input integer variable y with scanf. Use the conversion specification %d.
c) Set integer variable i to 1.
d) Set integer variable power to 1.
e) Multiply integer variable power by x and assign the result to power.
f) Increment variable i by 1.
g) Test i to see if it’s less than or equal to y in the condition of a while statement.
h) Output integer variable power with printf.
5 Write a C program that uses the statements in the preceding exercise to calculate x raised to the y power. The program should have a while iteration control statement.
6 Identify and correct the errors in each of the following and fix them:
7 What’s wrong with the following while iteration statement (assume z has value 100), which is supposed to calculate the sum of the integers from 100 down to 1?
PreviousNext
Instructions and other files needed are in the zip. I wrote most of the code but
Instructions and other files needed are in the zip. I wrote most of the code but stuck on the binary search, my code is the main4.c file.
Instructions and other files needed are in the zip. I wrote most of the code but
Instructions and other files needed are in the zip. I wrote most of the code but stuck on the binary search, my code is the main4.c file.
Instructions and other files needed are in the zip. I wrote most of the code but
Instructions and other files needed are in the zip. I wrote most of the code but stuck on the binary search, my code is the main4.c file.
Memory Allocations/deallocations and Avoiding Resource Leaks The objective of th
Memory Allocations/deallocations and Avoiding Resource Leaks
The objective of this assignment is a simple refresher on memory allocations and deallocations using C while avoiding resource leaks. See the attached full project details. Need to use the given skeleton code.