Arroyo Atmel AVR Basics - University Of Florida

2y ago
48 Views
3 Downloads
2.18 MB
18 Pages
Last View : Today
Last Download : 2m ago
Upload by : Gannon Casey
Transcription

1/11/16Atmel AVR BasicsAtmel Studio 7 & XmegaArduino DemoA. A. Arroyo1University of Florida, EEL 5666 Dr. A. Antonio ArroyoOverview BasicAVR Knowledge Atmel Studio ProgrammingUniversity of Florida, EEL 5666 Dr. A. Antonio Arroyo21

1/11/16AVR Basics TheAVR microcontrollers are divided intothree groups: 1. tiny AVR2. AVR (Classic AVR)3. mega AVR4. xmega AVR Thedifference between these devices lies inthe available features. The tinyAVR μC areusually devices with lower pin-count or areduced feature set compared to the mega &xmega AVR's . All AVR devices have identicalinstructions and memory organization.3University of Florida, EEL 5666 Dr. A. Antonio ArroyoAVR Basics AVR's contain SRAM, EEPROM, External SRAMinterface, ADC, Hardware Multiplier, UART, USART,etc. A tinyAVR and a megaAVR stripped off all theperipheral modules, leaves us with the AVR Core —the same for all AVRs.Datasheets are complete technical documents — areference on how a given peripheral/feature works. 1. One Page—Key information and Feature List 2. Architectural Overview 3. Peripheral Descriptions 4. Memory Programming 5. Characteristics 6. Register Summary 7. Instruction Set Summary 8. Packaging InformationUniversity of Florida, EEL 5666 Dr. A. Antonio Arroyo42

1/11/16Common Peripherals UART Provides serial communication interface Typically RS232 Analog/Digital Channels SPI/I2C/CAN interfaces JTAG Many sensor are analog 4 channels minimum Synchronous serial, very common interfaces Allows in circuit debugging and programming ISP Timers PWM / frequency generation modules In system programming, serial communication The more the better Allows hardware generation of motor driving signals5University of Florida, EEL 5666 Dr. A. Antonio ArroyoATMega & ATxMega Mostpopular here at UF & in Arduinos Kitchen sink of peripherals UARTS, multi-channel A/D, multiple countersand PWM channels, SPI/I2C/CAN, ISP, JTAG RISCbased 8Bit core 16/32MIPS @ 16/32Mhz Development Software free from Atmel Large Hobbyist user base on the internetUniversity of Florida, EEL 5666 Dr. A. Antonio Arroyo63

1/11/16 Go to www.atmel.com and search for xMega128A1 Download Atmel-8067.pdf and doc8077.pdfUniversity of Florida, EEL 5666 Dr. A. Antonio ArroyoxMega AU Shows availableperipheraldevices and theports they use In IMDL, weextensively useA/Ds, Timers,and USARTs. University of Florida, EEL 5666 Dr. A. Antonio Arroyo4

1/11/16Atmel Studio 7 Fasterand more powerful than Studio 6 A free Integrated Development Environment(IDE) for AVR Software Allows chip simulation and in-circuit emulation Supports the whole AVR family ofMicrocontrollers (MCUs) Has an easy to use User Interface (UI) andgives complete overview Uses the same UI for simulation & emulation9University of Florida, EEL 5666 Dr. A. Antonio ArroyoAtmel Studio 7 Usesfor Atmel Studio 5-7 Programming Simulating Debugging Improvementsover AVR Studio 4 Integrated Drivers and services The entire user interface Updated/improved simulator/debuggerUniversity of Florida, EEL 5666 Dr. A. Antonio Arroyo105

1/11/16Atmel Studio 7 Builtupon Visual Studio Uses 2015 Visual Studio Code Completion Integrated Datasheet Needmore info on your MCU, just go to properties todownload your MCU’s datasheet. I/O View Seethe register layout of the processor Use it in the Simulator or real-time with the debugger Support for ARM Processors11University of Florida, EEL 5666 Dr. A. Antonio ArroyoAtmel Studio 7 Watch Use this window to monitor variables when youdebug or simulate. ASF(AVRStudio Framework) Need help with getting some feature working? Ithas drivers & services downloadable into your code. Ex. I2C just download the TWI driver/service UsefulLinks in the Atmel Studio 6 Website ASFfor Atxmega A Family User’s Guide & Getting StartedUniversity of Florida, EEL 5666 Dr. A. Antonio Arroyo126

