1 Lab 1: Introduction. 2 Configure ATMEL AVR Starter Kit 500 (STK500), a prototyping/development board for Lab1. ATmega16 (4.5 -5.5 V) is the chip used.

Slides:



Advertisements
Similar presentations
Review: Interrupts & Timers
Advertisements

Lab7: Introduction to Arduino
C Examples 1.
What is Arduino?  Arduino is a ATMEL 168 micro-controller kit designed specially for small projects  User friendly IDE(Integrated Development Environment)
Robotics Club, Snt Council2 The 3 Schools of Robotics: Mechanical Design – Types of motors – Material selection –
LOGSYS Development Environment of Embedded Systems Tamás Raikovich Béla Fehér Péter Laczkó Budapest University of Technology and Economics Department of.
MICRO-CONTROLLER: A microcontroller is the brain of the robot: These are: 1. Integrated Circuits (ICs) 2. Programmable.
Kuliah Mikrokontroler AVR Comparator AVR Eru©September 2009 PENS.
1 Lab2: A/D Converter. 2 This circuit connects a variable voltage to an A/D port on the AVR mcu. Your software running on the AVR mcu will read the digital.
8-Bit Timer/Counter 0 Counter/Timer 0 and 2 (TCNT0, TCNT2) are nearly identical. Differences: -TCNT0 can run off an external 32Khz clock (Tosc) or the.
7-1 Digital Serial Input/Output Two basic approaches  Synchronous shared common clock signal all devices synchronised with the shared clock signal data.
Timers and Interrupts Shivendu Bhushan Summer Camp ‘13.
ECE Department: University of Massachusetts, Amherst Lab 1: Introduction to NIOS II Hardware Development.
An Embedded C Program 1 Mainly from textbook: Embedded C Programming and the Atmel AVR 2 nd Edition Barnett, Cox and O’Cull.
External & internal Interrupts. Interrupt Sources There are 21 different interrupts and each one has its own vector located in a predefined location at.
The 8051 Microcontroller and Embedded Systems
Timers and Interrupts Shivendu Bhushan Sonu Agarwal.
Robotics Research Laboratory Louisiana State University.
Serial Communication ETEC 6416.
AVR  Modern RISC architecture: Compact and FAST.  Tuned for high level languages.  Consistent architecture across entire line.  Small AVR are subsets.
328eForth for Arduino Uno C. H. Ting February 16, 2012 SVFIG.
Embedded Systems Programming 1 ETEE 3285 Topic HW3: Coding, Compiling, Simulating.
Objectives How Microcontroller works
UART and UART Driver B. Ramamurthy.
A Few Words From Dilbert
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).
MICROPROCESSOR INPUT/OUTPUT
Lecture Set 9 MCS-51 Serial Port.
MCU: Interrupts and Timers Ganesh Pitchiah. What’s an MCU ?
Page 1 D&C EBV Seminar June 2003 Motor Demo C868 Chevillot/Jansen June 2003 N e v e r s t o p t h i n k i n g. Infineon C868 Hands On Training CAPCOM6.
Universal Asynchronous Receiver/Transmitter (UART)
5. Serial Communication 충북인력개발원 전자과 공학박사 강원찬.
1 Lab 5: Controls and feedback. 2 Lab 5: Control and Feedback This embedded system uses the Photo sensor to detect the light intensity of the environment.
Example. SBUF Register SCON Register(1) SCON Register(2)
Atmel Atmega128 Overview ALU Particulars RISC Architecture 133, Mostly single cycle instructions 2 Address instructions (opcode, Rs, Rd, offset) 32x8 Register.
Universal Asynchronous Receiver/Transmitter (UART)
ECS642U Embedded Systems Cyclic Execution and Polling William Marsh.
8051 Micro controller. Architecture of 8051 Features of 8051.
A Presentation by: Frank Kuo Nkiruka (Nikky) Chuka-Obah Keith Mayoral 07/28/2006 NESL - Ragobot Wars Click to edit Master title style.
ATtiny23131 A SEMINAR ON AVR MICROCONTROLLER ATtiny2313.
Timers and Interrupts Anurag Dwivedi. Let Us Revise.
Saxion University of Applied Sciences Advanced Microcontrollers A practical approach.
This material exempt per Department of Commerce license exception TSU Architecture Wizard and PACE Lab 2 Introduction.
CSCI1600: Embedded and Real Time Software Lecture 16: Advanced Programming with I/O Steven Reiss, Fall 2015.
TIMERS AND INTERRUPTS AVI SINGH KEVIN JOSE PIYUSH AWASTHI.
충북인력개발원 전자과 공학박사 강원찬 3. Timer & Counter &PWM. uP AVR (Atmega128) PWM1=OC1A(PB5) PWM2=OC1B(PB6) T0=T1(PD6) T1=T2(PD7)
Microcontrollers JULES CALELLA. Microcontrollers vs Microprocessors  Microprocessors – do not contain RAM, ROM, I/O  Microcontrollers – The whole package.
Introduction to AVR Name : 1) Abhishek Yadav ) Prakash Giri ) Kheni Niral ) Bhadresh Langadiya Branch.
NAM S.B MDLAB. Electronic Engineering, Kangwon National University 1.
Atmega328p Introduction for Digital and PWM Output Brion L Fuller II Robotics Club.
Vishwakarma government engineering college Prepare by. Hardik Jolapara( ) LCD Interfacing with ATmega16.
80C51 Block Diagram 1. 80C51 Memory Memory The data width is 8 bits Registers are 8 bits Addresses are 8 bits – i.e. addresses for only 256.
Arduino “Getting Started” Instructor : Dr Matthew Miss Khin Yi Kyaw
DEPARTMENT OF ELECTRONICS ENGINEERING V-SEMESTER MICROPROCESSOR & MICROCONTROLLER 1 CHAPTER NO microcontroller & programming.
1 Lab 4: D/A Converter Lab 4: D/A Converter This is a simple resistive network for a D/A converter Port 1, Port 0 are digital inputs ==> 00 (minimum),
One more PIC18F252 example and revision for exam B222L Branislav Vuksanovic, UoP, ECE.
Microprocessors A practical approach..
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.
Application Case Study Christmas Lights Controller
Introduction of Embedded C and demo programs
Timers and Event Counters
80C51 Block Diagram ECE Overview.
BITS EDU. CAMPUS , VARNAMA
The Arduino Microcontroller: Atmel AVR Atmega 328
Timer/Counter Modified from Dr. Lam Phung’s Slides.
CSCI1600: Embedded and Real Time Software
Introduction to the Atmel AVR Butterfly
Wave Generation and Input Capturing
Presentation transcript:

