Micro-controllers for beginners

27

description

A presentation I was presenting it for the robotics academy students at tanta university

Transcript of Micro-controllers for beginners

Page 1: Micro-controllers for beginners
Page 2: Micro-controllers for beginners
Page 3: 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).

Page 4: Micro-controllers for beginners

• A general purpose system can do many different tasks depending on the running program.

Page 5: Micro-controllers for beginners
Page 6: Micro-controllers for beginners

Programmable Devices

ASIC

IC’s

Page 7: Micro-controllers for beginners

ASIC

1. Non-formal understanding

2. HDL (Formal) description

3. Verification

4. Logic synthesis

5. Gate level synthesis

6. Routing

7. Layout

Page 8: Micro-controllers for beginners

Programmable devices

• They do nothing unless they are programmed

1. FPGA(Field Programmable Gate Array)

2. Microcontrollers

Page 9: Micro-controllers for beginners

Microcontroller

Page 10: Micro-controllers for beginners

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

Page 11: Micro-controllers for beginners

Where can I find a microcontroller?

Page 12: Micro-controllers for beginners
Page 13: Micro-controllers for beginners

Memory types

Volatile Non-volatile

Flash MemoryEEPROM

SRAM

Page 14: Micro-controllers for beginners

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.

Page 15: Micro-controllers for beginners

Digital Input & Output

Page 16: Micro-controllers for beginners

Digital Input & Output

• Port = 8-pins

• Input only, output only, or bidirectional.

Page 17: Micro-controllers for beginners

Digital Input & Output

Page 18: Micro-controllers for beginners

What if the input signal is analogue???

• When using a photo transistor as a light sensor.

Page 19: Micro-controllers for beginners

Analogue comparator

• Compare them to each other or to a known reference voltage.

• When comparing is not sufficient we use ADC and DAC

Page 20: Micro-controllers for beginners
Page 21: Micro-controllers for beginners

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

Page 22: Micro-controllers for beginners
Page 23: Micro-controllers for beginners

Interrupt handling

• When the interrupt happens, an interrupt service routine is called.

• Maps interrupts to ISRs.

Page 24: Micro-controllers for beginners

Timer

• Magical register 8 or 16 bit.

Page 25: Micro-controllers for beginners

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.

Page 26: Micro-controllers for beginners

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

Page 27: Micro-controllers for beginners