1/11/16Atmel Studio 7 Step1: Download and Install Atmel arget tcm:26-77368This installer contains Atmel Studio 7.0 with Atmel Software Framework3.28.1 and Atmel Toolchains. It is recommended to use this installer ifyou have internet access while installing, since it enables incrementalupdates in the arget tcm:26-77367This installer contains Atmel Studio 7.0 with Atmel Software Framework3.28.1 and Atmel Toolchains. Use this installer if you do not have internetaccess while installing. It is highly recommended to use the smaller webinstaller if you can since it provides the ability to get incremental updatesin the melstudio Release-Note.pdf Atmel Studio 7.0(file size: 1044 KB, 82 pages, updated: 11/2015) for Atmel Studio 7.0.63413University of Florida, EEL 5666 Dr. A. Antonio ArroyoAtmel Studio 7 Step0: Apply any patches {Currently none} Step 1: Create a New Project Step 2: Configure Project SettingsWhat kind of project we want to create, andsetting up filenames and locations. StepUniversity of Florida, EEL 5666 Dr. A. Antonio Arroyo3: Write your code147

1/11/16Using Peripherals ! ) ! & % " & # ! & % * ! ! % ! ! & % ' ! % ! % ( University of Florida, EEL 5666 Dr. A. Antonio ArroyoUsing Peripherals ! ! % ! " ! # % # & % University of Florida, EEL 5666 Dr. A. Antonio Arroyo8

1/11/16Using Peripherals The three parts you are interested in Overview Description/Features Register Map!University of Florida, EEL 5666 Dr. A. Antonio ArroyoUsing PeripheralsMake sure you understand how the peripheralis supposed to work, what pins it uses, whatresources it uses (Timing channels, Ports, etc) The register map is where you actually seewhich bits to set to configure the peripheral,and which registers to use to interact with theperipheral University of Florida, EEL 5666 Dr. A. Antonio Arroyo9

1/11/16Register Names Register names used by Atmel are:PeripheralName RegisterNameWith AVR Studio 6 registers are now called in a“parent”.”child” syntaxPeripheralName.RegisterNamePeripheral Name from doc8067 Register Name from doc8077 Examples: TCC0 CTRLA, PORTB OUT, PORTB DIR //set bit 0 to ‘1’ in the Data Direction register for I/O port DPORTD.DIRSET 1;University of Florida, EEL 5666 Dr. A. Antonio ArroyoRegister Names Syntax/Hierarchy When programming for any Atmel processor arequired dependency is in io.h . This header filepoints to the device specific header containingdefinitions of all the registers, i.e., assignments totheir respective memory map locations. To accessthe device specific IO header file in Atmel Studiofirst locate the “Solution Explorer” window. Nowexpand the “Dependencies” folder to find a file like“iox64a1.h”. Note the exact name varies based upon thechip in your board. The ‘64’ is the memory size, and couldbe ‘128’ in some cases. The ‘a1’ or ‘a1u’ specifies the series.University of Florida, EEL 5666 Dr. A. Antonio Arroyo10

1/11/16Register Names Syntax/Hierarchy The easiest method is touse the “IO View” insideof AVR/ATMEL Studio.University of Florida, EEL 5666 Dr. A. Antonio ArroyoRegister Names Here is the register summary for the USART. Wecan see that serial communication uses 7 regs 1 for Data 1 for status 3 for control 2 for baud rateUniversity of Florida, EEL 5666 Dr. A. Antonio Arroyo11

1/11/16Find Examples # The first result is a nice 7-page documentexplaining EXACTLY how to set up the serialUSART on the Xmega. The source code for thisexample is easily found on the internet.University of Florida, EEL 5666 Dr. A. Antonio ArroyoSample CodeImportant concept: There are two ways towrite/read a pin. Direct pin access Using a peripheral. ! % % " ! % " University of Florida, EEL 5666 Dr. A. Antonio Arroyo12

1/11/16Sample CodeUniversity of Florida, EEL 5666 Dr. A. Antonio ArroyoSample CodeUniversity of Florida, EEL 5666 Dr. A. Antonio Arroyo13

1/11/16Sample Code Use bit masking to access individual pins PORTX OUT 0b00001000; //sets pin 3 highPORTX OUT & 0b11110111; //sets pin 3 lowFor input, you have to read entire portif ((PORTJ IN & 0b00010000) 0b00010000)//evaluates as TRUE is bit 4 of PORTJ is high University of Florida, EEL 5666 Dr. A. Antonio ArroyoAssembly Code SampleUniversity of Florida, EEL 5666 Dr. A. Antonio Arroyo2814

