AVR Project Book new

Avr Project Book New-PDF Download

  • Date:05 Nov 2019
  • Views:144
  • Downloads:2
  • Pages:71
  • Size:1.39 MB

Share Pdf : Avr Project Book New

Download and Preview : Avr Project Book New


Report CopyRight/DMCA Form For : Avr Project Book New


Transcription:

Table of Content,List of Figures ii,Preface 1,Back Ground Information 2. Overview of the Processor 2, Introduction to AVR Studio 2. Introduction to AVR GCC WinAVR 3,Projects 4,1 I O Ports 6. Project 1 a LEDs 7, Project 1 b Switches 8,2 Timers 12. Project 2 a Blinking Light 15, Project 2 b Clock 16.
3 USART 21, Project 3 a Transmit through Serial Port 23. Project 3 b Receive Through Serial Port 24,4 External Interrupt 28. Project 4 a Elapsed Time 29, Project 4 b Software Serial Port 31. 5 PWM 35, Project 5 a DAC from PWM 38, Project 5 b Voltage Converter through PWM 39. 6 ADC 42, Project 6 a Voltmeter 45, Project 6 b Temperature Sensor 47.
Appendix A Layouts and Schematics 51, Schematics 52. Package Content 55, About the Author 55, Items required to perform projects 56. Further Information 56,Appendix B Frequently Asked Questions 57. Appendix C Glossary of Terms 58,Table of Alphabetical Index 67. List of Figures,Figure II 1 Connecting Project Board with JTAG 5.
Figure III 1 Schematic for LED Interfacing 7, Figure III 2 Layout of wiring on Project Board for LED Interfacing 8. Figure III 3 Schematic for switch Interfacing 9, Figure III 4 Layout of wiring on Project Board for Switch Interfacing 9. Figure IV 1 Schematic for Digital Clock 19, Figure IV 2 View of the wiring on Project Board for Digital Clock 20. Figure V 1 Schematic for Serial Port Transmit 23,Figure V 2 A view of Serial cable connected 23. Figure V 3 Schematic for serial port Receive 25,Figure VI 1 Schematic for Period Measurement 29.
ii, Figure VI 2 Schematic for Software Serial Port 31. Figure VI 3 Picture showing wiring of Software Serial port 31. Figure VII 1 Fast PWM Mode Timing Diagram 36, Figure VII 2 Phase Correct PWM Mode Timing Diagram 37. Figure VII 3 Schematic for Digital to Analog Conversion through PWM 39. Figure VII 4 Picture showing Wiring of Digital to Analog Conversion through PWM 39. Figure VII 5 Schematic for Negative Voltage Generation 40. Figure VII 6 Picture showing Wiring of Negative Voltage Generation 40. Figure VIII 1 ADC Prescaler 43,Figure VIII 2 Schematic for Voltmeter 45. Figure VIII 3 picture showing Wiring of Voltmeter 46. Figure VIII 4 Schematic for Temperature Sensor using LM35 47. Figure VIII 5 Picture showing Wiring of Temperature Sense using LM35 48. Figure VIII 6 Schematic for Temperature sensing through Thermistor 49. Figure VIII 7 Picture showing Wiring for Temperature sensing through Thermistor 50. Figure IX 1 LAYOUTs of Project Board PCB 51, iii, Dedicated. To ALLAH Almighty , All of HIS Messengers, Especially The Last Prophet MUHAMMAD Peace be upon Him .
And My Family, iv, ALL H is the Light of the Heavens and the Earth The parable of His. Light is as if there were a niche and within it a lamp the lamp is in. glass the glass as it were a brilliant star lit from a blessed tree an. olive neither of the east nor of the west whose oil would almost glow. forth of itself though no fire touched it Light upon Light ALL H. guides to HIS Light whom HE wills And ALL H sets forth parables. for mankind and ALL H is All Knower of everything NOOR 35 . Preface, In our country the base of Engineering is not very broad especially in the field of Electronics Usually all the items has. to be imported from other countries Not only just components but Books Kits programmers tools Softwares etc . This becomes a major bottleneck for someone studying the subject or involved as hobbyist as he does not find the. required items in local market and if he is unable to import The idea of a Project Book came into my mind as I see that. after spending more than 10 years in this field the situation is not changing Importing everything required is not a. practical thing to do for a majority of professionals in the developing countries So I thought that there should be Books. that will provide in one pack all necessary Hardware Software and guidelines to build some very basic projects So the. one who will use it will not need to buy any thing to work on the projects described in the book other than a host. computer and some inexpensive tools , One more unique feature of this book other than having all Hardware in a pack is that a JTAG programmer debugger. is provided with the book A JTAG Debugger is a very helpful tool and increases the learning curve significantly . The Book is divided into six major sections namely IO Ports Timers External Interrupt UART PWM and ADC . Although only these sections does not cover the complete Microprocessor Having knowledge and a hand full of. experience of these peripherals of the processor makes a good programming base for someone After that he can build. the systems using other peripherals of the Microprocessor . While writing this book it is assumed that the reader knows the C language and is also familiar with some. microcontroller programming If the user is not familiar with C or Microcontroller basics he should consult the relevant. books first This book is not a C language Programming Book or a Book to learn Microprocessor Fundamentals . When I have started thinking about a project book the first problem was to choose a microcontroller for the book I. decided ATMEGA16 from ATMEL as the processor to be discussed in this book because of the peripheral it has . availability of JTAG Debugger availability of GCC Compiler for AVR and availability of the processor in local market . The PCBs of this Project Book is built keeping in mind that they should be helpful to the user during running the. projects from the book and even after he has finished and wanted to build something of his own . Although most of the items are provided with the Project Book some Tools will be required or will help to run the. projects and are listed in Items required to perform projects . Abdul Malik Khan, DigiSoft Islamabad Pakistan,June 2008. 1, Back Ground Information,Overview of the Processor.
High performance Low power AVR 8 bit Microcontroller. Advanced RISC Architecture, 131 Powerful Instructions Most Single clock Cycle Execution. 32 x 8 General Purpose Working Registers, High Endurance Non volatile Memory segments. 16K Bytes of In System Self programmable Flash program memory. 512 Bytes EEPROM, 1K Byte Internal SRAM, JTAG IEEE std 1149 1 Compliant Interface. Peripheral Features, Two 8 bit Timer Counters with Separate Prescalers and Compare Modes. One 16 bit Timer Counter with Separate Prescaler Compare Mode and Capture Mode. Real Time Counter with Separate Oscillator, Four PWM Channels.
8 channel 10 bit ADC, Byte oriented Two wire Serial Interface. Programmable Serial USART, Master Slave SPI Serial Interface. Programmable Watchdog Timer with Separate On chip Oscillator. On chip Analog Comparator, Special Microcontroller Features. Power on Reset and Programmable Brown out Detection. Internal Calibrated RC Oscillator, I O and Packages. 32 Programmable I O Lines 40 pin DIP package, Operating Voltages.
4 5 5 5V for ATmega16, Power Consumption 1 MHz 3V and 25 C for ATmega16L. Active 1 1 mA Idle Mode 0 35 mA Power down Mode 1 A. Introduction to AVR Studio, AVR Studio is an Integrated Development Environment for writing and debugging AVR applications in Windows . 98 XP ME 2000 and Windows NT environments , AVR Studio provides a project management tool source file editor and chip simulator It also interfaces with In Circuit. Emulators and development boards available for the AVR 8 bit RISC family of microcontrollers Simplifying the. development tasks AVR Studio allows customers to significantly reduce time to market . Features of AVR Studio, Integrated Development Environment for Writing Compiling and Debugging Software. Fully Symbolic Source level Debugger, Configurable Memory Views Including SRAM EEPROM Flash Registers and I Os.
Unlimited Number of Break Points, Online HTML Help. 2, Variable Watch Edit Window with Drag and drop Function. Extensive Program Flow Control Options, Simulator Port Activity Logging and Pin Input Stimuli. File Parser Support for COFF UBROF6 UBROF8 and Hex Files. Support for C Pascal BASIC and Assembly Languages. Introduction to AVR GCC WinAVR , The AVR GCC plug in is a GUI front end to GNU make and avr gcc The plug in requires GNU make and avr gcc for. basic operations and avr objdump from the AVR GNU binutils for generating list files To avoid problems setting up. the build environment it is recommended to install the WinAVR distribution available at the WinAVR project s home. page , The plug in component will automatically detect an installed WinAVR distribution and set up the required tools.
accordingly An AVR GCC plug in project is a collection of source files and configurations A configuration is a set of. options that specify how to build and link the files in a project On creating a new project the default configuration is. created A user can choose to continue using this configuration adding removing options as the project evolves or. create one or more new configurations to use in the project . AVFR GCC Features,Integration of avr gcc and Make in AVR Studio. Start the compiler clean the project set project options and debug the project from AVR Studio Tools from the. WinAVR distribution are detected by the plug in ,GUI Controls to Manipulate Project Settings. Custom compile options can be set for specific files or all files in the project Linker options can also be set There are. controls for optimization level include directories libraries memory segments and more . A Project Tree for Managing Project Files, A project tree provides easy access to and manipulation of every file in the project . Work with Several Configurations, It is possible to define several sets of build options called configurations . Build Output, A build output view shows raw output from GNU make and avr gcc Error and warning messages that contain reference.
to a file and line can be double clicked to open this file and put a marker on the line . External Makefile, The plug in allows the user to define a makefile to use for the build process . Map and List Files, Map and list files can be generated on each build . External Dependencies, The plug in keeps track of dependencies on libraries and header files that are not part of a project . GNU Assembler projects, A user can set up and work with projects that consist of both assembly files s and C files avr gcc is used to assemble. the s files , 3, Projects, The projects presented in the following chapters are carefully selected that may be of interest of a newbie and.
experienced programmers at the same time , A line by line explanation is given for the early projects however general code description is given for the more. complex projects where a line by line explanation is not suitable . Every project chapter of this book has the following format. Introduction, Brief Register summary for more details of registers consult ATMEGA16 DataSheet . Project Description, Schematic of the project, Board Layout to carryout project. Code, Brief explanation of the code, Project Description schematic Board Layout Code and explanation for the subsequent projects. Almost everything required to setup the environment for running projects is included in the book However items listed. in Items required to perform projects will be required or will help in effectively running the projects . Making the Software Environment for running projects. Install AVR Studio and WinAVR from the CD Installation procedure of the Software is given in the corresponding. Directories , It is a good idea to copy the projects folder from CD on the root directory of one of your Hard disk If you choose to.
copy it to some other location the file references given in this book may become different than what you will see on. your computer ,Hardware Preparation for running projects. Connect JTAG Board and Project Board using the 10 pin Ribbon cable Connect the JTAG Board to the PC using the 9. pin Cable supplied If your computer does not have a Serial port you may need to buy a USB to Serial Converter to. connect PC and JTAG Board Connect the appropriate power plug of the wall adapter to the Project Board the JTAG. Board will get the power from the Project Board through Ribbon Cable The voltage selection on the wall adapter. should be between 8V and 12V Check that the power LED on the JTAG Board is ON If you find the power LED on. JTAG Board is OFF you may need to reverse the polarity of the power plug . The processor in the AVR Project Board is configured to work on 4 MHz internal RC oscillator All projects presented. in this book use this setting as default If the default setting is required to be changed refer to the AVR JTAG user guide. for changing Fuse settings , 4, Figure II 1 Connecting Project Board with JTAG. 5, The Prophet saw said , You should not be envious of anyone except he upon whom. ALLAH Bestows the knowledge of the Quran and he, studies and practices it through the day and night and. the other is he whom ALLAH Gives wealth and he spends it. in the cause of ALLAH throughout the night and day . Bukhari Muslim ,1 I O Ports, I O Ports are the most basic interface to the Microprocessor The port pins are grouped using 8 bi.
one who will use it will not need to buy any thing to work on the projects described in the book other than a host computer and some inexpensive tools One more unique feature of this book other than having all Hardware in a pack is that a JTAG programmer debugger is provided with the book A JTAG Debugger is a very help ful tool and

Related Books