IAS0430 MICROPROCESSOR SYSTEMS

Size: px
Start display at page:

Download "IAS0430 MICROPROCESSOR SYSTEMS"

Transcription

1 IAS0430 MICROPROCESSOR SYSTEMS Fall 2018 Arduino and assembly language Martin Jaanus U , Learning environment : Materials :

2 Topics The digital electronics in analogue world. Write assembly code to initialize an AVR ATmega 328P and run code on it. Understand how it works line by line. Trying this in using the Arduino environment. Upload the code to Arduino Uno

3 Homeworks (can be done also in LAB) The aim is to demonstrate basic skills of programming in assemby language You need to prepare your code and demonstrate its working ability to teacher (teacher may ask you to make some modifications ) Before defending you need to upload your code in learning environment using pdf format. You can book a Arduino board with multi-functional shield (like Homelabkit) but you can use your own board and extensions (even with different microprocessor) From the number of completed tasks depends your grade. 30 sets avaiable for booking

4 Homeworks 5 tasks with different difficulty 1. Demonstrate usage of hardware output of MCU (ex. Write some led blinnking program) 500 points 2. Demonsrate usage of hardware input of MCU (ex. You press buttons and something happen) 500 points 3. Demonstrate writing text to LCD/LED screen or serial output of MCU 600 points 4. Demonstrate usage of MCU s analogue input points 5. Demonstrate usage of MCU s timer(s) and/or interrupt(s) points All tasks (or at least the major part of code ) must be written in assembler!

5 The assembly example of led blinker Example Atmega328 (Arduino) Three universal ports Arduino development environment Needs skill of using datasheet! Here and next AVR pictures :

6 Open Datasheet Prepare a solution You must read the datasheet! Find the Register Summary and you ll find all the records and object of our studies. Here you find the three main registers of atmel avr i/o ports: PORTx, DDRx and PINx

7 Open Datasheet Prepare a solution Here s a drawing of their basic functionality: as you can see, there s an internal pull-up for every pin. It can be activated by setting the DDR bit of the pin to 0 and the Port bit to 1. A cleared DDR bit means that the pin is an input pin. So the pin is disconnected from the Port register (see the driver in the drawing?) and the pin is floating. In this case the Port bit controls the pull-up. We highlight the configuration we will take in our project: we put the DDRx to 1 and we will switch PORTx between the high and low states to blink the LED. For writing code only some instructions can be used.

8 Install and run Arduino environment Install Arduino environment and makse sure it is connected and working! (check the connection)! You can also test the LED blinking sketch from examples!

