SYSC 3310: Introduction to Real
Time Systems
Lecture 14: Midterm correction
Dr. Paulo Garcia
Assistant Professor
Department of Systems and Computer EngineeringMidterm results
• 75% achieved a passing mark
• Class
...
SYSC 3310: Introduction to Real
Time Systems
Lecture 14: Midterm correction
Dr. Paulo Garcia
Assistant Professor
Department of Systems and Computer EngineeringMidterm results
• 75% achieved a passing mark
• Class average: 64%
• Passing mark average: 74%Midterm
• The main purpose of having a midterm is to give you
feedback
• Specifically, identifying what you’re doing wrong or do not know
• I care about what you will know at the end of the course
• In other words, no one fails because of a midterm aloneCourse evaluation
• You only get lab marks if you have more than 50% in either
midterm or final
• Otherwise, mark is 50% midterm + 50% final
• If your midterm mark is better than your final mark:
• 20% labs + 35% midterm + 45% final
• If your final mark is better than midterm mark:
• 20% labs + 80% finalQuestion 1 (average = 7%)
• 1: Given three registers REG_A, REG_B and REG_C, at
addresses 0x7000466, 0x7000468 and 0x700046A,
respectively; which type cast should you use in the following
code that writes 0 to REG_B? Why (justify)?
REG_B = ( )0;Question 1
• 1: Given three registers REG_A, REG_B and REG_C, at
addresses 0x7000466, 0x7000468 and 0x700046A,
respectively; which type cast should you use in the following
code that writes 0 to REG_B? Why (justify)?
REG_B = ( uint16_t )0; registers are 2 bytes in size
0x7000468 - 0x7000466 = 2
0x700046A - 0x7000468 = 2
REG_A (bits 15 to 8)
REG_A (bits 7 to 0)
0x700046B
0x700046A
0x7000469
0x7000468
0x7000467
0x7000466Question 1: misconceptions
• 0x7000466 = 28bits, hence registers are 28 bits X
• Size of the address has nothing to do with size of what we’re
addressing
• You could use an 8 bits address (e.g., 0x80) to address 8 bit registers.
16 bit registers, 32 bit registers….. etc
• Registers are two bits apart X
• 1 byte = 8 bits
• Memory is always byte-addressableQuestion 2
• 2: Assume the pins in Port 1 are connected to external
devices (active low buttons for input and active high motors
for output) as in the diagram below.
0 1 2 3 4 5 6 7
Port 1
Button
MotorQuestion 2a (average = 53%)
• 2a: What is wrong with the following code to start the motor
connected to pin 3? Justify and write the correct code.
• P1OUT = (uint8_t)0x8;Question 2a
• 2a: What is wrong with the following code to start the motor
connected to pin 3? Justify and write the correct code.
• P1OUT = (uint8_t)0x8;
• P1OUT = 0b00001000 Clearing every
[Show More]