Sie sind auf Seite 1von 136

Module 5

AVR Microcontrollers
• AVR is a family of microcontrollers developed since 1996 by Atmel,
acquired by Microchip Technology in 2016
• The architecture of this microcontroller was developed by “Alf-Egil Bogen”
and “Vegard Wollan”.
• The term AVR derives from its developers and stands for Alf-Egil Bogen
Vegard Wollan RISC microcontroller, also known as “Advanced Virtual
RISC”.
• The first microcontroller AT90S8515 was based on the AVR architecture
• This microcontroller is an 8-bit RISC (Reduced Instruction Set Computing)
• It has SRAM, on-chip programmable flash memory, IO data space, and the
EEPROM. This is the first microcontroller in the marketplace, which has on-
chip flash storage.
AVR microcontrollers are obtainable in three categories
• Tiny AVR: This microcontroller has Less memory, small in size, apt
only for simpler applications.
• Mega AVR: This microcontroller is the most popular ones having a
good amount of memory up to 256KB, higher no. of inbuilt
peripherals and fit for modest to difficult applications.
• Xmega AVR: This microcontroller is used commercially for compound
applications, which need large program memory and also high speed
AVR Microcontroller Architecture

• It uses a “Harvard architecture” thus it has separate buses and


memories for data and program.
• Instructions in the program memory are performed with a single
level pipelining.
•Application-specific AVR
•megaAVRs with special features not found on the other members of the AVR family,
•such as LCD controller, USB controller, advanced PWM, CAN, etc.
•FPSLIC (AVR with FPGA)
•FPGA 5k to 40k gates
•SRAM for the AVR program code, unlike all other AVRs
•AVR core can run at up to 50 MHz
•32-bit AVRs
In 2006, Atmel released microcontrollers based on the 32-bit AVR32 architecture.
This is a completely different architecture unrelated to the 8-bit AVR, intended to compete with the ARM-based
processors.
It has a 32-bit data path, SIMD and DSP instructions, along with other audio- and video-processing features.
The instruction set is similar to other RISC cores, but it is not compatible with the original AVR (nor any of the
various ARM cores).
GPIO ports
Each GPIO port on a tiny or mega AVR drives up to eight pins and is
controlled by three 8-bit registers: DDRx, PORTx and PINx, where x is
the port identifier.

DDRx: Data Direction Register, configures the pins as either inputs or


outputs.
PORTx: Output port register. Sets the output value on pins configured
as outputs. Enables or disables the pull-up resistor on pins configured
as inputs.
PINx: Input register, used to read an input signal.
AVR Sleep Modes
Atmega 328
• Atmega328 is a low power CMOS 8-bit microcontroller based on the
AVR enhanced RISC architecture. By executing powerful instructions
in a single clock cycle, the controller achieves throughputs
approaching 1 MIPS per MHz awing the system designer to optimize
power consumption
ATmega8
• It consists of 8KB of flash memory, 1KB of SRAM and 512 Bytes of
EEPROM.
• It consists of 23 I/O lines with 3 I/O ports, named B, C and D. Port B
consists of 8 I/O lines, Port C consists of 7 I/O lines and Port D consists
of 8 I/O lines
• It consists of 3 timers with comparable modes. Two of them are 8 bit
whereas the third one is 16 bit.
• It incorporates internal reset and oscillator which makes it possible to
eliminate the need for any external input.
• It provides both synchronous and asynchronous data transfer
schemes
• It also contains a 6 channel ADC out of which 4 have 10 bit accuracy
and 2 have 8 bit accuracy.
FEATURES OF ATMEGA 328
• High-performance, Low-power AVR 8-bit Microcontroller.
• Advanced RISC Architecture .
• 32 8-bit GP registers.
• 3 8-bit I/O ports.
• 32 KB flash memory.
• 1 KB EEPROM & 2 KB SRAM.
• On chip 10 bit A/D converter.
• 16-bit timer.
MSP430
In MSP430 Value Line LaunchPad Development Tool, there is:
(i) 10 GPIO in a 14-pin MCU
(ii) 16 GPIO in a 20-pin MCU.
MSP430G2211/MSP430G2231/MSP430G2452/MSP430G2553 is
some common microcontroller chips used. MSP430G2553 is the best
in term of FLASH and RAM size.
The MSP430 will run with anywhere between 1.8 V and 3.6 V, though
at least 2.2 V is needed to do any programming to the chip. Keep in
mind that the speed at which the chip is able to run also depends on
the voltage; though it's capable of running up to 16 MHz, at 1.8 V an
MSP430 cannot run any faster than 6 MHz.
SOFTWARE TO PROGRAM MSP430 LAUNCHPAD
1. IAR Embedded Workbench Kickstart
a. The free version is limited to 4 kb code size
b. Another possibility is a 30-day Evaluation version that has no limitation.