9 Using Assembly code in C projects One possibility is to do like this: void somefunction(void) attribute ((naked)) { asm volatile (" ; your assembly code here } "); It is often used when the main program is written in C but it is needed to use ASM operations (usually for percise timing you cannot calculate processor cycles in C),

10 Full Assembly in Arduino Environment 1. Make empty project/sketch File > New, name as you want. 2. Modify the default code in in this way: extern "C" { // function prototypes void start(); ; } The name of exetutable routine void setup() { start(); } void loop() { }

11 Full Assembly in Arduino Environment (2) Add your assembly project file: 1.Click the upside down triangle button at the top right of the editor window. 2.New Tab > Name for new file: > blink.s - actually you can give it any name you like as long as it has the.s extension. It has to be an upper case S.

12 Full Assembly in Arduino Environment (3) You need to include definitions and set program start offset: #define SFR_OFFSET 0 #include "avr/io.h".global start This must be same in main.ino file start: ; the assembly code to execute sbi... DDRB,5 ; Set PB5 as output

13 #include "avr/io.h" Gives the names for registers It gives possibility to use predefined names You need to use definations written in datasheet! The assember does not accept Arduino definations!

14 Init your code Starting address The simpest possible program:.org 0x000 ; the next instruction has to be written to add 0x0000 ; this is required, when native ASM compiler is used ; infinite loop START: ; this is a label START rjmp START ; Relative JuMP to START The compiler translates labels into addresses respect to starting address When the instruction is executed, the CPU (ALU Arithmetic Logic Unit) will jump to START. The jump will be repeated over and over, resulting in an infinite loop.

15 Do the math Assuming that our Arduino AVR is running at 16 MHz (16 Million clock cycles per second), how long does all this take? T = 1/ F then T = 1 / 16E6 T = 0, seconds, not precisely 0,06 us That s pretty fast! We can not see at this frequency the blinking of the LED. So coming to the answer it has been observed experimentally that human eye can t make out a difference in the picture frame if it appears for less than 16ms to 13ms (0,016-0,013s).

16 Do the math (2) That s pretty fast! We can not see at this frequency the blinking of the LED. So coming to the answer it has been observed experimentally that human eye can t make out a difference in the picture frame if it appears for less than 16ms to 13ms (0,016-0,013s). Hence purely based on this we can say sampling frequency is 60 Hz to 80 Hz (about 0,06 & 0,08 MHz). So we will need to know how many times we will loop to in terms of a cycle of say half a second off and half a second on so that the LED flashes every half a second at a frequency of 16 MHz we need x cycles. Here s how: if 1 cycle takes , seconds x cycles will take ,5 seconds this makes 0,5 / 0, s = cycles How to achieve all this cycles if I can count only up to 255 (remember, we have an 8-bit chip )?

17 Do the math (3) For this we will have to implement two loops: inner and outloop. Calculations - The inner loop is treated like one BIG instruction needing clock cycles. The registers can be used in pairs, allowing to work with values from 0 to That s a word. The following piece of code clears registers 24 and 25 and increments them in a loop until they overflow to zero again. When that condition occurs, the loop doesn t go around again.

18 Math to asm clr r24 clr r25 ; clr needs 1 cycle ; clr needs 1 cycle DELAY_05: ; we need.5s delay adiw r24, 1 ; adiw needs 2 cycles and brne DELAY_05 ; brne needs 2 cycles if the branch is done ; and 1 otherwise Every time the registers don t overflow the loop takes adiw(2) + brne(2) = 4 cycles. This is done 0xFFFF (65 535) times before the overflow occurs. The next time the loop only needs 3 cycles, because no branch is done.

19 Math to asm The outer loop will be down-counting from 31 to zero using R16. ldi r16, 31 OUTER_LOOP: ; outer loop label ldi r24, 0 ; clear register 24 ldi r25, 0 ; clear register 25 DELAY_05: ; the loop label adiw r24, 1 ; add immediate to word : r24:r25 are ; incremented brne DELAY_05 dec r16 ; decrement r16 brne OUTER_LOOP ; load r16 with 8

20 Math to asm The overall loop needs: (inner loop) + 1 (dec) + 2 (brne) = * 31 = cycles. This is more like what we want, but cycles too long. This is where the fine-tuning comes in we need to change the initial value of r24:r25. The outer loop is executed 31 times and includes the big-inner-loopinstruction. We have to subtract some cycles from the inner loop: / 31 = cycles per inner loop. This is what the inner loop has to be shorter. Every iteration of the inner loop takes 4 cycles (the last one takes 3 but that s not so important, if needed NOP can be added), so let s divide those by 4. That s or less iterations. This is our new initial value for r24:r25 he result is clock cycles

21 Main code.org 0x0000 ; the next instruction has to be written to DELAY_05: ; the subroutine: ; address 0x0000 ldi r16, 31 ; load r16 with 31 rjmp START ; the reset vector: jump to "main" OUTER_LOOP: ; outer loop label START: out SPH, r16 ldi r16, 0xFF ; load register 16 with 0xFF (all bits 1) out DDRB, r16 Data ; write the value in r16 (0xFF) to ; Direction Register B LOOP: sbi PortB, 5 ; switch off the LED rcall DELAY_05 ; wait for half a second cbi PortB, 5 ; switch it on rcall DELAY_05 ; wait for half a secon rjmp LOOP ; jump to loop ldi r24, 0 ldi r25, 0 DELAY_LOOP: ; "add immediate to word": r24:r25 are ; incremented adiw r24, 1 ; if no overflow ("branch if not equal"), go ; back to "delay_loop" brne DELAY_LOOP dec r16 ; decrement r16 brne OUTER_LOOP ; and loop if outer loop not finished ret ; return from subroutine Arduino example (for comparision): void setup() { // initialize digital pin 13 as an output. pinmode(13, OUTPUT); } void loop() { digitalwrite(13, HIGH); // turn the LED on (HIGH is the voltage level) delay(1000); // wait for a second digitalwrite(13, LOW); // turn the LED off by making the voltage LOW delay(1000); // wait for a second } Delay function from library Remember if you using another Arduino board with different processor, this Assembly code may not work, C code may work! Refer to datasheet!!!!!

22 Send code to Arduino Uno And save those for future reference/ codes! The next task (code) can be written by using this template

23 Arduino Uno schematics

24 Arduino Uno pinouts The yellow background shows the processor s pin name

25 Arduino Multifuncional Shield The complete circuit

26 Arduino Multifuncional Shield LED Notice that they are connected between Vcc and I/O pins! Active state is LOW, Arduino pins are 10,11,12,13 Buzzer is connected to pin 3

27 Arduino Multifuncional Shield Buttons External pullup resistors Connected to Arduino pins A1,A2,A3 Pressed state is LOW Analogue input is connected to pin A0

28 Arduino Multifuncional Shield 7 segment LED array 2 of 74HC595 Shift registres are used as driver! It has 3 pins to connect Arduino RCLK 4 (output clock) SRCLK- 7 (input clock) SER 8 (data) You need to refer to datasheet!

EE 308: Microcontrollers

EE 308: Microcontrollers EE 308: Microcontrollers Review Part I Aly El-Osery Electrical Engineering Department New Mexico Institute of Mining and Technology Socorro, New Mexico, USA February 15, 2018 Aly El-Osery (NMT) EE 308:

More information

AVR ISA & AVR Programming (I) Lecturer: Sri Parameswaran Notes by: Annie Guo

AVR ISA & AVR Programming (I) Lecturer: Sri Parameswaran Notes by: Annie Guo AVR ISA & AVR Programming (I) Lecturer: Sri Parameswaran Notes by: Annie Guo 1 Lecture Overview AVR ISA AVR Instructions & Programming (I) Basic construct implementation 2 Atmel AVR 8-bit RISC architecture

More information

Introduction to Assembly language

Introduction to Assembly language Introduction to Assembly language 1 USING THE AVR MICROPROCESSOR Outline Introduction to Assembly Code The AVR Microprocessor Binary/Hex Numbers Breaking down an example microprocessor program AVR instructions

More information

AVR ISA & AVR Programming (I) Lecturer: Sri Parameswaran Notes by: Annie Guo

AVR ISA & AVR Programming (I) Lecturer: Sri Parameswaran Notes by: Annie Guo AVR ISA & AVR Programming (I) Lecturer: Sri Parameswaran Notes by: Annie Guo 1 Lecture Overview AVR ISA AVR Instructions & Programming (I) Basic construct implementation 2 Atmel AVR 8-bit RISC architecture

More information

Buses and Parallel Input/Output

Buses and Parallel Input/Output Buses and Parallel Input/Output Lecturer: Sri Parameswaran Notes by: Annie Guo Week7 1 Lecture Overview Buses Computer buses I/O Addressing Memory mapped I/O Separate I/O Parallel input/output AVR examples

More information

Module 2: Introduction to AVR ATmega 32 Architecture

Module 2: Introduction to AVR ATmega 32 Architecture Module 2: Introduction to AVR ATmega 32 Architecture Definition of computer architecture processor operation CISC vs RISC von Neumann vs Harvard architecture AVR introduction AVR architecture Architecture

More information

AVR ISA & AVR Programming (I)

AVR ISA & AVR Programming (I) AVR ISA & AVR Programming (I) Lecturer: Sri Parameswaran Notes by: Annie Guo Week 1 1 Lecture Overview AVR ISA AVR Instructions & Programming (I) Basic construct implementation Week 1 2 1 Atmel AVR 8-bit

More information

Programming Microcontroller Assembly and C

Programming Microcontroller Assembly and C Programming Microcontroller Assembly and C Course Number CLO : 2 Week : 5-7 : TTH2D3 CLO#2 Student have the knowledge to create basic programming for microcontroller [C3] Understand how to program in Assembly

More information

Module 8: Atmega32 Stack & Subroutine. Stack Pointer Subroutine Call function

Module 8: Atmega32 Stack & Subroutine. Stack Pointer Subroutine Call function Module 8: Atmega32 Stack & Subroutine Stack Pointer Subroutine Call function Stack Stack o Stack is a section of RAM used by the CPU to store information temporarily (i.e. data or address). o The CPU needs

More information

CMPE C Programming & Embedded Systems. Discussion I (Version 2.0) August 31, 2014

CMPE C Programming & Embedded Systems. Discussion I (Version 2.0) August 31, 2014 CMPE 311 - C Programming & Embedded Systems Discussion I (Version 2.0) August 31, 2014 Version History Version 2.1 - (August 31, 2015) - Addition Pin Connections Section and Document Verification. Version

More information

COMP2121: Microprocessors and Interfacing. I/O Devices (I)

COMP2121: Microprocessors and Interfacing. I/O Devices (I) COMP2121: Microprocessors and Interfacing I/O Devices (I) http://www.cse.unsw.edu.au/~cs2121 Lecturer: Hui Wu Session 2, 2017 1 Overview I/O Ports AVR Ports 2 2 What is I/O? I/O is Input or Output (Input/Output).

More information

Register-Level Programming

Register-Level Programming Introduction Register-Level Programming Programming can be considered a set a instructions that are executed in a precise order. A programming simulator can evaluate how instructions store, move and calculate

More information

Laboratory 1 Introduction to the Arduino boards

Laboratory 1 Introduction to the Arduino boards Laboratory 1 Introduction to the Arduino boards The set of Arduino development tools include µc (microcontroller) boards, accessories (peripheral modules, components etc.) and open source software tools

More information

Review on Lecture-1. ICT 6641: Advanced Embedded System. Lecture 2 Branch, Call and Delay Loops, AVR I/O port programming

Review on Lecture-1. ICT 6641: Advanced Embedded System. Lecture 2 Branch, Call and Delay Loops, AVR I/O port programming ICT 6641: Advanced Embedded System Lecture 2 Branch, Call and Delay Loops, AVR I/O port programming Prof. S. M. Lutful Kabir Session: April, 2011 Review on Lecture-1 Three parts of a computer : CPU, Memory

More information

ET-BASE AVR ATmega64/128

ET-BASE AVR ATmega64/128 ET-BASE AVR ATmega64/128 ET-BASE AVR ATmega64/128 which is a Board Microcontroller AVR family from ATMEL uses MCU No.ATmega64 and ATmega128 64PIN. Board ET-BASE AVR ATmega64/128 uses MCU s resources on

More information

AT90S Bit Microcontroller with 1K bytes Downloadable Flash AT90S1200. Features. Description. Pin Configuration

AT90S Bit Microcontroller with 1K bytes Downloadable Flash AT90S1200. Features. Description. Pin Configuration Features Utilizes the AVR Enhanced RISC Architecture 89 Powerful Instructions - Most Single Clock Cycle Execution 1K bytes of In-System Reprogrammable Downloadable Flash - SPI Serial Interface for Program

More information

Lab 2: Basic Assembly Programming and Debugging using AVR Studio. Due: December 13, 2011

Lab 2: Basic Assembly Programming and Debugging using AVR Studio. Due: December 13, 2011 Lab 2: Basic Assembly Programming and Debugging using AVR Studio 1 Outcomes Due: December 13, 2011 Familiarize yourself with the capabilities of the ATMEGA32 embedded microcontroller and AVR Studio Develop

More information

keyestudio Keyestudio MEGA 2560 R3 Board

keyestudio Keyestudio MEGA 2560 R3 Board Keyestudio MEGA 2560 R3 Board Introduction: Keyestudio Mega 2560 R3 is a microcontroller board based on the ATMEGA2560-16AU, fully compatible with ARDUINO MEGA 2560 REV3. It has 54 digital input/output

More information

Objectives. I/O Ports in AVR. Topics. ATmega16/mega32 pinout. AVR pin out The structure of I/O pins I/O programming Bit manipulating 22/09/2017

Objectives. I/O Ports in AVR. Topics. ATmega16/mega32 pinout. AVR pin out The structure of I/O pins I/O programming Bit manipulating 22/09/2017 Objectives The AVR microcontroller and embedded systems using assembly and c I/O Ports in AVR List all the ports of the AVR microcontroller Describe the dual role of the AVR pins Code assembly language

More information

Embedded Systems and Software

Embedded Systems and Software Embedded Systems and Software Timers and Counters F-35 Lightning II Electro-optical Targeting System (EOTS Lecture 1, Slide-1 Timers and Counters Very important peripherals on microcontrollers ATtiny45

More information

Goal: We want to build an autonomous vehicle (robot)

Goal: We want to build an autonomous vehicle (robot) Goal: We want to build an autonomous vehicle (robot) This means it will have to think for itself, its going to need a brain Our robot s brain will be a tiny computer called a microcontroller Specifically

More information

APPENDIX D FLOWCHARTS AND PSEUDOCODE OVERVIEW

APPENDIX D FLOWCHARTS AND PSEUDOCODE OVERVIEW APPENDIX D FLOWCHARTS AND PSEUDOCODE OVERVIEW This appendix provides an introduction to writing flowcharts and pseudocode. 689 Flowcharts If you have taken any previous programming courses, you are probably

More information

Specification. 1.Power Supply direct from Microcontroller Board. 2.The circuit can be used with Microcontroller Board such as Arduino UNO R3.

Specification. 1.Power Supply direct from Microcontroller Board. 2.The circuit can be used with Microcontroller Board such as Arduino UNO R3. Part Number : Product Name : FK-FA1410 12-LED AND 3-BOTTON SHIELD This is the experimental board for receiving and transmitting data from the port of microcontroller. The function of FK-FA1401 is fundamental

More information

Embedded Systems and Software. LCD Displays

Embedded Systems and Software. LCD Displays Embedded Systems and Software LCD Displays Slide 1 Some Hardware Considerations Assume we want to drive an LED from a port. The AVRs can either source or sink current. Below is a configuration for sourcing.

More information

ECE 353 Lab 4. General MIDI Explorer. Professor Daniel Holcomb Fall 2015

ECE 353 Lab 4. General MIDI Explorer. Professor Daniel Holcomb Fall 2015 ECE 353 Lab 4 General MIDI Explorer Professor Daniel Holcomb Fall 2015 Where are we in Course Lab 0 Cache Simulator in C C programming, data structures Cache architecture and analysis Lab 1 Heat Flow Modeling

More information

An FTDI connection: The ATtiny microcontrollers don t have a hardware UART External Crystal header pins for an optional crystal

An FTDI connection: The ATtiny microcontrollers don t have a hardware UART External Crystal header pins for an optional crystal Getting Started with the T-Board The T-Board modules were designed to speed up your AVR prototyping. This guide will show you just how quickly you can get up and running with the Hello World for microcontrollers

More information

Note. The above image and many others are courtesy of - this is a wonderful resource for designing circuits.

Note. The above image and many others are courtesy of   - this is a wonderful resource for designing circuits. Robotics and Electronics Unit 2. Arduino Objectives. Students will understand the basic characteristics of an Arduino Uno microcontroller. understand the basic structure of an Arduino program. know how

More information

Embedded Systems and Software

Embedded Systems and Software Embedded Systems and Software Lecture 12 Some Hardware Considerations Hardware Considerations Slide 1 Logic States Digital signals may be in one of three states State 1: High, or 1. Using positive logic

More information

8-bit Microcontroller with 2K Bytes of In-System Programmable Flash AT90S2323 AT90LS2323 AT90S2343 AT90S/LS2323. Features.

8-bit Microcontroller with 2K Bytes of In-System Programmable Flash AT90S2323 AT90LS2323 AT90S2343 AT90S/LS2323. Features. Features Utilizes the AVR RISC Architecture AVR - High-performance and Low-power RISC Architecture 118 Powerful Instructions - Most Single Clock Cycle Execution 32 x 8 General Purpose Working Registers

More information

8-Bit Microcontroller with 1K bytes In-System Programmable Flash AT90S1200. Features. Description. Pin Configuration

8-Bit Microcontroller with 1K bytes In-System Programmable Flash AT90S1200. Features. Description. Pin Configuration Features AVR - High Performance and Low Power RISC Architecture 89 Powerful Instructions - Most Single Clock Cycle Execution 1K bytes of In-System Reprogrammable Flash SPI Serial Interface for Program

More information

Procedure: Determine the polarity of the LED. Use the following image to help:

Procedure: Determine the polarity of the LED. Use the following image to help: Section 2: Lab Activity Section 2.1 Getting started: LED Blink Purpose: To understand how to upload a program to the Arduino and to understand the function of each line of code in a simple program. This

More information

COMP2121 Experiment 4

COMP2121 Experiment 4 COMP2121 Experiment 4 1. Objectives In this lab, you will learn AVR programming on Parallel input/output; Some typical input/output devices; and Interrupts 2. Preparation Before coming to the laboratory,

More information

Introduction to Arduino. Wilson Wingston Sharon

Introduction to Arduino. Wilson Wingston Sharon Introduction to Arduino Wilson Wingston Sharon cto@workshopindia.com Physical computing Developing solutions that implement a software to interact with elements in the physical universe. 1. Sensors convert

More information

Freeduino USB 1.0. Arduino Compatible Development Board Starter Guide. 1. Overview

Freeduino USB 1.0. Arduino Compatible Development Board Starter Guide. 1. Overview Freeduino USB 1.0 Arduino Compatible Development Board Starter Guide 1. Overview 1 Arduino is an open source embedded development platform consisting of a simple development board based on Atmel s AVR

More information

AVR Subroutine Basics

AVR Subroutine Basics 1 P a g e AVR Subroutine Basics READING The AVR Microcontroller and Embedded Systems using Assembly and C) by Muhammad Ali Mazidi, Sarmad Naimi, and Sepehr Naimi Chapter 3: Branch, Call, and Time Delay

More information

AGH University of Science and Technology Cracow Department of Electronics

AGH University of Science and Technology Cracow Department of Electronics AGH University of Science and Technology Cracow Department of Electronics Microprocessors laboratory Tutorial A Using Arduino UNO for laboratory tutorials Author: Paweł Russek http://www.fpga.agh.edu.pl/upt

More information

ATmega Interrupts. Reading. The AVR Microcontroller and Embedded Systems using Assembly and C) by Muhammad Ali Mazidi, Sarmad Naimi, and Sepehr Naimi

ATmega Interrupts. Reading. The AVR Microcontroller and Embedded Systems using Assembly and C) by Muhammad Ali Mazidi, Sarmad Naimi, and Sepehr Naimi 1 P a g e ATmega Interrupts Reading The AVR Microcontroller and Embedded Systems using Assembly and C) by Muhammad Ali Mazidi, Sarmad Naimi, and Sepehr Naimi Chapter 10: AVR Interrupt Programming in Assembly

