C12 Embedded systems in MicroPython and C · Practice
The board: pins, peripherals and the datasheet
Problems dealt one at a time, with new numbers every time. The kinds you miss come back more often, and you can keep going as long as you like.
Check
An LED with forward voltage 2 V hangs from a 3.3 V pin through 220 Ω. What current does it draw?
Write units the way you normally would: 1.5 mA, 1500 µA and 0.0015 A are the same answer.
Check
Choose the series resistor for an LED with 2 V forward voltage to carry 2 mA from a 3.3 V pin.
Write units the way you normally would: 1.5 Ω, 1500 mΩ and 0.0015 kΩ are the same answer.
Check
How many clock cycles of the 10 MHz board pass in 25 µs?
Check
A register sits at offset 08 from a peripheral's base, 40000000. What's its address, in hex?
Check
Pin P5 is bit 5 in the GPIO registers. What mask, in hex, selects only that pin?
Check
8 LEDs each draw 3 mA from their own pins. How much current does the chip supply to them in total?
Write units the way you normally would: 1.5 mA, 1500 µA and 0.0015 A are the same answer.
Check
An LED is wired to P2. Write a MicroPython program that turns it on.
MicroPython on the course's board: machine (Pin, PWM, ADC, DAC, UART, I2C, SPI, Timer, WDT) and time. Each call into the hardware takes about 40 µs. Tab indents; press Esc and then Tab to move on.
Check
An LED with 2.1 V forward voltage is driven from a 3.3 V pin through 100 Ω; a pin may source 12 mA.
(a)
What current flows?
Write units the way you normally would: 1.5 mA, 1500 µA and 0.0015 A are the same answer.
(b)
How many such LEDs can one pin drive?
Check
On the 10 MHz board, consider an interval of 2.5 µs and a loop of 4 one-cycle instructions.
(a)
How many cycles is the interval?
(b)
How many whole passes of the loop fit in it?
Check
LED current: 2 V LED, 150 Ω, 3.3 V pin?
Write units the way you normally would: 1.5 mA, 1500 µA and 0.0015 A are the same answer.
Check
Cycles in 80 µs at 10 MHz?
Check
Mask for P7, in hex?
A kind of problem counts as solid once you've got it right on the first try twice in a row. Back to the lesson · Practice every topic in C12