2. Code Composer Studio


a. TI’s own MSP430 development suite.
b. Free version is limited to 16 kb code size.

3. Energia
a. Easy to use. Arduino-compatible
Simple LED Programming
#include <msp430g2553.h>
void main()
{
WDTCTL = WDTPW + WDTHOLD;
P1DIR = BIT0 + BIT6;
P1OUT = BIT6;

while(1)
{
P1OUT ^= BIT0 + BIT6;
__delay_cycles(220000);
}
}
__delay_cycles(220000);
• Delay 220000 cycles. By default, one cycle need roughly 0.9 us to
execute. Thus, approximate delay timing will be:
• 220000 cycles x 0.9us per cycle = 0.2 s delay
Button Programming with Interrupt
#include <msp430g2553.h>
void main(void)
{
WDTCTL = WDTPW + WDTHOLD;
P1DIR = BIT6;
P1REN = BIT3;
P1OUT = BIT3;
P1IE = BIT3;
__enable_interrupt();
while(1){ }
}
#pragma vector=PORT1_VECTOR
__interrupt void Port_1(void)
{
__delay_cycles(500000);
P1OUT ^= BIT6;
P1IFG = ~BIT3;
}
PIC Microcontroller
Features
• PIC microcontroller was developed in the year 1993 by microchip
technology.
• The term PIC stands for Peripheral Interface Controller.
• PIC Microcontroller architecture is based on Harvard architecture.
• PIC microcontrollers are very popular due to their ease of programming,
wide availability, easy to interfacing with other peripherals, low cost, large
user base and serial programming capability
• PIC microcontrollerarchitecture consists of RAM, ROM, CPU, timers,
counters and supports the protocols such as SPI, CAN, and UART for
interfacing with other peripherals
• First family: PIC10 (10FXXX) called Low End
• Second family: PIC12 (PIC12FXXX) called Mid-Range
• Third family: PIC16 (16FXXX)
• Fourth family: PIC 17/18 (18FXXX)
Architecture
• The series of PIC16 consists of five ports such as Port A, Port B, Port C, Port
D & Port E.
• Port A is an 16-bit port that can be used as input or output port based on
the status of the TRISA (Tradoc Intelligence Support Activity) register.
• Port B is an 8- bit port that can be used as both input and output port.
• Port C is an 8-bit and the input of output operation is decided by the status
of the TRISC register.
• Port D is an 8-bit port acts as a slave port for connection to the
microprocessor BUS.
• Port E is a 3-bit port which serves the additional function of the control
signals to the analog to digital converter.
LPC2148
ARM7TDMI –S stands for:

ARM - Advanced RISC Machines

 7 - Version number of the architecture

 T - THUMB: 32-bit wide instruction words 16-bit wide


memory

 D - Debug: 2 break points to stop the CPU (both


hardware and software)

 M - Multiplier: enhanced (relative to earlier ARM cores)


32x8 Multiplier. 59
 I: Interface: Embedded ICE macro cell. JTAG- Joint
Test Action Group.

 -S: synthesizable (ie., distributed as RTL rather than


a hardened layout)
• PACKAGE:
• 16/32-bit ARM7TDMI-S microcontroller in a tiny LQFP64
package.

• MEMORY:
• 40 kB of on-chip static RAM

• 512 kB of on-chip flash program memory.

• SPEED:
• 128 bit wide interface/accelerator enables high speed 60 MHz
operation.

• In-System / In-Application Programming (ISP/IAP) via on-


chip boot-loader software.
• Single flash sector or full chip erase in 400 ms and
programming of 256 bytes in 1ms.

• USB 2.0 Full Speed compliant Device Controller with


2kB of endpoint RAM.

• In addition, the LPC2146/8 provides 8kB of on-chip


RAM accessible to USB by DMA.
• ADC:
• Two 10-bit A/D converters(AD0 and AD1) provide a total
of 14 analog inputs

• Conversion times as low as 2.44μs per channel.

• DAC:
• Single 10-bit D/A converter provides variable analog
output.
• TIMERS:
• Two 32-bit timers/external event counters

• Each timer with four capture and four compare channels

• PWM unit (six outputs)

• Watchdog timer