More information

By the end of Class. Outline. Homework 5. C8051F020 Block Diagram (pg 18) Pseudo-code for Lab 1-2 due as part of prelab

By the end of Class. Outline. Homework 5. C8051F020 Block Diagram (pg 18) Pseudo-code for Lab 1-2 due as part of prelab By the end of Class Pseudo-code for Lab 1-2 due as part of prelab Homework #5 on website due before next class Outline Introduce Lab 1-2 Counting Timers on C8051 Interrupts Laboratory Worksheet #05 Copy

More information

Embedded programming, AVR intro

Embedded programming, AVR intro Applied mechatronics, Lab project Embedded programming, AVR intro Sven Gestegård Robertz Department of Computer Science, Lund University 2017 Outline 1 Low-level programming Bitwise operators Masking and

More information

8-bit Microcontroller with 1K Byte of In-System Programmable Flash AT90S1200

8-bit Microcontroller with 1K Byte of In-System Programmable Flash AT90S1200 Features Utilizes the AVR RISC Architecture AVR High-performance and Low-power RISC Architecture 89 Powerful Instructions Most Single Clock Cycle Execution 32 x 8 General-purpose Working Registers Up to

More information

By: Dr. Hamed Saghaei

By: Dr. Hamed Saghaei By: Dr. Hamed Saghaei The AVR RISC Microcontroller supports powerful and efficient addressing modes for access to the program memory (Flash) and data memory (SRAM). This section describes the different

