If you find errors in the past exams or in this review guide, please email me at prl83@msstate.edu.
4/25/2025 - Due to a new copy of the ebook being published every semester, many of the hyperlinks on this page no longer work. To navigate to the correct link, you can either find your way there manually, or adjust the links yourself. To do this:
Right-click on link.
Select Copy Link (or press L in Firefox)
Open a new browser tab (Ctrl-T in Firefox)
Paste the old link into the address bar with Ctrl-V. Do not press enter yet!
Edit the link with the current year and semester. For example in the following links, you just need to change the highlighted portions:
https://interactive-ebooks.com/ns/books/published/pa2c_msstate_ece3724_2024_fall/exams/2018/y2018_fall_exam_f_problem_06.c.html
https://interactive-ebooks.com/ns/books/published/pa2c_msstate_ece3724_2024_fall/synch_serial_io/i2c_basics_ex_2.c.html
The final exam is cumulative, so the majority of the material is covered in Exam Topics 1-3.
Mean final exam grades: Spring 21: ~50%, Fall 23: 54.1%, Spring 24: 73.2%, Fall 24: 71.2% (On this and all exams, zeros were removed before taking the average.)
Fewer final exams are available for perusal, so there's less information on topic distribution. I would advise concentrating the bulk of your efforts on material covered in Exam Topics 1-3: There are always programming problems, and you're probably a little rusty at assembly. Even fairly simple topics like the NSC can present a challenge after several months of absence.
However, there are a few topics that are not covered in the previous review guides. These are listed below, along with links to practice questions.
This is the most likely to make an appearance. With one exception these problems have solutions available online, so they will not be provided here.
We have to write the function: void set_AD5248(uint16_t u16_isChannel2, uint16_t u16_resistanceOhms) that takes in a channel (0 for channel 1, 1 for channel 2) and a resistance, and sets the potentiometer via I2C.
We know we need to start and stop the I2C transaction, so we begin with:
startI2C1();
// start write transaction
// send channel
// send value to set resistance
stopI2C1();
From 2.3.2. I2C basics:
So now we have:
startI2C1();
putI2C1(0x5E); // start write transaction
// send channel
// send value to set resistance
stopI2C1();
Earlier in the exercise, we determine that 0x00 selects channel 1 and 0x80 selects channel 2. Thus:
startI2C1();
putI2C1(0x5E); // start write transaction
// send channel
if (u16_isChannel2) {
putI2C1(0x80); // select channel 2
} else {
putI2C1(0x00); // select channel 1
}
// send value to set resistance
stopI2C1();
Finally, from the datasheet, we have this equation:
So we start with:
u16_resistanceOhms = (D * RAB / 256) + (2 * Rw)
Earlier in the exercise, we determined that Rw = 160 ohms, and RAB = 10,000 ohms. Plugging in:
u16_resistanceOhms = (D * 10000 / 256) + (2 * 160)
Solving for D:
u16_resistanceOhms = (39.0625 * D) + 320
u16_resistanceOhms - 320 = (39.0625 * D)
D = (u16_resistanceOhms - 320) / 39.0625
And our final program is:
startI2C1();
putI2C1(0x5E); // start write transaction
// send channel
if (u16_isChannel2) {
putI2C1(0x80); // select channel 2
} else {
putI2C1(0x00); // select channel 1
}
// send value to set resistance
uint16_t D = (u16_resistanceOhms - 320) / 39.0625;
putI2C1(D);
stopI2C1();
Note - there is a sample solution floating around that sets the resistance like this:
if (u16_resistanceOhms == 360) putI2C1(1);
else if (u16_resistanceOhms == 5320) putI2C1(128);
else if (u16_resistanceOhms == 10281) putI2C1(255);
else putI2C1(0);
This is not a good solution, as it just looks at the test cases and sets the potentiometer to the correct answer. On an exam where you couldn't see the test cases, this wouldn't work.
"it produces 2.5 V at an acceleration of 0 g and has a sensitivity of 167 mV/g"
When we see slope and intercept, we know we need to use the beloved y = mx + b formula from Algebra I (which here is rewritten as V = slope*g + intercept)
y = V (volts produced)
m = 0.167 (V/g)
x = acceleration (g)
b = 2.5
So we've already solved the first two questions:
Slope 1: 0.167
Intercept 1: 2.5
Slope 2 wants to know V = ___ * code
This is where we apply "using 10-bit resolution and a VREF of 3.0 V" from the problem, and the formula:
V = (code / 2^n) * Vref
V = (code / 2^10) * 3.0
V = (3.0 / 1024) * code
V = 0.0029296875 V * code
so to 3 significant digits:
Slope 2: 0.00293
The next part says "Combining the two previous equations, g = ___ * code + intercept "
The first equation is V = slope * g + intercept, so if we plug in the numbers we found in the first two parts:
V = 0.167 * g + 2.5
Then from the third part,
V = 0.00293 * code
Combining both:
0.00293 * code = 0.167 * g + 2.5
Solving for g:
0.167 * g = 0.00293 * code - 2.5
g = (0.00293 / 0.167) * code - (2.5 / 0.167)
To 3 significant digits:
g = 0.0175 * code + (-14.97)
so (remembering the negative sign!):
Slope 3: 0.0175
Intercept 3: -14.97