Download - Micro-controllers for beginners
• Embedded system is a special purpose system designed to perform one or few dedicated functions.
• It is usually Embedded as a part of complete device including hardware and mechanical parts (robots).
• A general purpose system can do many different tasks depending on the running program.
Programmable Devices
ASIC
IC’s
ASIC
1. Non-formal understanding
2. HDL (Formal) description
3. Verification
4. Logic synthesis
5. Gate level synthesis
6. Routing
7. Layout
Programmable devices
• They do nothing unless they are programmed
1. FPGA(Field Programmable Gate Array)
2. Microcontrollers
Microcontroller
Microcontroller
• Is a common electronic building block
• Is a full computer inside a single IC chip
• Input circuitry -> MCU -> Output circuitry
• With a microcontroller you are in control, you decide :-
1. The function of the IC
2. For what the pins are used
3. What external devices the pins are connected to
Where can I find a microcontroller?
Memory types
Volatile Non-volatile
Flash MemoryEEPROM
SRAM
Memory Types
• Flash Memory:
Where you put your code.
• SRAM:
for variable storage and stack space during the runtime.
• EEPROM:
Access is slow; it serves as a form of secondary storage.
Digital Input & Output
Digital Input & Output
• Port = 8-pins
• Input only, output only, or bidirectional.
Digital Input & Output
What if the input signal is analogue???
• When using a photo transistor as a light sensor.
Analogue comparator
• Compare them to each other or to a known reference voltage.
• When comparing is not sufficient we use ADC and DAC
Interrupt
• Signal indicating the need for attention
• Causes the processor to save its state and begin execution of interrupt handler.
Interrupt control
1. Enable global interrupt
2. Enable particular interrupt
3. Handler code
4. Facility to trigger the interrupt
Interrupt handling
• When the interrupt happens, an interrupt service routine is called.
• Maps interrupts to ISRs.
Timer
• Magical register 8 or 16 bit.
Timer
• Its value can increase automatically at defined rate.
• Take some actions automatically or inform the CPU upon certain conditions e.g. timer overflow, compare match, and input capture.
CS2 CS1 CS0
0 0 0 stopped
0 0 1 Pck\8
0 1 0 Pck\64
0 1 1 Pck\256
1 0 0 Pck\1024
1 0 1 Tx falling
1 1 0 Tx rising
1 1 1 N\A