More information

Introduction to Embedded Systems

Introduction to Embedded Systems Stefan Kowalewski, 4. November 25 Introduction to Embedded Systems Part 2: Microcontrollers. Basics 2. Structure/elements 3. Digital I/O 4. Interrupts 5. Timers/Counters Introduction to Embedded Systems

More information

Tang. A Programming Language for Arduino. Group: sw402f17. Supervisor: Lone Leth Thomsen

Tang. A Programming Language for Arduino. Group: sw402f17. Supervisor: Lone Leth Thomsen Tang A Programming Language for Arduino Group: sw402f17 Supervisor: Lone Leth Thomsen May 28, 2017 Department of Computer Science Aalborg University http://cs.aau.dk Title: Tang Theme: A Programming Language

More information

8-bit Microcontroller with 2K Bytes of In-System Programmable Flash. ATtiny22 ATtiny22L. Preliminary. Features. Description

8-bit Microcontroller with 2K Bytes of In-System Programmable Flash. ATtiny22 ATtiny22L. Preliminary. Features. Description Features Utilizes the AVR RISC Architecture AVR - High-performance and Low-power RISC Architecture 118 Powerful Instructions - Most Single Clock Cycle Execution 32 x 8 General Purpose Working Registers

More information

Arduino Uno. Arduino Uno R3 Front. Arduino Uno R2 Front

