embedded systems. today introduction to mechatronics microcontroller –input / output ports (i/o)...

13
Embedded Systems

Upload: randolph-blair

Post on 20-Jan-2016

219 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Embedded Systems. Today Introduction to Mechatronics Microcontroller –Input / Output Ports (I/O) –Memory –ADC –PWM

Embedded Systems

Page 2: Embedded Systems. Today Introduction to Mechatronics Microcontroller –Input / Output Ports (I/O) –Memory –ADC –PWM

Today

• Introduction to Mechatronics

• Microcontroller

– Input / Output Ports (I/O)

– Memory

– ADC

– PWM

Page 3: Embedded Systems. Today Introduction to Mechatronics Microcontroller –Input / Output Ports (I/O) –Memory –ADC –PWM

Introduction to Mechatronics

http://en.wikipedia.org/wiki/Mechatronics_engineering

Page 4: Embedded Systems. Today Introduction to Mechatronics Microcontroller –Input / Output Ports (I/O) –Memory –ADC –PWM

Embedded Systems

• Special-purpose computer system designed to perform one or a few dedicated functions, often with real-time computing constraints.

• Usually controls a device

• Often meant for harsh environments

• Designed to be optimized, reducing the size and cost of the product, or increasing the reliability and performance.

• The Mun’der board is a embedded system

Page 5: Embedded Systems. Today Introduction to Mechatronics Microcontroller –Input / Output Ports (I/O) –Memory –ADC –PWM

Microcontroller

• A microcontroller or embedded microprocessor is essentially a computer-on-a-chip.

• They are used in everyday electronic devices, such as cellular telephones, household appliances, automobiles, etc.

• In contrast to general-purpose microprocessors (the kind used in a PC) they are self-sufficient and cost-effective.

• Anywhere you want to give a design a small amount of ‘intelligence’, or the ability to generate different outputs based on the given inputs.

• Allows the system to be highly flexible

Page 6: Embedded Systems. Today Introduction to Mechatronics Microcontroller –Input / Output Ports (I/O) –Memory –ADC –PWM

Microcontrollers

PIC18F4550 Microcontroller

Page 7: Embedded Systems. Today Introduction to Mechatronics Microcontroller –Input / Output Ports (I/O) –Memory –ADC –PWM

Microcontroller

Page 8: Embedded Systems. Today Introduction to Mechatronics Microcontroller –Input / Output Ports (I/O) –Memory –ADC –PWM

Microprocessor

• The ‘brains’ of the microcontroller

• Carries out programs instructions

• Performs arithmetic and logic operations

Page 9: Embedded Systems. Today Introduction to Mechatronics Microcontroller –Input / Output Ports (I/O) –Memory –ADC –PWM

Memory

• ROM - Read only Memory

– Non-Volatile - Data retains in memory even when its power supply is removed.

• RAM - Random Access Memory

– Volatile - Data is lost when the power supply is removed.

• Flash RAM – Random Access Memory

• EEPROM - Electrically Erasable Programmable ROM

• Used for instruction set, programs, variables.

Page 10: Embedded Systems. Today Introduction to Mechatronics Microcontroller –Input / Output Ports (I/O) –Memory –ADC –PWM

Microcontrollers - I/O

• There are 5 input/output (I/O) ports on the PIC18F4550 microcontroller

– Labeled A through E

– The ports are Bi-directional, can accept input signal or send out a output signal

– TRISB = 0x00;

• 0 – Output

• 1 – Input

• Note: Don’t use A6 as I/O

Page 11: Embedded Systems. Today Introduction to Mechatronics Microcontroller –Input / Output Ports (I/O) –Memory –ADC –PWM

And Operation (Side Note)

• Denoted by a ‘&’

• Used to single out bits of a port

Page 12: Embedded Systems. Today Introduction to Mechatronics Microcontroller –Input / Output Ports (I/O) –Memory –ADC –PWM

Microcontrollers - I/O

• Input

char var = PORTB & 0x01

• Output

LATBbits.LATB0 = 1;

LATB = 0x00;

Page 13: Embedded Systems. Today Introduction to Mechatronics Microcontroller –Input / Output Ports (I/O) –Memory –ADC –PWM

Microcontrollers - ADC

• ADC - Analog to Digital Convertor

• Class Notes

• 10-bit ADCs on the PIC18F4550 microcontroller, on 13 channels

• Code - Right Turn