1/11/16Assembly Code Sample29University of Florida, EEL 5666 Dr. A. Antonio ArroyoAssembly Code SampleUniversity of Florida, EEL 5666 Dr. A. Antonio Arroyo3015

1/11/16Writing C Programs ! # ! & ! % & - & % ! " ! & ! & ( ) * / "% ,/.'0. " * University of Florida, EEL 5666 Dr. A. Antonio ArroyoWriting C Programs#includesmain(){Initialize LCD, Servos, PWM, A/D, Serial,DIR, variableswhile(1){read sensorsinterpret sensorsfunction1()update LCD } // while} // end of mainUniversity of Florida, EEL 5666 Dr. A. Antonio Arroyofunction1(args) {stuff } // end of function 116

1/11/16Writing C ProgramsUniversity of Florida, EEL 5666 Dr. A. Antonio ArroyoWriting C ProgramsUniversity of Florida, EEL 5666 Dr. A. Antonio Arroyo17

1/11/16Writing C ProgramsUniversity of Florida, EEL 5666 Dr. A. Antonio ArroyoArduino ProgramsUniversity of Florida, EEL 5666 Dr. A. Antonio Arroyo3618

AVR Basics The AVR microcontrollers are divided into three groups: 1. tiny AVR 2. AVR (Classic AVR) 3. mega AVR 4. xmega AVR The difference between these devices lies in the available features. The tinyAVR μC are usually devices with lower pin-count or a reduced feature set compared to the mega & xmega AVR's. All AVR devices have identical

Related Documents:

the Atmel AVR XMEGA AU microcontroller family. The Atmel AVR XMEGA AU is a family of low-power, high-performance, and peripheral-rich CMOS 8/16-bit microcontrollers based on the AVR enhanced RISC architecture. The available Atmel AVR XMEGA AU modules described in this manual are: zAtmel AVR CPU zMemories zDMAC - Direct memory access controller

XMEGA E5 [DATASHEET] 5 Atmel-8153K AVR-ATxmega8E5-ATxmega16E5-ATxmega32E5_Datasheet 08/2016 4. Overview The Atmel AVR XMEGA is a family of low power, high perfo rmance, and peripheral rich 8/16-bit microcontrollers based on the AVR enhanced RISC architecture. By executing instructions in a single clock cycle, the AVR XMEGA devices

To program Atmel AVR microcontrollers using C, you will need Atmel Studio software, which is freely available from the company website. Atmel Studio is an integrated development environment that includes the editor, C compiler, assembler, HEX file downloader, and a microcontroller emulator. To install Atmel Studio, perform the following steps:File Size: 758KB

Arroyo Seco Arroyo Seco EXPLORE THE ARROYO SECO Please enjoy your experience here, soak in the view, hug a tree, stay on the trails, and help keep "the Arroyo" a place for all to enjoy for generations to come! Please remember: the Arroyo Seco is a dynamic system that can change from a trickle to a roaring river in short order and without .

enables execution of AVR programs on an AVR In-Circuit Emulator or the built-in AVR Instruction Set Simulator. In order to execute a program using AVR Studio, it must first be compiled with IAR Systems' C Compiler or assembled with Atmel's AVR Assembler to generate an object file which can be read by AVR Studio. Rev. 1019A-A–01/98

The AVR 3700/AVR 370 7.2-channel and AVR 2700/AVR 270 7.1-channel digital audio/ video receivers continue this tradition with some of the most advanced audio and video processing capabilities yet, and a wealth of listening and viewing options. To obtain the maximum enjoyment from your new receiver, please read this manual and

the Avr 3700/Avr 370 7.2-channel and Avr 2700/Avr 270 7.1-channel digital audio/ video receivers continue this tradition with some of the most advanced audio and video processing capabilities yet, and a wealth of listening and viewing options. to obtain the maximum enjoyment from your new receiver, please read this manual and

Abrasive water jet can do this with quality results but, generally is too expensive compared to plasma, laser or punching. 5. Cut Geometry Abrasive waterjet cuts have straight edges with a slight amount of taper. Kerf width is controlled by the orifice/nozzle combination. Cuts in thicker materials generally require larger combinations with more abrasive usage. The kerf width can be as small as .