Arduino Uno. Arduino Uno R3 Front. Arduino Uno R2 Front Arduino Uno Arduino Uno R3 Front Arduino Uno R2 Front Arduino Uno SMD Arduino Uno R3 Back Arduino Uno Front Arduino Uno Back Overview The Arduino Uno is a microcontroller board based on the ATmega328 (datasheet).

More information

EE 308: Microcontrollers

EE 308: Microcontrollers EE 308: Microcontrollers Timers Aly El-Osery Electrical Engineering Department New Mexico Institute of Mining and Technology Socorro, New Mexico, USA April 2, 2018 Aly El-Osery (NMT) EE 308: Microcontrollers

More information

Embedded Systems and Software

Embedded Systems and Software Embedded Systems and Software Potpourri & Notes on Lab 2 Artist's concept of Mars Exploration Rover. Courtesy NASA Lab 2 Notes Slide 1 The AVR Assembler We use the AVRASM2 assembler that comes with AVR

More information

Atmel Microprocessor Programming With AVRISPmkii

Atmel Microprocessor Programming With AVRISPmkii Atmel Microprocessor Programming With AVRISPmkii Purpose EE 400D - Senior Design Part of Electronics & Control Division Technical Training Series by Nicholas Lombardo October 13, 2015 The purpose of this

More information

Building your own special-purpose embedded system gadget.

Building your own special-purpose embedded system gadget. Bare-duino Building your own special-purpose embedded system gadget. Saves a little money. You can configure the hardware exactly the way that you want. Plus, it s fun! bare-duino 1 Arduino Uno reset I/O

More information

CN310 Microprocessor Systems Design

CN310 Microprocessor Systems Design CN310 Microprocessor Systems Design Instruction Set (AVR) Nawin Somyat Department of Electrical and Computer Engineering Thammasat University Outline Course Contents 1 Introduction 2 Simple Computer 3

More information

3. The circuit is composed of 1 set of Relay circuit.

3. The circuit is composed of 1 set of Relay circuit. Part Number : Product Name : FK-FA1420 ONE CHANNEL 12V RELAY MODULE This is the experimental module for a relay controller as the fundamental controlling programming. It is adaptable or is able to upgrade

More information

Microprocessors & Interfacing

Microprocessors & Interfacing Lecture Overview Microprocessors & Interfacing Interrupts (I) Lecturer : Dr. Annie Guo Introduction to Interrupts Interrupt system specifications Multiple sources of interrupts Interrupt priorities Interrupts

More information

1 Introduction to Computers and Computer Terminology Programs Memory Processor Data Sheet... 4

1 Introduction to Computers and Computer Terminology Programs Memory Processor Data Sheet... 4 Overview of the PIC 16F648A Processor: Part 1 EE 361L Lab 2.1 Last update: August 1, 2016 Abstract: This report is the first of a three part series that discusses the features of the PIC 16F648A processor,

More information

Laboratory 3 Working with the LCD shield and the interrupt system