• RTC:
• Low power real-time clock with independent power and
dedicated 32 kHz clock input.
• SERIAL INTERFACES:
• I2C-bus:

• Two Fast I2C-bus with 400 kbit/s

• Serial communication:

• Two UARTs (16C550)

• SPI (Serial Peripheral Interface) and SSP(Synchronous Serial


Port) with buffering and variable data length capabilities

• FAST GPIO: Up to 45 of 5 V tolerant fast general


purpose I/O pins in a tiny LQFP64
• INTERRUPTS:
• Vectored interrupt controller with 16 configurable priorities
and vector addresses.

• 9 edge or level sensitive external interrupt pins available.

• 60 MHz maximum CPU clock available from


programmable on-chip PLL with settling time of 100
μs.
• OSCILLATOR:
• On-chip integrated oscillator operates with an external crystal
in range from 1 MHz to 30 MHz and with an external
oscillator up to 50 MHz

• POWER SAVING MODES:


• Idle mode

• Power-down mode

• CPU operating voltage range of 3.0 V to 3.6 V (3.3 V ±


10 %) with 5 V tolerant I/O pads.
GPIO Registers
• PINSEL
• IODIR
• IOSET
• IOCLR
• IOPIN
PINSEL 0
PINSEL 1
PINSEL2
• IO0DIR
IO0DIR is used to configure pins of Port 0-P0 as input or output pins.
1= Output Pin
0= Input Pin
Example: IO0DIR=0x0000FFFF means P0.0 to P0.15 are configured as output pins and P0.16 to P0.31
are configured as input pins.
• IO1DIR
IO1DIR is used to configure pins of Port 1-P1 as input or output pins.
1= Output Pin
0= Input Pin
Example: IO1DIR=0xAAAAAAAA means even pins (P1.0, P1.2, P1.4 etc.) are configured as input pins
and odd pins (P1.1, P1.3, P1.5 etc.) are configured as input pins.
• IO0SET
It is used to set pins of Port0-P0 to logic 1.
Example: IO0SET=0x0000FFFF will set pins P0.0 to P0.15 at logic 1. It will not affect other pins.
• IO0CLR
It is used to set pins of Port0-P0 to logic 0.
Example: IO0CLR=0x0000FFFF will set pins P0.0 to P0.15 at logic 0. It will not affect other pins.
• IO1SET
It is used to set pins of Port1-P1 to logic 1.
Example: IO1SET=0x0000FFFF will set pins P1.0 to P1.15 at logic 1. It will not affect other pins.
• IO1CLR
It is used to set pins of Port1-P1 to logic 0.
Example: IO1CLR=0x0000FFFF will set pins P1.0 to P1.15 at logic 0. It will not affect other pins.
Once the use of above all registers is perfectly understood, you are good to go with programming.
• SCS (System control and status register)(32 bits)
we use only 2 bits out 32 bits
0th bit for Port 0: 0=SGPIO
1=FGPIO
1st bit for Port 1: 0=SGPIO
1=FGPIO
GPIO programming
Program to blink single led
#include<LPC214X.h>
void delay(unsigned int);
int main()
{
IODIR0=0X00000001;
while(1)
{
IOSET0=0X00000001;
delay(20);
IOCLR0=0X00000001;
delay(20);
}
}
void delay(unsigned int i)
{
int j,k;
for(j=0;j<i;j++)
for(k=0;k<1275;k++);
}
Program to blink 8 led’s
#include<LPC214X.h>
void delay(unsigned int);
int main()
{
IODIR0=0X000000ff;
while(1)
{

IOSET0=0X000000ff;
delay(20);
IOCLR0=0X0000000ff;
delay(20);
}
}
void delay(unsigned int i)
{
int j,k;
for(j=0;j<i;j++)
for(k=0;k<1275;k++);
}
Program to blink alternate led’s
#include<LPC214X.h>
void delay(unsigned int);
int main()
{
IODIR0=0X000000ff;
while(1)
{
IOSET0=0X000000aa;
IOCLR0=0X00000055;
delay(20);
IOSET0=0X00000055;
IOCLR0=0X000000AA;
delay(20);
}
}
void delay(unsigned int i)
{
int j,k;
for(j=0;j<i;j++)
for(k=0;k<1275;k++);
}
Main Difference between AVR, ARM, 8051 and PIC Microcontrollers
Raspberry Pi
• The Raspberry Pi has a Broadcom BCM2835 system on a chip
(SoC),which includes an ARM1176JZF-S 700 MHz processor
• Video Core IV GPU
• originally shipped with 256 megabytes of RAM, later upgraded to
512MB.
• It does not include a built-in hard disk , but uses an SD card for
booting and long-term storage.
Hardware
• 10/100 BaseT Ethernet socket
• HDMI socket
• USB 2.0 socket
• RCA video socket
• SD card socket
• Powered from microUSB socket
• 3.5mm audio out jack
Power

