ECET 330 Devry All Lab 1-7
Lab 1
Course Number: ECET330
Professor:
Laboratory Number:1 (Part 1)
Laboratory Title: Introduction to Memory Map
Submittal Date:Click here to enter a date.
Objectives:
To become familiar with address decoding
To become familiar with HCS12 memory map
Observations/Measurements:
IV. 1: Memory Address Ranges
IV. 2 How does the memory system of Figure 1 react to these values?
IV. 3 Explain which memory unit in Figure 1 is selected.
IV. 4. How much on-chip RAM memory do we have for the MC9S12G128 microcontroller?
Questions:
1. Give two differences between EEPROM and Flash memory
2. Indicate the use of each memory in the microcontroller. In other words, state which one is used for code, program variables, and variables that must remain when the power is turned off.
3. State the number of address and data pins for 32Kx8 SRAM
4. State the number of address and data pins for 8Kx8 SRAM memory
Laboratory Number: 1 (Part 2)
Laboratory Title: Introduction to Assembly and Machine Language
Objectives:
To become familiar with the CPU function
Understanding machine language
Understanding assembly language
Results:
We were able to understand how a CPU functions
We were able to write a received program in machine and assembly language
Observations/Measurements:
IV. 1 - Explain the cycles that CPU goes through in the animation of Lecture 1:
IV. 2.a - Write the machine language program (binary code).
IV. 2.b - Write the assembly language program.
IV. 3.a - Write the assembly language program.
IV. 3.b - Write the machine language program
Lab 2
Course Number: ECET330
Professor:
Laboratory Number:
Laboratory Title: Introduction to CodeWarrior
Submittal Date:3/16/2014
Objectives:
To Install CodeWarrior
Explore the CodeWarrior IDE and the operations
Become familiar with how an assembly language program is entered and simulated using CodeWarrior
To learn how to generate a list file
Observations/Measurements:
IV. 1- A. Copy and paste the complete source code for adding 7 and 8.
IV. 1-B. Copy and paste the IDE register window showing the value of A and B.
IV. 1-C. Copy and paste the IDE register window showing the value of A and B after executing the instruction to add A and B.
IV. 1.D - Copy and paste the Assembly Window showing the machine code.
IV. 2. A. Copy and paste the source code for adding your ID numbers.
IV. 2. B. Copy and paste the IDE register window showing the value of final result (in HEX
IV. 2. C. Copy and paste the IDE register window showing the value of final result (in decimal).
IV. 2. D. Zero and Carry flag.
Questions:
Assume that the value of Register A is $FF and Register B is 00. What will be the value of zero flag, carry flag, Register A, Register B, and Register D after executing the instruction?
2. Assume that the value of Register A is $FF and Register B is 00. What will be the value of zero flag, carry flag, Register A, Register B, and Register D after executing the instruction?
3.Assume that the value of Register A is $FF and Register B is 00. What will be the value of zero flag, carry flag, Register A, Register B, and Register D after executing the instruction?
4. Assume that the value of Register D is $00FF. What will be the value of Registers A, B, and D after executing the instruction?
Lab 3
Course Number: ECET330
Professor:
Laboratory Number: 3
Laboratory Title: Introduction to Loops and Subroutines in Assembly Language
Submittal Date:Click here to enter a date.
Objectives:
To become familiar with conditional branch instructions
Understanding how to write loops
Understanding how to write subroutines
Observations/Measurements:
IV. 1.A. Copy and paste the source code.
IV. 1. B. Copy and paste the register window at the second iteration where the carry becomes set. Highlight the carry flag to show that it is set.
IV. 1. C Copy and paste the register window to show the final result.
IV. 2.A. Copy and paste the source code.
IV. 2. B. Copy and paste the assembly, register, and memory after the first JSR instruction to verify that stack holds the return address.
IV. 2. C Copy and paste the memory window to show the values of Sum1 and Sum2.
Questions:
What does the CPU do (in terms of register contents and stack) when it executes a JSR instruction?
2. What does the CPU do (in terms of register values and stack) when it executes a RTS instruction?
Course Number: ECET330
Professor:
Laboratory Number: 4
Laboratory Title: Introduction to Tower Module
Submittal Date:3/27/2014
Objectives:
To set up the Tower System
Become familiar with programming and using the Tower Module
Become familiar with I/O port programming
Observations/Measurements:
IV. 2-A. Copy and paste the source code.
IV. 2-B. Copy and paste the memory window showing the value of PTT.
IV. 3.A - Copy and paste the source code.
IV. 3. B. Show the one-second delay calculation.
IV. 3. C. Describe the LED values
IV. 4. A. Copy and paste the source code.
IV. 4. B. Show the 0.75-second delay calculation
IV. 4. C. Describe the LED values.
IV. 5. A. Cut and paste the source code.
5. B. Show the 0.5-second delay calculation.
IV. 5. C. Describe the LED values.
LED2 alternates between turning on and turning off, staying at its current state for half a second. All the other LEDs stay off the whole time.
Lab 5
Course Number: ECET330
Professor:
Laboratory Number: 5
Laboratory Title: Data Manipulation in Assembly Language
Submittal Date:
Objectives:
1. Given an arithmetic equation or data conversion, develop an assembly-language algorithm to implement the correct sequence of operations.
2. Learn how to design assembly-language programs that require decision logic in order to accomplish their tasks.
Observations/Measurements:
IV. 1-B. Cut and paste memory to show the value of z.
IV. 1-C.Cut and paste the Register window to show the remainder.
IV. 2.A - Copy and paste the source code.
IV. 2. B. Test your program for three different values and show the result of each one by dumping memory.
IV. 3. A.Check the code for the value, $73. Cut and paste the memory to show the number of zeros for this value.
IV. 3. B.Check the code for the value, $88. Cut and paste the memory to show the number of zeros for this value.
IV. 4. A.Cut and paste the source code
IV. 4. B.Test the code with the two values, 00111010 and 00101100. Cut and paste the Register window for each case to show the value of the extra bit in Register A
Course Number: ECET330
Professor:
Laboratory Number: 6
Laboratory Title: Embedded C Programming: Part I
Submittal Date:
Objectives:
To learn how to write a C program using CodeWarrior IDE
To learn how to program I/O instructions in C language
To learn how to organize a C program to read data from input ports, process the data, and display the result on a simple output device
To learn how to write inline assembly language in C
IV. 1-A. Cut and paste the Memory window.
IV. 1-B. Cut and paste the Memory window to show the value of result.
IV. 1.C - What is the value displayed on the LEDs after you single step the line PTT = ~result?
IV. 2. A. What are the LED values?
IV. 2. B. Calculate the delay size and show your work.
IV. 3. A. Cut and paste the source code.
IV. 3. B. Cut and paste the Memory window
IV. 3. C. Describe the values of LEDs. What is the last value that you see?
IV. 4. A. Cut and paste the source code.
IV. 4. B. Describe the values of LEDs. What is the last value that you see? Does the loop end
IV. 5. . Does the loop end? Describe the reason
Questions:
When we write a C program, in some cases, we need to write some part of the code in assembly language. What do we call an assembly-language code written in a C program? Describe a situation where assembly-language code is preferred over C.
2. Discuss the reason why we used unsigned char for a loop counter of Problem 4 as opposed to int.
Lab 7
Course Number: ECET330
Professor:
Laboratory Number: 7
Laboratory Title: Embedded C Programming: Part II
Submittal Date: Click here to enter a date.
Objectives:
To become familiar with enabling internal pull-up resistors and reading an input port
To learn how to wait for a pushbutton press
To learn how to organize a C program to read data from input ports, process the data, and display the result on a simple output device
To learn how to use the ROM program space for data
Observations/Measurements:
IV. 1- A. Cut and paste the Memory window, showing the value of mybye before pressing SW1.
IV. 1-B. Cut and paste the Memory window, showing the value of mybyte after pressing SW1.
IV. 1.C - Which LED light turns ON?
IV. 1.D- What are the LED values when you press SW2?
IV. 2. A. Cut and paste the source code.
IV. 2. B. What is the value of PT1AD? Cut and paste the Memory window, showing the value of PT1AD.
IV. 2. B.What are the LED values when you press SW2? Describe what you observe when you press any of the pushbuttons
IV. 3. A. Cut and paste the source code.
IV. 3. B. What are the LED values when you press SW4? Describe what you observe when you press a different switch when the light is ON.
IV. 4. A. Cut and paste the source code
IV. 4. B. Cut and paste the Memory window.
IV. 4. C. Describe how you verify that the data is stored in ROM. Cut and paste the Memory window.
IV. 4. D. Describe how you verify that the data is stored in RAM. Cut and paste the Memory window
Questions:
Describe the code statement:
while ((PT1AD & 0xF0) != 0xF0);
What does this code do? Do we need the inner parenthesis for the code to work? Why?
2.When we define an array in the program ROM space, we use a const keyword. What does this keyword do? What does happen if we remove this keyword?