Laboratory 3 Working with the LCD shield and the interrupt system Laboratory 3 Working with the LCD shield and the interrupt system 1. Working with the LCD shield The shields are PCBs (Printed Circuit Boards) that can be placed over the Arduino boards, extending their

More information

Robosoft Systems in association with JNCE presents. Swarm Robotics

Robosoft Systems in association with JNCE presents. Swarm Robotics Robosoft Systems in association with JNCE presents Swarm Robotics What is a Robot Wall-E Asimo ABB Superior Moti ABB FlexPicker What is Swarm Robotics RoboCup ~ 07 Lets Prepare for the Robotics Age The

More information

COMP2121: Microprocessors and Interfacing

COMP2121: Microprocessors and Interfacing Interfacing Lecture 9: Program Control Instructions http://www.cse.unsw.edu.au/~cs2121 Lecturer: Hui Wu Session 1, 2006 Program control instructions in AVR Stacks Overview Sample AVR assembly programs

More information

ECED3204: Microprocessor Part I--Introduction

ECED3204: Microprocessor Part I--Introduction ECED3204: Microprocessor Part I--Introduction Jason J. Gu Department of 1 Outline i. Computer ii. Processor iii. Embedded System iv. Memory v. Program Execution VI. VII. VIII. IX. AVR AVR Memory AVR CPU

More information

Software debouncing of buttons

Software debouncing of buttons Software debouncing of buttons snigelen February 5, 2015 1 Introduction Connecting a button as an input to a micro-controller is a relatively easy task, but there are some problems. The main problem is

More information

Interrupts (I) Lecturer: Sri Notes by Annie Guo. Week8 1

Interrupts (I) Lecturer: Sri Notes by Annie Guo. Week8 1 Interrupts (I) Lecturer: Sri Notes by Annie Guo Week8 1 Lecture overview Introduction to Interrupts Interrupt system specifications Multiple Sources of Interrupts Interrupt Priorities Interrupts in AVR

More information

Breeze Board. Type A. User Manual.

Breeze Board. Type A. User Manual. Breeze Board Type A User Manual www.dizzy.co.za Contents Introduction... 3 Overview Top... 4 Overview Bottom... 5 Getting Started (Amicus Compiler)... 6 Power Circuitry... 7 USB... 8 Microcontroller...

More information

Lesson 14. Title of the Experiment: Introduction to Microcontroller (Activity number of the GCE Advanced Level practical Guide 27)

Lesson 14. Title of the Experiment: Introduction to Microcontroller (Activity number of the GCE Advanced Level practical Guide 27) Lesson 14 Title of the Experiment: Introduction to Microcontroller (Activity number of the GCE Advanced Level practical Guide 27) Name and affiliation of the author: N W K Jayatissa Department of Physics,

More information

EE 308: Microcontrollers

EE 308: Microcontrollers EE 308: Microcontrollers Assmbly Language Part I Aly El-Osery Electrical Engineering Department New Mexico Institute of Mining and Technology Socorro, New Mexico, USA January 30, 2018 Aly El-Osery (NMT)

More information

CN310 Microprocessor Systems Design

CN310 Microprocessor Systems Design CN310 Microprocessor Systems Design Microcontroller Nawin Somyat Department of Electrical and Computer Engineering Thammasat University Outline Course Contents 1 Introduction 2 Simple Computer 3 Microprocessor

More information

APPENDIX A FOR SKEE3732 LABORATORY 1 SHEET

APPENDIX A FOR SKEE3732 LABORATORY 1 SHEET APPENDIX A FOR SKEE3732 LABORATORY 1 SHEET Other documents that are referred within this document are located at the link https://www.dropbox.com/sh/s16jri4eol3agl5/aaazn_w3p7fodjs-wi-xcenqa?dl=0 The ATmega32/ATmega2A

More information

8-bit Microcontroller with 2K Bytes of In-System Programmable Flash AT90S2313

8-bit Microcontroller with 2K Bytes of In-System Programmable Flash AT90S2313 Features Utilizes the AVR RISC Architecture AVR High-performance and Low-power RISC Architecture 118 Powerful Instructions Most Single Clock Cycle Execution 32x8GeneralPurposeWorkingRegisters Up to 10

More information

Adapted from a lab originally written by Simon Hastings and Bill Ashmanskas

Adapted from a lab originally written by Simon Hastings and Bill Ashmanskas Physics 364 Arduino Lab 1 Adapted from a lab originally written by Simon Hastings and Bill Ashmanskas Vithayathil/Kroll Introduction Last revised: 2014-11-12 This lab introduces you to an electronic development

More information

COMP2121: Microprocessors and Interfacing. I/O Devices (II)

COMP2121: Microprocessors and Interfacing. I/O Devices (II) COMP2121: Microprocessors and Interfacing I/O Devices (II) http://www.cse.unsw.edu.au/~cs2121 Lecturer: Hui Wu Session 2, 2017 1 Overview Keyboard LCD (Liquid Crystal Display) 2 2 Input Switches (1/2)

More information

AVR MICROCONTROLLER ARCHITECTURTE

AVR MICROCONTROLLER ARCHITECTURTE AVR MICROCONTROLLER ARCHITECTURTE AVR MICROCONTROLLER AVR- Advanced Virtual RISC. The founders are Alf Egil Bogen Vegard Wollan RISC AVR architecture was conceived by two students at Norwegian Institute

More information

INTERFACING HARDWARE WITH MICROCONTROLLER

INTERFACING HARDWARE WITH MICROCONTROLLER INTERFACING HARDWARE WITH MICROCONTROLLER P.Raghavendra Prasad Final Yr EEE What is a Microcontroller? A microcontroller (or MCU) is acomputer-on-a-chip. It is a type of microprocessor emphasizing self-

More information

Lecture 14. Ali Karimpour Associate Professor Ferdowsi University of Mashhad

