Intro to AVR ATtiny2313 CS423 Dick Steflik. AVR ATtiny2313.

Slides:



Advertisements
Similar presentations
Developing an AVR Microcontroller System
Advertisements

SPI Serial Peripheral Interface. SPI Serial Peripheral Interface is communication between two devices, one bit at a time sequential one bit at time over.
Introduction of Holtek HT-46 series MCU
ECE 372 – Microcontroller Design Parallel IO Ports - Interrupts
Serial Peripheral Interface (SPI)
HT46 A/D Type MCU Series Data Memory (Byte) Program Memory HT46R22 (OTP) HT46C22 (Mask) 2Kx Kx16 4Kx HT46R23 (OTP) HT46C23 (Mask) HT46R24.
AVR Programming CS-212 Dick Steflik. ATmega328P I/O for our labs To get data into and out of our Arduino its a little trickier than using printf and.
1 ECE 263 Embedded System Design Lessons 2, 3 68HC12 Hardware Overview, Subsystems, and memory System.
External & internal Interrupts. Interrupt Sources There are 21 different interrupts and each one has its own vector located in a predefined location at.
BLDC MOTOR SPEED CONTROL USING EMBEDDED PROCESSOR
Engineering 1040: Mechanisms & Electric Circuits Fall 2011 Introduction to Embedded Systems.
Programming 8-bit PIC Microcontrollers in C Martin Bates Elsevier 2008.
Serial Peripheral Interface (SPI) Bus. SPI Bus There is no official specification for the SPI bus. It is necessary to consult the data sheets of the devices.
Serial Peripheral Interface Module MTT M SERIAL PERIPHERAL INTERFACE (SPI)
Microprocessor based Design for Biomedical Applications MBE 3 – MDBA II : The ATmega8 Basic Features (1)
AVR  Modern RISC architecture: Compact and FAST.  Tuned for high level languages.  Consistent architecture across entire line.  Small AVR are subsets.
Little arduino microcontrollers Meghan Jimenez 12 February 2014.
AVR Microcontrollers.
Khaled A. Al-Utaibi  Intel Peripheral Controller Chips  Basic Description of the 8255  Pin Configuration of the 8255  Block Diagram.
Arduino Josh Villbrandt February 4, Digital Circuits Analog versus digital – What’s the difference? – How to represent an analog signal in a computer?
Objectives How Microcontroller works
1 AVR Session 2 Master : Dr.jafari Authors: M.H Edrisi, hadi.edrisi yyyy aaaa hhhh oooo oooo.... cccc oooo mmmm.
16F877A. Timer 0 The Timer0 module timer/counter has the following features: –8-bit timer/counter –Readable and writable –8-bit software programmable.
Clock Options and Sleep Modes. Clock Sources Flash Fuse bits can be programmed to choose one of the following Clock sources: 1. External RC Osc. f = 1/(3RC).
Lecture 20: Communications Lecturers: Professor John Devlin Mr Robert Ross.
Embedded System Design Laboratory October 4, 2002Stanford University - EE281 Lecture #3#1 Lecture #3 Outline Announcements AVR Processor Resources –UART.
بسمه تعالي AVR Microcontrollers. The ATmega8 Basic Features -1.
MICROCONTROLLER SYSTEMS Part 1. Figure 1.1Elements of a digital controller CPU Central Processing Unit Input Peripherals Output Peripherals ROM Read Only.
Atmel Atmega128 Overview ALU Particulars RISC Architecture 133, Mostly single cycle instructions 2 Address instructions (opcode, Rs, Rd, offset) 32x8 Register.
ATtiny23131 A SEMINAR ON AVR MICROCONTROLLER ATtiny2313.
Teachers Name : Suman Sarker Telecommunication Technology Subject Name : Microcontroller & Embedded System Subject Code : 6871 Semester : 7th Department.
INTERFACING THE ADS1210 CONVERTER WITH AN ATmega8535 MICROCONTROLLER Author: Eng. Magnelli Luca.
Architecture and instruction set. Microcontroller Core Features:  Operating speed: DC - 20 MHz clock input DC ns instruction cycle Up to 8K x.
智慧電子應用設計導論(1/3) Arduino MEGA 2560
DsPIC30F4011 Fall DIP Switches  The upper four switches of SW1 are used to enable LEDs connected to PORTB/C, PORTA/D, PORTE and PORTF. For example,
Features of the PIC18 microcontroller - 8-bit CPU - 2 MB program memory space (internal 32KB to 128KB) bytes to 1KB of data EEPROM - Up to 4096 bytes.
© 2008, Renesas Technology America, Inc., All Rights Reserved 1 Course Introduction Purpose  This course provides an introduction to the peripheral functions.
EE/CS-352: Embedded Microcontroller Systems Part V The 8051 Assembly Language Interrupts.
Chapter Microcontroller
Components of a typical full-featured microcontroller.
AVR Architecture Prepared By: Avdhesh Soni ( ) Sarthak Patel ( ) Akshay Parekh ( ) Fenil Sachla ( ) Guided.
GROUP MEMBERS: SUMEET HOODA. RAJDEEP PATRE. DHIRAJ GAONKAR. LIVE HUMAN DETECTION USING WIRELESS REMOTE CONTROLLED ROBOT.
NAM S.B MDLAB. Electronic Engineering, Kangwon National University 1.
Criteria for choosing a microcontroller A microcontroller must meet the task at hand efficiency and cost effectively. Speed. What is highest speed of.
1. PIC ADC  PIC18F877 has 8 analog input channels i.e. port A pins(RA0 to RA5) and port E pins(RE1 and RE2). These pins are used as Analog input pins.
MICROCONTROLLER AND INTERFACING Presented by: Shefali Jethva ( ) Shivali Panchal ( ) Komal Soni ( ) Roll no. :- 14EC308.
INTERFACING HARDWARE WITH MICROCONTROLLER GUIDED BY: Prof. ASIF SIR 1. AKSHAY KIRAN 2. DEEP PARIKH 3. JIGAR PATEL 4. TILAK PATEL ,05,D2D06,09.
Overview AvrEmbedded128_Pro RTLab. 김태현. Atmega128 Features High-performance, Low-power AVR® 8-bit Microcontroller advanced RISC Architecture – 133 Powerful.
USING TV REMOTE AS A CORDLESS MOUSE FOR THE COMPUTER
CORDLESS MOUSE FEATURES BY TV REMOTE USING PIC MICROCONTROLLER
Embedded Systems Programming
C. K. Pithawalla College of Engineering and Technology, Surat
AVR ATMEGA 8 MICRO-CONTROLLER
68HC11 Interrupts & Resets.
EE 107 Fall 2017 Lecture 5 Serial Buses – UART & SPI
BITS EDU. CAMPUS , VARNAMA
Table 2. Microcontroller pin description[5]
BVM Engineering College Electrical Engineering Department : Microprocessor and Microcontroller Interfacing Interrupts of 8051 Prepared by:
Interrupt Source: under
Programming Microcontroller
Atmega32 Serial Programming Basics
The Arduino Microcontroller: Atmel AVR Atmega 328
EEPROM Comparison – Parallel or Serial
Introduction to Microprocessors and Microcontrollers
Architectural Overview
Lecturer: Reza Arjmandi Autumn 2015
AVR – ATmega103(ATMEL) Architecture & Summary
8051 Micro Controller.
Interrupt Chapter 10.
Introduction to Arduino
Presentation transcript:

Intro to AVR ATtiny2313 CS423 Dick Steflik

AVR ATtiny2313

2313 Features RISC, 120 instructions, most executable in one clock cycle, 32x8 general purpose registers, up to 20 MIPS at 20 Mhz Memory - 2Kbytes Flash, 128 Bytes EEPROM, 128 bytes SRAM Peripherals Features – 1-8bit timer, bit timer, 4- PWM channels, On-chip analog comparitor, watchdog timer, Universal Serial Interface, Full Duplex USART 18 programmable I/O lines Operating Voltage – 2.7 – 5.5VDC In System Programmable via SPI (Serial Peripheral Interface)‏

Basic Pin Descriptions VCC – Digital Supply Voltage Gnd – ground Port A (PA2..PA0) – 3 bit, bi-directional I/O with selectable internal pullups Port B (PB7..PB0) – 8 bit, bi-directional I/O with selectable internal pullups Port D (PD6-PD0) - 7 bit, bi-directional I/O with selectable internal pullups Reset – system reset – active low XTAL1 – external crystal input (alt. PA0)‏ XTAL2 – external crystal output (alt. PA1)‏

Serial Peripheral Interface Bus SPI is used by all Atmel microcontrollers for loading the flash program memory (many other OEMs also)‏ Easily implemented in hardware Faster than other methods (I2C, SMBUS)‏ Master-slave methodology Half or Full Duplex operation