1 Lab 1: Introduction

2 Configure ATMEL AVR Starter Kit 500 (STK500), a prototyping/development board for Lab1. ATmega16 ( V) is the chip used on your board. Some may have ATmega16L (low voltage 2.7 – 5.5 V). –Lab1 requires One UART port for programming, COM1 One UART port for communication, COM2 Connect a 6-wire cable between Target ISP Header and 6- pin ISP Header. Connect a 10-wire cable between Port and LEDs Become familiar with the C-compiler from CodeVision. –Lab1 requires writing 3 simple C programs to activate LEDs in different patterns. –Lab1 requires writing 1 simple C program to talk to a terminal.

3 AVR STK 500 Components Atmeg16 Atmeg8515

4

5 COM1 To PC COM2 port or other available COM port COM port connections: COM1 for programming your code onto AVR COM2 for communication to display your program output

6 Programming Connecting LEDs and PORTB Connecting Switches to PORTD

7 RS232 connecting to PORTD RXD  PD0 TXD  PD1

8 Lab1: Introduction Pre-lab Assignments –Read Chapter 1 of the textbook: Embedded C Programming and the Atmel AVR by Barnett, Cox, & O’Cull (BCO). –Read STK500 user guide –Complete the Pre-lab Questions on page 1-4.

9 Pre-Lab Questions for Lab 1 When setting up a timer to generate an interrupt every half second, what value must the timer be initialized to (if counting down)? What is the clock frequency of the AVR mcu on the STK500 when shipped? On the average, how many clock cycles are required per instruction? Using your answers from questions 2) and 3) above, how long does a typical instruction take to run on the AVR mcu? Write pseudo c-code to toggle every other light to blink every ¼ of a second. Example: > > >…

10 In-Lab Tasks Program 1 called led.c; almost a duplication of a program in the tutorial “Getting Started with the CodeVision AVR C Compiler.” Program 2 called led2.c; different patterns of LEDs Program 3 called led3.c; different patterns of LEDs and different delay Program 4 called HelloWorld.c; program COM2 to display program output on a terminal

11 CodeVision Wizard

12 CodeVision Wizard Select the chip on your board Select the right frequency

13 CodeVision Wizard Set Port A as Output Port Need to set Ports as input or Output depending on your programs

14 CodeVision Wizard Set USART parameters Baud rate, Data, Stop bit Parity.

