1.2 Microcontroller Basics
1.2 Microcontroller Basics
- Microcontroller Basics -
CO3009 – Microcontroller Basics 2
§ Microcontrollers (MCUs)
▫ Usually chosen for a specific purpose
▫ Small packages
▫ On-chip memory and peripherals
▫ Fast “on time,” no BIOS or OS needed
§ https://www.youtube.com/watch?v=dcNk0urQsQM
[email protected]
CO3009 – Microcontroller Basics 3
[email protected]
CO3009 – Microcontroller Basics 4
[email protected]
CO3009 – Microcontroller Basics 5
[email protected]
CO3009 – Microcontroller Basics 6
ESP8266
[email protected]
CO3009 – Microcontroller Basics 7
PIC18F8722
[email protected]
CO3009 – Microcontroller Basics 8
STM32
[email protected]
CO3009 – Microcontroller Basics 9
§ Reference designs
[email protected]
CO3009 – Microcontroller Basics 12
[email protected]
CO3009 – Microcontroller Basics 13
[email protected]
CO3009 – Microcontroller Basics 14
[email protected]
CO3009 – Microcontroller Basics 15
§ If signal toggles between on and off quicker than the load, then the load
is not affected by the toggling.
[email protected]
CO3009 – Microcontroller Basics 16
[email protected]
CO3009 – Microcontroller Basics 18
[email protected]
CO3009 – Microcontroller Basics 19
Analog Comparator
§ Compare two voltages and then ...
▫ Cause a bit to change state
▫ Generate an interrupt
▫ Wake an MCU from a sleep state
[email protected]
CO3009 – Microcontroller Basics 20
§ They must be able to convert input analog signals, for example from
microphone or temperature sensor, to digital data.
§ They must also be able to convert digital signals to analog form, for
example if driving a loudspeaker or dc motor
[email protected]
CO3009 – Microcontroller Basics 22
Analog-To-Digital Conversion
§ Example
[email protected]
CO3009 – Microcontroller Basics 23
[email protected]
CO3009 – Microcontroller Basics 24
[email protected]
CO3009 – Microcontroller Basics 25
UART Communications
§ Universal Asynchronous Receiver-Transmitter (UART)
▫ Serial communications
▫ Self-timing operations
▫ Usually 8-bit transmissions at standard rates
▫ Common on most MCUs
[email protected]
CO3009 – Microcontroller Basics 26
[email protected]
CO3009 – Microcontroller Basics 27
UART
[email protected]
® Synchronous Serial Communication
CO3009 – Microcontroller Basics 28
[email protected]
CO3009 – Microcontroller Basics 29
SPI Operation
§ For SPI, there are Serial Clocks (SCLK), Chip Select lines (CS), Serial
Data In (SDI) and Serial Data Out( SDO).
§ Master sends out clocks and chip selects. Activates the slaves it wants
to communicate with.
[email protected]
CO3009 – Microcontroller Basics 32
[email protected]
CO3009 – Microcontroller Basics 33
SPI
[email protected] I2C
CO3009 – Microcontroller Basics 35
[email protected]
CO3009 – Microcontroller Basics 36
Serial Communications
§ Further Reading: “Serial Port Complete,” 2nd ed., by Jan Axelson,
Lakeview Research, 2007. ISBN: 978-1-931448-06-2.
[email protected]
CO3009 – Microcontroller Basics 37
“Controller Area Network,” by Konrad Etschberger,” IXXAT Automation, 2001. ISB: 978-3-00-007376-0.
[email protected] “A Comprehensive Guide to Controller Area Network,” by Wilfried Voss, Copper Hill Media, 2008. ISBN: 978-0976511601.
CO3009 – Microcontroller Basics 38
Interrupts
§ Cause immediate action
§ Internal and external hardware and software sources
§ Two types of action -- one or many vectors
§ Can present debug challenges
[email protected]
CO3009 – Microcontroller Basics 40
An ADC Interrupt
[email protected]
CO3009 – Microcontroller Basics 41
An ADC Interrupt
16/08/2021
[email protected]
CO3009 – Microcontroller Basics 42
[email protected]
CO3009 – Microcontroller Basics 43