Lecture 14. Ali Karimpour Associate Professor Ferdowsi University of Mashhad Lecture 14 AUTOMATIC CONTROL SYSTEMS Ali Karimpour Associate Professor Ferdowsi University of Mashhad Lecture 4 The AVR Microcontroller Introduction to AVR CISC (Complex Instruction Set Computer) Put as

More information

How to Use an Arduino

How to Use an Arduino How to Use an Arduino By Vivian Law Introduction The first microcontroller, TMS-1802-NC, was built in 1971 by Texas Instruments. It owed its existence to the innovation and versatility of silicon and the

More information

ECE2049 Homework #2 The MSP430 Architecture & Basic Digital IO (DUE Friday 9/8/17 at 4 pm in class)

ECE2049 Homework #2 The MSP430 Architecture & Basic Digital IO (DUE Friday 9/8/17 at 4 pm in class) ECE2049 Homework #2 The MSP430 Architecture & Basic Digital IO (DUE Friday 9/8/17 at 4 pm in class) Your homework should be neat and professional looking. You will loose points if your HW is not properly

More information

ECGR 4101/5101, Fall 2016: Lab 1 First Embedded Systems Project Learning Objectives:

ECGR 4101/5101, Fall 2016: Lab 1 First Embedded Systems Project Learning Objectives: ECGR 4101/5101, Fall 2016: Lab 1 First Embedded Systems Project Learning Objectives: This lab will introduce basic embedded systems programming concepts by familiarizing the user with an embedded programming

More information

3.The circuit board is composed of 4 sets which are 16x2 LCD Shield, 3 pieces of Switch, 2

3.The circuit board is composed of 4 sets which are 16x2 LCD Shield, 3 pieces of Switch, 2 Part Number : Product Name : FK-FA1416 MULTI-FUNCTION 16x2 LCD SHIELD This is the experimental board of Multi-Function 16x2 LCD Shield as the fundamental programming about the digits, alphabets and symbols.

More information

ARDUINO LEONARDO WITH HEADERS Code: A000057

ARDUINO LEONARDO WITH HEADERS Code: A000057 ARDUINO LEONARDO WITH HEADERS Code: A000057 Similar to an Arduino UNO, can be recognized by computer as a mouse or keyboard. The Arduino Leonardo is a microcontroller board based on the ATmega32u4 (datasheet).

More information

Microprocessors & Interfacing

Microprocessors & Interfacing Lecture Overview Microprocessors & Interfacing Interrupts (II) Interrupts in AVR External interrupts Internal interrupts Timers/Counters Lecturer : Dr. Annie Guo S2, 2008 COMP9032 Week7 1 S2, 2008 COMP9032

More information

8-bit Microcontroller with 1K Bytes Flash. ATtiny10 ATtiny11 ATtiny12. Preliminary. Features. Pin Configuration

8-bit Microcontroller with 1K Bytes Flash. ATtiny10 ATtiny11 ATtiny12. Preliminary. Features. Pin Configuration Features Utilizes the AVR RISC Architecture High-performance and Low-power 8-bit RISC Architecture 90 Powerful Instructions - Most Single Clock Cycle Execution 32 x 8 General Purpose Working Registers

More information

CSCE 436/836: Embedded Systems Lab 1b: Hoverboard Programming Introduction

CSCE 436/836: Embedded Systems Lab 1b: Hoverboard Programming Introduction 1 Overview CSCE 436/836: Embedded Systems Lab 1b: Hoverboard Programming Introduction Instructor: Carrick Detweiler carrick _at_ cse.unl.edu University of Nebraska-Lincoln Spring 2011 Started: Jan 27,

More information

IME-100 Interdisciplinary Design and Manufacturing

IME-100 Interdisciplinary Design and Manufacturing IME-100 Interdisciplinary Design and Manufacturing Introduction Arduino and Programming Topics: 1. Introduction to Microprocessors/Microcontrollers 2. Introduction to Arduino 3. Arduino Programming Basics

More information

8-bit Microcontroller with 2K Bytes of Flash. ATtiny28L ATtiny28V

8-bit Microcontroller with 2K Bytes of Flash. ATtiny28L ATtiny28V Features Utilizes the AVR RISC Architecture AVR High-performance and Low-power RISC Architecture 90 Powerful Instructions Most Single Clock Cycle Execution 32 x 8 General-purpose Working Registers Up to

More information

1 Introduction to Computers and Computer Terminology Programs Memory Processor Data Sheet Example Application...

1 Introduction to Computers and Computer Terminology Programs Memory Processor Data Sheet Example Application... Overview of the PIC 16F648A Processor: Part 1 EE 361L Lab 2.1 Last update: August 19, 2011 Abstract: This report is the first of a three part series that discusses the features of the PIC 16F684A processor,

More information

8-bit Microcontroller with 8K Bytes Programmable Flash AT90C8534. Preliminary

8-bit Microcontroller with 8K Bytes Programmable Flash AT90C8534. Preliminary Features Utilizes the AVR RISC Architecture AVR High-performance and Low-power RISC Architecture 118 Powerful Instructions Most Single Clock Cycle Execution 32 x 8 General-purpose Working Registers Up

More information

Physics 364, Fall 2012, Lab #9 (Introduction to microprocessor programming with the Arduino) Lab for Monday, November 5

Physics 364, Fall 2012, Lab #9 (Introduction to microprocessor programming with the Arduino) Lab for Monday, November 5 Physics 364, Fall 2012, Lab #9 (Introduction to microprocessor programming with the Arduino) Lab for Monday, November 5 Up until this point we have been working with discrete digital components. Every

More information

Embedded Systems Programming. ETEE 3285 Topic HW3: Coding, Compiling, Simulating

Embedded Systems Programming. ETEE 3285 Topic HW3: Coding, Compiling, Simulating Embedded Systems Programming ETEE 3285 Topic HW3: Coding, Compiling, Simulating 1 Assignment Write the Chasing Lights Program in C Use Codevision AVR to compile the program and remove all syntax errors