15 Set the timer parameters CodeVision Wizard

16 CodeVision Wizard generates C code according to specifications you selected, i.e., I/O Ports, Timer, UART parameters etc.

17 CodeVision Wizard #include // LED's are on PORTB unsigned char ledStatus = 0xFE; // Timer 1 overflow interrupt service routine interrupt [TIM1_OVF] void timer1_ovf_isr(void) { // Reinitialize Timer 1 value TCNT1H=0xF8; TCNT1L=0xFB; // Place your code here... }

18 CodeVision Wizard // Declare your global variables here void main(void) { // Declare your local variables here // Input/Output Ports initialization // Port A initialization // Func0=In Func1=In Func2=In Func3=In Func4=In Func5=In Func6=In Func7=In // State0=T State1=T State2=T State3=T State4=T State5=T State6=T State7=T PORTA=0x00; DDRA=0x00; // Port B initialization // Func0=Out Func1=Out Func2=Out Func3=Out Func4=Out Func5=Out Func6=Out Func7=Out // State0=1 State1=1 State2=1 State3=1 State4=1 State5=1 State6=1 State7=1 PORTB=0xFF; DDRB=0xFF;

19 CodeVision Wizard // Port C initialization // Func0=In Func1=In Func2=In Func3=In Func4=In Func5=In Func6=In Func7=In // State0=T State1=T State2=T State3=T State4=T State5=T State6=T State7=T PORTC=0x00; DDRC=0x00; // Port D initialization // Func0=In Func1=In Func2=In Func3=In Func4=In Func5=In Func6=In Func7=In // State0=T State1=T State2=T State3=T State4=T State5=T State6=T State7=T PORTD=0x00; DDRD=0x00; // Timer/Counter 0 initialization // Clock source: System Clock // Clock value: Timer 0 Stopped TCCR0=0x00; TCNT0=0x00;

20 CodeVision Wizard // Timer/Counter 1 initialization // Clock source: System Clock // Clock value: kHz // Mode: Normal top=FFFFh // OC1A output: Discon. // OC1B output: Discon. // Noise Canceler: Off // Input Capture on Falling Edge TCCR1A=0x00; TCCR1B=0x05; TCNT1H=0xF8; TCNT1L=0xFB; OCR1AH=0x00; OCR1AL=0x00; OCR1BH=0x00; OCR1BL=0x00;

21 CodeVision Wizard // Timer/Counter 2 initialization // Clock source: System Clock // Clock value: Timer 2 Stopped // Mode: Normal top=FFh // OC2 output: Disconnected TCCR2=0x00; ASSR=0x00; TCNT2=0x00; OCR2=0x00; // External Interrupt(s) initialization // INT0: Off // INT1: Off GIMSK=0x00; MCUCR=0x00;

22 CodeVision Wizard // Timer(s)/Counter(s) Interrupt(s) initialization TIMSK=0x04; // Analog Comparator initialization // Analog Comparator: Off // Analog Comparator Input Capture by Timer/Counter 1: Off // Analog Comparator Output: Off ACSR=0x80; // Global enable interrupts #asm("sei") while (1) { // Place your code here }; }

CodeVision Wizard 23 from a student’s Lab1 Report Results and Discussion: 1.Following the “Getting Started” instructions as closely as possible actually worked as advertised and resulted in the AVR flashing the LEDs in order. I was pleased with how straight forward the process was and experimented some with changing the interrupt time and the order of the flashing lights. 2.…

24 Lab 1: Introduction led.c; led2.c; led3.c; –Different delays can be implemented by including delay.h; or you can write your own subroutine. #include // delay_ms(125) HelloWorld.c –Needs I/O functions, the Wizard will add #include into the generated C program after specifying UART parameters. #include // Standard Input/Output functions #include

25 #include // Standard Input/Output functions #include void main(void) { ……………………………. // UART initialization // Communication Parameters: 8 Data, 1 Stop, No Parity // UART Receiver: On // UART Transmitter: On // UART Baud rate: 9600 UCR=0x18; UBRR=0x17; while (1) { // Place your code here delay_ms(500); //Use delay function to generate ½ second interval. printf(“Hello World “); //Output “Hello World”. }; } Part of HelloWorld.c

26 Lab Report Format 1.Cover page (include date due, date turned in) 2.Prelab questions and answers (typed) 3.Summary of the lab tasks 4.In-lab tasks, questions and solutions including software and hardware 5.Results and Discussion 6.Code listing for each task All lab report should be typed and turned in a hard copy on time

27 Check Out Sheet Box Number: Name: Date:

28