5v micro
USB connector
3.5mm Audio
Standard
A/V (Audio/Video) headphone
socket
RCA Video
(works with most
older TVs)

HDMI Audio & Video


(works with modern TVs and DVI monitors)
Connectivity
2 x USB 2.0
ports
GPIO
(General
Purpose
Input &
Output)

10/100Mb
Ethernet
Internals LAN Controller

DSI
(display
interface) CSI
(camera
interface)
SOC (System On a Chip)
Broadcom BCM2835 700Mhz
Storage

SD Card Slot
(supports SD cards up to 32GB)
Operating System
• Linux on a bootable SD card
• Fedora
• Raspbian
• Debian
• ArchLinux ARM
Intel Galileo
• Intel Galileo is the first in a line of Arduino-certified development boards
based on Intel x86 architecture and is designed for the maker and
education communities.
• Intel released two versions of Galileo, referred to as Gen 1 and Gen 2.
These development boards are sometimes called "Breakout boards".
• Galileo is a microcontroller board based on the Intel® Quark SoC X1000
Application Processor, a 32-bit Intel Pentium-class system on a chip.
• Galileo is designed to support shields that operate at either 3.3V or 5V.
The core operating voltage of Galileo is 3.3V. However, a jumper on the
board enables voltage translation to 5V at the I/O pins. This provides
support for 5V Uno shields and is the default behavior. By switching the
jumper position, the voltage translation can be disabled to provide 3.3V
operation at the I/O pins.
• In addition to Arduino HW and SW
compatibility, the Galileo board has
several PC industry standard I/O
ports and features to expand native
usage and capabilities beyond the
Arduino shield ecosystem. A full
sized mini-PCI Express* slot,
100Mb Ethernet port, Micro-SD
slot, RS-232 serial port, USB Host
port, USB Client port, and 8MByte
NOR flash come standard on the
board.
Details and Specifications
• Arduino Shield Supported Features
• Galileo is compatible with Arduino Uno shields and is designed to support
3.3V or 5V shields
• 14 digital input/output pins, of which 6 can be used as Pulse Width
Modulation (PWM) outputs;
• Each of the 14 digital pins on Galileo can be used as an input or output, using
pinMode(), digitalWrite(), and digitalRead() functions.
• The pins operate at 3.3 volts or 5 volts. Each pin can source a max of 10mA or
sink a maximum of 25 mA and has an internal pull-up resistor (disconnected
by default) of 5.6k to 10 kOhms.
• A0 – A5 - 6 analog inputs, via an AD7298 analog-to-digital (A/D) converter
each of the 6 analog inputs, labeled A0 through A5, provides 12 bits of
resolution. By default they measure from ground to 5 volts.
• I2C* bus, TWI, with SDA and SCL pins that are near to the AREF pin.
• TWI: A4 or SDA pin and A5 or SCL pin. Support TWI communication using
the Wire library.
• SPI: Defaults to 4MHz to support Arduino Uno shields. Programmable up
to 25MHz.
• UART (serial port) Programmable speed UART port (Pins 0 (RX) and 1
(TX))
• ICSP (SPI) - a 6 pin in-circuit serial programming (ICSP) header, located
appropriately to plug into existing shields. These pins support SPI
communication using the SPI library.
• VIN. The input voltage to the Galileo board when it's using an external
power source (as opposed to 5 volts from the regulated power supply
connected at the power jack). You can supply voltage through this pin,
or, if supplying voltage via the power jack, access it through this pin.
• 5V output pin. This pin outputs 5V from the external source or the
USB connector. Maximum current draw to the shield is 800 mA
• 3.3V output pin. A 3.3 volt supply generated by the on-board
regulator. Maximum current draw to the shield is 800 mA
• GND. Ground pins
• IOREF. The IOREF pin on Galileo allows an attached shield with the
proper configuration to adapt to the voltage provided by the board.
The IOREF pin voltage is controlled by a jumper on the board, i.e., a
election jumper on the board is used to select between 3.3V and 5V
shield operation.
• RESET button/pin: Bring this line LOW to reset the sketch. Typically
used to add a reset button to shields that block he one on the board.
• AREF is unused on Galileo. Providing an external reference voltage for
the analog inputs is not supported.
EFM8 8 bit microcontrollers
• 8051 pipeline architecture
• Flexible Pin Mapping
• Fast Analog / Digital Peripherals
• Three Variants
• Busy Bee (EFM8BB) MCUs provide an optimal balance of no-compromise
performance, power efficiency and value for cost-sensitive applications.
• Sleepy Bee (EFM8SB) MCUs are Silicon Labs’ most energy-friendly 8-bit devices
offering industry-leading sleep mode power (50 nA with full memory retention and
brown-out detection) and ultra-fast 2 µs wake-up time.
• Universal Bee (EFM8UB) MCUs are the industry’s foremost 8-bit USB connectivity
solution, with speeds of up to 48 MHz and 8-64 kB flash sizes.
• The Busy Bee family of EFM8 Microcontrollers (MCUs) includes general
purpose MCUs that operate at up to 50 MHz.
• These MCUs offer high-value by integrating advanced analog and
communication peripherals into small packages, making them ideal for
space constrained applications.
• Features:
• Pipelined 8-bit C8051 core with up to 50 MHz maximum operating frequency
• Up to 22 multifunction, 5 V tolerant I/O pins
• One 12-bit Analog to Digital converter (ADC) with up to 20 channels
• Two low-current analog comparators
• Integrated temperature sensor
• 3-channel enhanced PWM / PCA
• Up to five 16-bit timers
• UART, SPI and SMBus/I²C
• Priority crossbar for flexible pin mapping
• IDE: Simplicity Studio
• Cost: Around 2000/-
• HIGH SPEED 8051 μC CORE
• Pipelined Instruction Architecture; Executes 70% of
• Instruction Set in 1 or 2 System Clocks
• Up to 25 MIPS Throughput with 25 MHz Clock
• 22 Vectored Interrupt Sources
• MEMORY
• 4352 Bytes Internal Data RAM (4k + 256)
• 64k Bytes FLASH; In-System programmable in 512-byte Sectors
• External 64k Byte Data Memory Interface (programmable multiplexed or non-
multiplexed modes)
• ON-CHIP JTAG DEBUG & BOUNDARY SCAN
• On-Chip Debug Circuitry Facilitates Full- Speed, Non- Intrusive In-Circuit/In-
System Debugging
• Provides Breakpoints, Single-Stepping, Watchpoints,
• Stack Monitor; Inspect/Modify Memory and Registers
• Superior Performance to Emulation Systems Using ICEChips
EFM32 Giant Gecko GG11 Starter Kit
• EFM32 Giant Gecko GG11 Microcontroller
• (EFM32GG11B820F2048GL192)
• CPU: 32-bit ARM® Cortex-M4® with FPU
• Memory: 2048 kB flash and 512 kB RAM
• USB connectivity
• SEGGER J-Link on-board debugger
• Silicon Labs Si7021 Relative Humidity and Temperature sensor
• User LEDs / Pushbuttons
• Ultra low power 128x128 pixel color Memory LCD
• Inductive LC sensor
• Silicon Labs Si7210 Hall-Effect Sensor
• Micro-SD Slot
• Ethernet connectivity
• Capacitive Touch Slider
PSOC4

E-SPECS 10/19/2018 124


Psoc 4 (CY8C4248LQI-583 Kit)

✓ 32 bit MCU Subsystem


✓ Capsense with Smart sense
✓ Programmable analog front
end
✓ Programmable digital logic
✓ Bluetooth smart connectivity
with Bluetooth 4.2

E-SPECS 10/19/2018 127


Psoc 4-BLE

E-SPECS 10/19/2018 128


Different Families of Programmable System on Chip (PsoC)

There are five different families of devices, each based around a different
microcontroller core:
● PSoC 1 - CY8C2xxxx series — M8C core.
● PSoC 3 - CY8C3xxxx series - 8051 core.
● PSoC 4 - CY8C4xxxx series - ARM Cortex-M0 core
● PSoC 5/5LP - CY8C5xxxx series - ARM Cortex-M3 core.
● PSoC 6 - CY8C6xxxx series - ARM Cortex-M4 core with an added ARM
Cortex-M0+ core
PSOC 5LP
Development Tools

Two Types
1. PSoC Designer
2. PSoC Creator
PROGRAMMING
STEPS 1: Create new Workspace
STEP 2: Add new project file

Das könnte Ihnen auch gefallen