More information

Lab 2 - Powering the Fubarino. Fubarino,, Intro to Serial, Functions and Variables

Lab 2 - Powering the Fubarino. Fubarino,, Intro to Serial, Functions and Variables Lab 2 - Powering the Fubarino Fubarino,, Intro to Serial, Functions and Variables Part 1 - Powering the Fubarino SD The Fubarino SD is a 56 pin device. Each pin on a chipkit device falls broadly into one

More information

Lab Course Microcontroller Programming

Lab Course Microcontroller Programming Technische Universität München Fakultät für Informatik Forschungs- und Lehreinheit Informatik VI Robotics and Embedded Systems Lab Course Microcontroller Programming Michael Geisinger geisinge@in.tum.de

More information

ARDUINO UNO REV3 Code: A000066

ARDUINO UNO REV3 Code: A000066 ARDUINO UNO REV3 Code: A000066 The UNO is the best board to get started with electronics and coding. If this is your first experience tinkering with the platform, the UNO is the most robust board you can

More information

Arduino Uno R3 INTRODUCTION

Arduino Uno R3 INTRODUCTION Arduino Uno R3 INTRODUCTION Arduino is used for building different types of electronic circuits easily using of both a physical programmable circuit board usually microcontroller and piece of code running

More information

Microprocessor Fundamentals. Topic 7 Timing: the Timer/Counter

Microprocessor Fundamentals. Topic 7 Timing: the Timer/Counter Microprocessor Fundamentals Topic 7 Timing: the Timer/Counter Objectives Examine the Timer/Counter Register: TCNT0 Examine the Timer/Counter Control Register: TCCR0 Write a time delay for the previous

More information

Lecture 20: AVR Programming, Continued. AVR Program Visible State (ones we care about for now)

Lecture 20: AVR Programming, Continued. AVR Program Visible State (ones we care about for now) 18 100 Lecture 20: AVR Programming, Continued S 15 L20 1 James C. Hoe Dept of ECE, CMU April 2, 2015 Today s Goal: You will all be ace AVR hackers! Announcements: Midterm 2 can be picked up in lab and

More information

Mechatronics and Measurement. Lecturer:Dung-An Wang Lecture 6

Mechatronics and Measurement. Lecturer:Dung-An Wang Lecture 6 Mechatronics and Measurement Lecturer:Dung-An Wang Lecture 6 Lecture outline Reading:Ch7 of text Today s lecture: Microcontroller 2 7.1 MICROPROCESSORS Hardware solution: consists of a selection of specific

More information

Physics 335 Intro to MicroControllers and the PIC Microcontroller

Physics 335 Intro to MicroControllers and the PIC Microcontroller Physics 335 Intro to MicroControllers and the PIC Microcontroller May 4, 2009 1 The Pic Microcontroller Family Here s a diagram of the Pic 16F84A, taken from Microchip s data sheet. Note that things are

More information

COMP2121 Introductory Experiment

COMP2121 Introductory Experiment COMP2121 Introductory Experiment Objectives: In this introductory experiment, you will: Learn how to use AVR studio, an Integrated Development Environment (IDE) for developing AVR applications in Windows

More information

USER MANUAL ARDUINO I/O EXPANSION SHIELD

USER MANUAL ARDUINO I/O EXPANSION SHIELD USER MANUAL ARDUINO I/O EXPANSION SHIELD Description: Sometimes Arduino Uno users run short of pins because there s a lot of projects that requires more than 20 signal pins. The only option they are left

More information

COMP2121: Microprocessors and Interfacing. Instruction Formats and Addressing Modes

COMP2121: Microprocessors and Interfacing. Instruction Formats and Addressing Modes COMP2121: Microprocessors and Interfacing Instruction Formats and Addressing Modes http://www.cse.unsw.edu.au/~cs2121 Lecturer: Hui Wu Session 2, 2017 1 1 Overview Instruction format AVR instruction format

More information

Gates and flip-flops: glue logic, simple FSMs, registers Two-level PLDs: FSMs, muxes, decoders. Programmable logic devices (CSE370, CSE467)

Gates and flip-flops: glue logic, simple FSMs, registers Two-level PLDs: FSMs, muxes, decoders. Programmable logic devices (CSE370, CSE467) Computational hardware Digital logic (CSE370) Gates and flip-flops: glue logic, simple FSMs, registers Two-level PLDs: FSMs, muxes, decoders Programmable logic devices (CSE370, CSE467) Field-programmable

More information

Arduino Prof. Dr. Magdy M. Abdelhameed

Arduino Prof. Dr. Magdy M. Abdelhameed Course Code: MDP 454, Course Name:, Second Semester 2014 Arduino What is Arduino? Microcontroller Platform Okay but what s a Microcontroller? Tiny, self-contained computers in an IC Often contain peripherals

More information

EE 308: Microcontrollers

EE 308: Microcontrollers EE 308: Microcontrollers Introduction Aly El-Osery Electrical Engineering Department New Mexico Institute of Mining and Technology Socorro, New Mexico, USA January 6, 2018 Aly El-Osery (NMT) EE 308: Microcontrollers

More information

Chapter 1 Microprocessor architecture ECE 3120 Dr. Mohamed Mahmoud http://iweb.tntech.edu/mmahmoud/ mmahmoud@tntech.edu Outline 1.1 Computer hardware organization 1.1.1 Number System 1.1.2 Computer hardware

More information

8-bit Microcontroller with 4K Bytes In-System Programmable Flash. ATtiny40. Preliminary

8-bit Microcontroller with 4K Bytes In-System Programmable Flash. ATtiny40. Preliminary Features High Performance, Low Power AVR 8-Bit Microcontroller Advanced RISC Architecture 54 Powerful Instructions Most Single Clock Cycle Execution 16 x 8 General Purpose Working Registers Fully Static

More information