SPI with 2 slaves SPI MasterSPI Slave 1 SCLK MISO MOSI SS1 SCLK MOSI MISO SS SPI Slave 2 SCLK MOSI MISO SS SS2

AVR Programming AVR ProgrammerATtiny2313 SCLK MISO MOSI SCLK (19)‏ MOSI (17)‏ MISO (18)‏ PC PPT RS232 USB AVRDUDE RESET (1)‏ GND GND (10)‏ GND VCC (20)‏ VCC

API Applications Flash, EEPROM, MMC and SD cards Sensors  Temperature  Pressure (touch screens)‏ LCD Panels Communications ( (ZigBee), CAN, Ethernet....)‏ Control – D/A, A/D, Digital Pots, position encoders

/* Blinker Demo */ /* Include useful pre-defined functions */ #include // Defines pins, ports, etc to make programs easier to read #define F_CPU UL // Sets up the default speed for delay.h #include int main(){ DDRD = _BV(PD4); /* enable output on port D, pin 4 */ while(1){ PORTD = _BV(PD4); _delay_ms(1000); PORTD &= ~_BV(PD4); _delay_ms(1000); } return(0); }

Interrupts 10x0000ResetExternal Pin, POR, BOR,Watchdog Reset 20x0001INT0External Interrupt Request 0 30x0002INT1External Interrupt Request 1 40x0003TIMER1 CAPTTimer/Counter1 Capture Event 50x0004TIMER1 COMPATimer/Counter1 Compare Match A 60x0005TIMER1 OVFTimer/Counter1 Overflow 70x0006TIMER0 OVFTimer/Counter0 Overflow 80x0007USART0,RXUSART0 Receive complete 90x0008USART0 UDREUSART0 Data Register Empty 100x0009USART0 RXUSART0 Transmit Complete 110x000AANALOG COMPAnalog Comparitor 120x000BPCINTPin Change Interrupt 130x000CTIMER1 COMPBTimer/Counter1 Compare Match B 140x000DTIMER0 COMPATimer/Counter0 Compare Match A 150x000ETIMER0 COMPBTimer/Counter0 Compare Match B 160x000FUSI STARTUSI Start Condition 170x0010USI OVERFLOWUSI Overflow 180x0011EE READYEEPROM Ready 190x0012WDT OVERFLOWWatchdog Timer Overflow

ISR Macro #include Defines the beginning of your Interrupt Servicing Routine  Places the starting address of the ISR code into the interrupt vector ISR(SIG_INT0)‏ { cli(); //disable interrupts. sei(); // enable interrupts } places address of the body if the ISR into 0x0001

Programmable Interrupts INT0 - Pin 6 INT1 – Pin 7 PCINT – Pins PCMSK – Pin Change Mask Register  Which pins contribute to the pin change interrupt 4 different pin changes can be detected  Pin goes low  Any logical change  Falling edge  Rising edge

Interrupt Sense Control Interrupt 1 Sense Control ISC11ISC10Description 0 0Low level on INT1 0 1Any logical change on INT1 1 0Falling edge on INT1 1 1Rising Edge on INT1 Interrupt 0 Sense Control ISC01ISC00Description 0 0Low level on INT0 0 1Any logical change on INT0 1 0Falling edge on INT0 1 1Rising Edge on INT0

MCU Control Register Defines which of the four states will activate the interrupt ex. MCUCR = (1<<ISC01) | (1<<ISC00)‏ Interrupt on pin INT0 falling edge

Example #include int main(void)‏ { // set Pin 6 (PD02) as the interrupt pin PCMSK |= (1<<PIND2); // interrupt on INT0 falling edge MCUCR = (1<<ISC01) | (1 << ISC00); // turn on interrupts GIMSK |= (1<<INT0); // wait for interrupt while (1) {... };