Software Design Considerations, Narrative and Documentation
|
|
- Jordan Bradley
- 5 years ago
- Views:
Transcription
1 Software Design Considerations, Narrative and Documentation Introduction The project under consideration is an automated shopping cart designed to follow a shopper around a simulated supermarket environment. An ultrasonic beacon is planted on the shopper. The cart tracks the shopper s movements by measuring the relative strength of the signals picked up by the ultrasonic receivers mounted on the different ends of the cart. The key responsibilities of the software running on the microcontroller on the cart are: To regularly poll the ultrasonic receivers and triangulate the shopper s position To use the data collected from the ultrasonic polling to determine the mode of operation To adjust the speeds of the motors driving the cart based on distance, bearing and mode of operation To take evasive action when the infrared proximity sensors are tripped Software Design Considerations Memory Models An Atmel ATMega32L microcontroller is used to operate the cart. This device is equipped with 32Kb of flash memory (program space) and 2Kb of SRAM for supporting run-time data and a program stack. This amount of storage space is sufficient to meet the modest requirements of the project, while leaving ample room for future expansion. The ATMega32L also provides 1Kb of EEPROM. However, the project does not utilize nonvolatile data and thus does not make use of this space. Page 1 of 16
2 Memory Sections and Mapping The ATMega32L s physical memory space is divided into three smaller memory spaces that are all linear and regular. These are: Data Memory Space: The data memory space is used to store and access all run-time data. The lowest 32 addresses of the data memory space access the register file that comprises 32 general purpose registers. These are typically used to hold values of operands and the results of intermediate operations while executing instructions. The next 64 addresses are the memory-mapped I/O ports and peripheral registers (also known as the I/O space). The remainder of the data memory space accesses the internal SRAM which is used to store volatile variables and the program stack. Figure 1 - Data Memory Space Mapping Program Memory Space: The program memory space (flash memory) holds the application code and other read-only data. The 32Kb of flash memory is wordaddressable i.e. it is organized as 16k x 16. The program memory space is further divided Page 2 of 16
3 into an application flash section and a boot loader flash section. While the former contains the software to operate the microcontroller, the latter section houses boot loader code that can be used to automatically upgrade the firmware. Figure 2 - Program Memory Space Mapping EEPROM Memory Space: The ATMega32L also contains a 1Kb, byte-addressable EEPROM memory space to hold non-volatile data. Due to the nature of the project, this space is not used by the design. All of the software development has been done in C and compiled using the CodeVision C Compiler for Atmel AVR. As a result, the programmer has been released from the burden of organizing the code neatly in memory and ensuring the correct memory mappings. Further details about the memory organization of the microcontroller may be found in the ATMega32L datasheet [1]. Page 3 of 16
4 Startup Code The startup code has some important duties to fulfill including: Initializing the stack pointer Allocating space for global variables Copying the value of initialized variables to the appropriate memory locations in the data section Jumping to main() Once again, thanks to the CodeVision Wizard that automatically generates startup code, the programmer is freed from the burden of having to write it. Organization of Embedded Application Code The software takes readings from the ultrasonic and infrared sensors and adjusts the speeds of the motors driving the cart appropriately. The infrared sensors produce a digital output signal that can be read instantly. The ultrasonic sensors on the other hand output an analog voltage value that is converted to a digital value by the microcontroller s A-D unit. The algorithm to adjust the motor speeds varies the duty cycles of the PWM output signals. The application code is organized in a command-driven fashion i.e. as a combination of program-driven and interrupt-driven modules. The infrared sensors generate external interrupt requests when they are tripped. One of the on-board timer modules is used to generate a periodic interrupt, the servicing of which polls the A-D inputs. The main loop of the program uses the current and past voltage samples read by the A-D unit to adjust the PWM duty cycles appropriately. Page 4 of 16
5 Software Design Narrative Function Signature: void main(void); Return Value: None Parameters: None Description: This function is the entry point of the program. Its first act is to initialize all the on-board peripherals via a call to initperipherals(). It then sets the global interrupt enable bit before entering the main loop. The main loop is a work in progress. The current algorithm (refer to flowchart in Fig. 3) adjusts the duty cycles of the drive motors in an attempt to make the ultrasonic voltage readings converge to an equilibrium value. While this algorithm enables the cart to follow a person, it is not capable of distinguishing between the different modes of operation. A more sophisticated algorithm that tweaks the drive motor duty cycle based on a sequence of previously observed voltage samples is required to realize this function. Function Signature: void initperipherals(void); Return Value: None Parameters: None Description: This procedure initializes the microcontroller peripherals and I/O ports as shown in the following table: Table 1 - Peripheral / Port Initialization Settings Peripheral / Port Register Settings Purpose Port A Port B Port C PORTA = 0x00 DDRA = 0x00 PORTB = 0x00 DDRB = 0x08 PORTC = 0x00 DDRC = 0x00 Port A configured as an input port. Pins PA0, PA1 and PA2 are the inputs to the A-D unit All port B pins other than PB3 are configured as inputs. PB3 outputs the PWM signal for the left drive motor Port C is unused and configured as an input port Page 5 of 16
6 Peripheral / Port Register Settings Purpose Port D Timer 0 Timer 1 Timer 2 External Interrupts A-D Unit PORTD = 0x00 DDRD = 0x80 TCCR0=0x61; TCNT0=0x00; OCR0=0xff; TCCR1A=0x00; TCCR1B=0x01; TCNT1H=0x00; TCNT1L=0x00; ICR1H=0x00; ICR1L=0x00; OCR1AH=0x01; OCR1AL=0xF4; OCR1BH=0x00; OCR1BL=0x00; ASSR=0x00; TCCR2=0x61; TCNT2=0x00; OCR2=0xff; GICR=0xC0; MCUCR=0x00; MCUCSR=0x00; GIFR=0xC0; ADMUX=0x60; ADCSRA=0x83; SFIOR&=0xEF; All port D pins other than PD7 are configured as inputs. PD7 outputs the PWM signal for the right motor. PD2 and PD3 are the external interrupt pins wired to the left and right infrared sensors respectively Timer 0 is configured to generate a PWM signal with variable duty cycle for the left drive motor Timer 1 is configured to generate a periodic interrupt every 0.5ms Timer 2 is configured to generate a PWM signal with variable duty cycle for the right drive motor External interrupts 0 and 1 are enabled to generate requests when the pins INT0 and INT1 are pulled low The A-D unit is configured to use the AVCC pin as the voltage reference and return the result of the conversion as an 8-bit value This initialization code was automatically generated by the CodeVision Wizard. Function Signature: void leftinfraredisr(void); Return Value: None Parameters: None Page 6 of 16
7 Description: This is the interrupt service routine for the INT0 pin that is wired to the infrared sensor mounted on the front left end of the cart. When the sensor is tripped and the ISR executed, the right motor (the one opposite the tripped sensor) is turned off. This causes the cart to swivel about its right wheel, steering away from the obstacle. Lastly, the routine clears the periodic timer interrupt flag. This ensures that periodic timer interrupts (that poll the A-D unit and cause the cart to follow the shopper) are ignored while the cart attempts to steer around an obstacle. Function Signature: void rightinfraredisr(void); Return Value: None Parameters: None Description: This is the interrupt service routine for the INT1 pin that is wired to the infrared sensor mounted on the front right end of the cart. It implements the same algorithm as the function leftinfraredisr(), except it controls the left wheel. Function Signature: void pollad(void); Return Value: None Parameters: None Description: This routine services the periodic interrupts generated by timer 1. It implements the algorithm depicted by the flowchart in Fig. 4. The ultrasonic receivers mounted on the front end of the carts are first polled. If both of these register no signal, only then is the rear sensor polled. The voltage readings are then stored in global variables to be read by the motor speed adjustment algorithm. The program will also need to keep track of past voltage readings to decode the operation mode. This will be achieved by storing the values read into a circular buffer. Function Signature: unsigned char readad(unsigned char adcinput); Return Value: The converted value of the analog voltage Parameters: The channel to convert Description: This automatically generated code segment converts the analog voltage input on the specified channel into a digital value and returns this 8-bit value. Page 7 of 16
8 Software Documentation Flowcharts Start Initialize on-board peripherals Enable global interrupts Note: Interrupt requests are not explicitly mentioned in the flowchart and may affect program flow. Once the interrupt has been serviced, control is restored to the point from where the jump was made. Read the last sampled front left, front right and rear voltages Turn off both motors Are front left and right voltages non-zero? Y Compute values by which to step up motor duty cycles based on the difference between equilibrium voltage and current voltage N N Is rear voltage non-zero? Y Turn on left motor, turn off the right motor Update the PWM duty cycle Figure 3 Main Loop Flowchart Page 8 of 16
9 Start Clear the interrupt flag Perform an A-D conversion on channel 0 (front left receiver) Perform an A-D conversion on channel 1 (front right receiver) Are front left and right voltages zero? N Y Perform an A-D conversion on channel 2 (rear receiver) Store sampled voltages in global data structure Return Figure 4 Periodic Interrupt Service Routine Page 9 of 16
10 Code Listing /***************************************************** This program was produced by the CodeWizardAVR V1.24.3b Standard Automatic Program Generator Copyright Pavel Haiduc, HP InfoTech s.r.l. Project : The Digijokers Version : Date : 11/8/2004 Author : Raghuram Ramanujan & Clive Lopez Company : Purdue University Comments: ECE 477 Group 8 Chip type : ATmega16 Program type : Application Clock frequency : MHz Memory model : Small External SRAM size : 0 Data Stack size : 256 *****************************************************/ #include <mega16.h> // Symbolic constants #define ADC_VREF_TYPE 0x60 #define TOLERANCE 0 #define NUM_SAMPLES 10 #define NUM_STEPS 2 #define EQBM_VOLTAGE 0x7f #define TRUE 1 #define FALSE 0 // Macros #define ISEQUAL(x, y) ((x >= y - TOLERANCE) && (x <= y + TOLERANCE)) #define ISLESS(x, y) (x < y - TOLERANCE) #define ISGREATER(x, y) (x > y + TOLERANCE) // Global variables unsigned char pastfrontleftsamples[num_samples] = 0; unsigned char pastfrontrightsamples[num_samples] = 0; Page 10 of 16
11 unsigned char pastrearsamples[num_samples] = 0; // Function prototypes unsigned char readad(unsigned char); void initperipherals(void); // External Interrupt 0 service routine interrupt [EXT_INT0] void leftinfraredisr(void) // Clear interrupt flag GIFR = 0x40; // Turn off right side motor OCR2 &= 0x00; // Clear timer interrupt flag to override A-D polling TIFR = 0x10; // External Interrupt 1 service routine interrupt [EXT_INT1] void rightinfraredisr(void) // Clear interrupt flag GIFR = 0x80; // Turn off left side motor OCR0 &= 0x00; // Clear timer interrupt flag to override A-D polling TIFR = 0x10; // Timer 1 output compare A interrupt service routine interrupt [TIM1_COMPA] void pollad(void) unsigned char channeltoconvert; unsigned char frontleftvoltage; unsigned char frontrightvoltage; unsigned char rearvoltage = 0; // Clear the timer interrupt flag TIFR = 0x10; // Read voltage on channel 0 - front left ultrasonic channeltoconvert = 0; frontleftvoltage = readad(channeltoconvert); Page 11 of 16
12 // Read voltage on channel 1 - front right ultrasonic channeltoconvert = 1; frontrightvoltage = readad(channeltoconvert); // If both the front receivers are not picking up anything, check the // receiver at the back end if (ISEQUAL(frontLeftVoltage, 0) && ISEQUAL(frontRightVoltage, 0)) channeltoconvert = 2; rearvoltage = readad(channeltoconvert); // Overwrite old samples /*for (i = 9; i > 0; i--) pastfrontleftsamples[i] = pastfrontleftsamples[i - 1]; pastfrontrightsamples[i] = pastfrontrightsamples[i - 1]; pastrearsamples[i] = pastrearsamples[i - 1]; */ pastfrontleftsamples[0] = frontleftvoltage; pastfrontrightsamples[0] = frontrightvoltage; pastrearsamples[0] = rearvoltage; return; // Read the 8 most significant bits of the AD conversion result unsigned char readad(unsigned char adcinput) // Set up ADMUX register to perform conversion on specified channel, // with result left-adjusted and truncated to 8 bits using AVCC as // reference voltage ADMUX = adcinput ADC_VREF_TYPE; // Start the AD conversion ADCSRA = 0x40; // Wait for the AD conversion to complete while ((ADCSRA & 0x10) == 0); // Clear the AD interrupt flag (just in case) ADCSRA = 0x10; return ADCH; Page 12 of 16
13 void initperipherals(void) // Input/Output Ports initialization // Port A initialization // Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In // State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T PORTA=0x00; DDRA=0x00; // Port B initialization // Func7=In Func6=In Func5=In Func4=In Func3=Out Func2=In Func1=In Func0=In // State7=T State6=T State5=T State4=T State3=0 State2=T State1=T State0=T PORTB=0x00; DDRB=0x08; // Port C initialization // Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In // State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T PORTC=0x00; DDRC=0x00; // Port D initialization // Func7=Out Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In // State7=0 State6=T State5=T State4=T State3=T State2=T State1=T State0=T PORTD=0x00; DDRD=0x80; // Timer/Counter 0 initialization // Clock source: System Clock // Clock value: khz // Mode: Phase correct PWM top=ffh // OC0 output: Non-Inverted PWM TCCR0=0x61; TCNT0=0x00; OCR0=0xff; // Timer/Counter 1 initialization // Clock source: System Clock // Clock value: khz // Mode: Normal top=ffffh // OC1A output: Discon. Page 13 of 16
14 // OC1B output: Discon. // Noise Canceler: Off // Input Capture on Falling Edge TCCR1A=0x00; TCCR1B=0x01; TCNT1H=0x00; TCNT1L=0x00; ICR1H=0x00; ICR1L=0x00; OCR1AH=0x01; OCR1AL=0xF4; OCR1BH=0x00; OCR1BL=0x00; // Timer/Counter 2 initialization // Clock source: System Clock // Clock value: khz // Mode: Phase correct PWM top=ffh // OC2 output: Non-Inverted PWM ASSR=0x00; TCCR2=0x61; TCNT2=0x00; OCR2=0xff; // External Interrupt(s) initialization // INT0: On // INT0 Mode: Low level // INT1: On // INT1 Mode: Low level // INT2: Off GICR =0xC0; MCUCR=0x00; MCUCSR=0x00; GIFR=0xC0; // Timer(s)/Counter(s) Interrupt(s) initialization TIMSK=0x10; // Analog Comparator initialization // Analog Comparator: Off // Analog Comparator Input Capture by Timer/Counter 1: Off ACSR=0x80; SFIOR=0x00; // ADC initialization // ADC Clock frequency: khz Page 14 of 16
15 // ADC Voltage Reference: AVCC pin // ADC High Speed Mode: Off // ADC Auto Trigger Source: None // Only the 8 most significant bits of // the AD conversion result are used ADMUX=ADC_VREF_TYPE; ADCSRA=0x83; SFIOR&=0xEF; // Watchdog Timer initialization // Watchdog Timer Prescaler: OSC/512k // Disable watchdog for debugging purposes - will uncomment these lines later //WDTCR=0x1D; //WDTCR=0x0D; return; void main(void) unsigned char frontleftvoltage; unsigned char frontrightvoltage; unsigned char rearvoltage; unsigned char frontleftstepvalue; unsigned char frontrightstepvalue; // Initialize peripherals, configure ports initperipherals(); // Global enable interrupts #asm("sei") // Main loop while (1) // Hold voltage values constant while stepping through this algorithm - // otherwise, an interrupt could change these values in mid-execution with // unpredictable effects frontleftvoltage = pastfrontleftsamples[0]; frontrightvoltage = pastfrontrightsamples[0]; rearvoltage = pastrearsamples[0]; if (!ISEQUAL(frontLeftVoltage, 0) &&!ISEQUAL(frontRightVoltage, 0)) frontleftstepvalue = (EQBM_VOLTAGE - frontleftvoltage) >> NUM_STEPS; frontrightstepvalue = (EQBM_VOLTAGE - frontrightvoltage) >> NUM_STEPS; Page 15 of 16
16 OCR0 += frontleftstepvalue; OCR2 += frontrightstepvalue; else if (!ISEQUAL(rearVoltage, 0)) OCR0 = 0xff; OCR2 = 0x00; else OCR0 = 0x00; OCR2 = 0x00; References [1] Atmel Corporation, AVR ATMega32/ATMega32L Microcontroller Datasheet Page 16 of 16
RANGKAIAN LENGKAP. Universitas Sumatera Utara
RANGKAIAN LENGKAP Lampiran Program /***************************************************** This program was produced by the CodeWizardAVR V1.25.8 Professional Automatic Program Generator Copyright 1998-2007
More informationGambar A-1 Foto alat prototype infrared thermometer
LAMPIRAN A Foto Alat Gambar A-1 Foto alat prototype infrared thermometer A-1 LAMPIRAN A A-2 LAMPIRAN A Daftar Komponen yang digunakan Komponen Aktif Nama komponen Fungsi Jumlah AVR ATMega 8535 Mikrokontroler
More informationAli Karimpour Associate Professor Ferdowsi University of Mashhad
AUTOMATIC CONTROL SYSTEMS Ali Karimpour Associate Professor Ferdowsi University of Mashhad Reference: Microcontroller Based Applied Digital Control Dogan Ibrahim, John Wiley & Sons Ltd, 2006 Liquid Level
More informationLAMPIRAN. Program Keseluruhan Sistem Pengontrolan Level Air
LAMPIRAN Program Keseluruhan Sistem Pengontrolan Level Air /***************************************************** This program was produced by the CodeWizardAVR V2.03.4 Standard Automatic Program Generator
More informationLAMPIRAN A FOTO ALAT
LAMPIRAN A FOTO ALAT Gambar A.1. Gambar robot mobil dilihat dari atas Gambar A.2. Gambar robot mobil dilihat dari depan Gambar A.3. Gambar robot mobil dilihat dari samping Gambar A.4. Gambar keseluruhan
More information// WRITE data to be written to EEPROM
/***************************************************** This program was produced by the CodeWizardAVR V2.03.9 Evaluation Automatic Program Generator Copyright 1998-2008 Pavel Haiduc, HP InfoTech s.r.l.
More informationLAMPIRAN. 1. Program Alat
LAMPIRAN 1. Program Alat This program was produced by the CodeWizardAVR V2.03.4 Standard Automatic Program Generator Copyright 1998-2008 Pavel Haiduc, HP InfoTech s.r.l. http://www.hpinfotech.com Project
More informationLAMPIRAN A List Program CodeVision Generato Data...A-1 List Program CodeVision Multiplexer...A-11 List Program CodeVision Demultiplexer...
LAMPIRAN A List Program CodeVision Generato Data...A-1 List Program CodeVision Multiplexer...A-11 List Program CodeVision Demultiplexer...A-14 List Program Codevision Generator Data /****************************************
More informationLAMPIRAN A PROGRAM UTAMA ROBOT NOMOR 2
LAMPIRAN A PROGRAM UTAMA ROBOT NOMOR 2 1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: [Bioloid Premium]-Robot 2 v 2 22: 23: 24: 25: A-1 26: 27: 28: 29: 30: 31: 32: 33: 34: 35:
More informationLAMPIRAN A. Universitas Sumatera Utara
63 LAMPIRAN A Rangkaian Lengkap Perangkat Keras Rangkaian ini terdiri dari Rangkaian Power Supply (PSA), Mikrokontroller atmega8535, RFID Reader ID 12, Rangkaian Infra Merah Fotodioda, driver max232 dan
More informationLAMPIRAN A FOTO Radio Control Helikopter dan Pengendalinya
LAMPIRAN A FOTO Radio Control Helikopter dan Pengendalinya Tampak Atas A-1 Tampak Depan A-2 Tampak Samping A-3 Tampak Belakang A-4 Pengendali A-5 LAMPIRAN B PROGRAM PADA MICROSOFT VISUAL BASIC 6 DAN PENGONTROL
More informationLAMPIRAN A. Foto Alat
LAMPIRAN A Foto Alat A-1 A-2 Rangkaian Skematik PCB Sistem Monitoring Infus A-3 LAMPIRAN B Program pada Mikrokontroller AVR Atmega16...B-1 Program pada Borlan Delhpi 7.0...B-9 PROGRAM UTAMA /*****************************************************
More informationLAMPIRAN A. Listing Program. Program pada Borland Delphi 7.0 A-1 Program pada CodeVisionAVR C Compiler A-6
A Listing Program Program pada Borland Delphi 7.0 A-1 Program pada CodeVisionAVR C Compiler A-6 LISTING PROGRAM BORLAND DELPHI 7.0 Inisialisasi ==========================================================
More informationSet of pulse decoding algorithms for quadrature rotary and linear encoders*
version 1.2 Set of pulse decoding algorithms for quadrature rotary and linear encoders* (*) Algorithms are likely platform nonindependent in performance comparison. However results are based to the Atmel
More informationLAMPIRAN - A. Instruksi Mikrokontroler
LAMPIRAN - A Instruksi Mikrokontroler /***************************************************** This program was produced by the CodeWizardAVR V1.25.3 Professional Automatic Program Generator Copyright 1998-2007
More information8-bit Microcontroller. Application Note. AVR033: Getting Started with the CodeVisionAVR C Compiler
AVR033: Getting Started with the CodeVisionAVR C Compiler Features Installing and Configuring CodeVisionAVR to Work with the Atmel STK500 Starter Kit and AVR Studio Debugger Creating a New Project Using
More information8-bit Microcontroller. Application Note. AVR033: Getting Started with the CodeVisionAVR C Compiler
AVR033: Getting Started with the CodeVisionAVR C Compiler Features Installing and Configuring CodeVisionAVR to Work with the Atmel STK500 Starter Kit and AVR Studio Debugger Creating a New Project Using
More informationJ. Basic. Appl. Sci. Res., 3(2s) , , TextRoad Publication
2013, TextRoad Publication ISSN 2090-4304 Journal of Basic and Applied Scientific Research www.textroad.com Designing and Construction of the Transceiver System by Using a New Generation of Telecommunication
More informationLAMPIRAN A FOTO ROBOT BERKAKI ENAM
LAMPIRAN A FOTO ROBOT BERKAKI ENAM A-1 A-2 LAMPIRAN B PROGRAM PADA PENGONTROL ATMEGA16 DAN ATTINY2313 B-1 1. Robot mampu berjalan sesuai dengan langkah dan arah yang dimasukkan melalui keypad. ATMEGA16
More informationLampiran I. Rangkaian Lengkap Alat. Universitas Sumatera Utara
Lampiran I Rangkaian Lengkap Alat Lampiran II Program Pada Alat /***************************************************** This program was produced by the CodeWizardAVR V2.04.9 Evaluation Automatic Program
More informationProject : Version : Date : 11/04/2016 Author : Freeware, for evaluation and non-commercial use only Company : Comments:
Lampiran 1 Listing program dari seluruh sistem. /***************************************************** This program was produced by the CodeWizardAVR V2.04.9 Evaluation Automatic Program Generator Copyright
More informationHow2Use DT-AVR ATMEGA168 BMS. By: IE Team. Picture 1 The layout of DT-AVR ATMEGA168 BMS
DT-AVR ATMEGA168 BMS Application Note By: IE Team This Application Note (AN) serves as a tutorial of how to use the DT-AVR ATMEGA168 Bootloader Micro System along with its supplementary software. The layout
More information// Voltage Reference: AREF pin #define ADC_VREF_TYPE ((0<<REFS1) (0<<REFS0) (0<<ADLAR))
44 Lampiran 1 Listing program dari seluruh sistem. /****************************************************** * This program was created by the CodeWizardAVR V3.12 Advanced Automatic Program Generator Copyright
More informationProgramming 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 informationECE477: Team 10 Software Design Considerations, Narrative, and Documentation
TABLE OF CONTENTS 1 INTRODUCTION...2 1.1 MASTER DEVICE...2 1.2 SLAVE (SITE) DEVICE...2 1.3 CONNECTING BUS...2 2 MASTER DEVICE...3 2.1 SOFTWARE DESIGN CONSIDERATIONS...3 2.1.1 Memory Considerations...3
More informationIntroduction 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 informationLAMPIRAN A GAMBAR SISTEM
LAMPIRAN A GAMBAR SISTEM SISTEM OBJEK TAMPAK DALAM SISTEM OBJEK TAMPAK LUAR SISTEM PENERIMA LAMPIRAN B PROGRAM AVR ATMEGA 128 /***************************************************** Chip type : ATmega128L
More informationMICROPROCESSOR BASED SYSTEM DESIGN
MICROPROCESSOR BASED SYSTEM DESIGN Lecture 5 Xmega 128 B1: Architecture MUHAMMAD AMIR YOUSAF VON NEUMAN ARCHITECTURE CPU Memory Execution unit ALU Registers Both data and instructions at the same system
More informationINTERRUPTS in microprocessor systems
INTERRUPTS in microprocessor systems Microcontroller Power Supply clock fx (Central Proccesor Unit) CPU Reset Hardware Interrupts system IRQ Internal address bus Internal data bus Internal control bus
More informationSerial Compact Flash Serial CF Card Module User Manual
CUBLOC Peripheral Serial Compact Flash Serial Card Module User Manual 3. Specifications Model -COM5 -COM3 Voltage 4.5~5.5V 2.7~5.5V - 115200 bps: 20KB/s - 115200 bps: 15KB/s Read Speed - 9600 bps: 6KB/s
More informationTopic 11: Interrupts ISMAIL ARIFFIN FKE UTM SKUDAI JOHOR
Topic 11: Interrupts ISMAIL ARIFFIN FKE UTM SKUDAI JOHOR Objectives To become familiar with interrupts on the AVR Maskable and non-maskable Initialization Triggers To develop interrupt service routines
More informationARDUINO MEGA INTRODUCTION
ARDUINO MEGA INTRODUCTION The Arduino MEGA 2560 is designed for projects that require more I/O llines, more sketch memory and more RAM. With 54 digital I/O pins, 16 analog inputs so it is suitable for
More informationThe Atmel ATmega328P Microcontroller
Ming Hsieh Department of Electrical Engineering EE 459Lx - Embedded Systems Design Laboratory 1 Introduction The Atmel ATmega328P Microcontroller by Allan G. Weber This document is a short introduction
More informationLAMPIRAN A. Universitas Sumatera Utara
LAMPIRAN A Program CODEVISIONAVR Untuk program mikrokontroler pada Robot /***************************************************** Date : 8/24/2014 Chip type : ATmega16 Program type : Application AVR Core
More informationFinal Design Report. Team Name: No Rest for the Weary
EEL 4924 Electrical Engineering Design (Senior Design) Final Design Report 4 August 2009 Project Title: SLEEP Team Name: No Rest for the Weary Team Members: Renard Sumlar lrsum825@ufl.edu Brad Bromlow
More informationIntroduction to the MC9S12 Hardware Subsystems
Setting and clearing bits in C Using pointers in C o Program to count the number of negative numbers in an area of memory Introduction to the MC9S12 Hardware Subsystems o The MC9S12 timer subsystem Operators
More informationThe Atmel ATmega168A Microcontroller
Ming Hsieh Department of Electrical Engineering EE 459Lx - Embedded Systems Design Laboratory The Atmel ATmega168A Microcontroller by Allan G. Weber 1 Introduction The Atmel ATmega168A is one member of
More informationCN310 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 informationHow2Use DT-AVR ATMEGA128L BMS. Oleh: IE Team. Picture 1 The layout of DT-AVR ATMEGA128L BMS
DT-AVR ATMEGA128L BMS Application Note Oleh: IE Team This Application Note (AN) serves as a tutorial of how to use the DT-AVR ATMEGA128L Bootloader Micro System along with its supplementary software. The
More informationUniversitas Sumatera Utara
55 Lampiran 1. Konfigurasi Program Menghitung Data Komputer (Bahasa C) pada Mikro /******************************************************* This program was created by the CodeWizardAVR V2.60 Standard Automatic
More information,$5$SSOLFDWLRQ1RWH$95 (IILFLHQWSURJUDPPLQJRI$WPHO V $95 PLFURFRQWUROOHUV
,$5$SSOLFDWLRQ1RWH$95 (IILFLHQWSURJUDPPLQJRI$WPHO V $95 PLFURFRQWUROOHUV 6XPPDU\ This application note provides some useful hints on how to program the Atmel AVR microcontrollers using the IAR Compiler.
More informationLampiran. Universitas Sumatera Utara
Lampiran LISTING PROGRAM #include #include // Declare your global variables here char buff[16]; unsigned int frekuensi,x; unsigned int detak; // External Interrupt 0 service routine
More informationLecture 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 informationVLSI Design Lab., Konkuk Univ. Yong Beom Cho LSI Design Lab
AVR Training Board-I V., Konkuk Univ. Yong Beom Cho ybcho@konkuk.ac.kr What is microcontroller A microcontroller is a small, low-cost computeron-a-chip which usually includes: An 8 or 16 bit microprocessor
More information12.1. Unit 12. Exceptions & Interrupts
12.1 Unit 12 Exceptions & Interrupts 12.2 Disclaimer 1 This is just an introduction to the topic of interrupts. You are not meant to master these right now but just start to use them We will cover more
More informationRobosoft 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 informationEmbedded 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 informationINTERFACING 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 informationAN703. Micro64/128. Accessing the 36k of SRAM 12/3/04
AN703 Micro64/128 Accessing the 36k of SRAM 12/3/04 Introduction: Micro64/128 has a total of 36k of SRAM. 4 k of SRAM is built into the processor an additional 32k of SRAM is available inside the Micro64/128
More informationAVR Training Board-I. VLSI Design Lab., Konkuk Univ. LSI Design Lab
AVR Training Board-I V., Konkuk Univ. Tae Pyeong Kim What is microcontroller A microcontroller is a small, low-cost computeron-a-chip which usually includes: An 8 or 16 bit microprocessor (CPU). A small
More informationMarten van Dijk Department of Electrical & Computer Engineering University of Connecticut
ECE3411 Fall 2016 Wrap Up Review Session Marten van Dijk Department of Electrical & Computer Engineering University of Connecticut Email: marten.van_dijk@uconn.edu Slides are copied from Lecture 7b, ECE3411
More informationLecture 2. Introduction to Microcontrollers
Lecture 2 Introduction to Microcontrollers 1 Microcontrollers Microcontroller CPU + ++++++++++ Microprocessor CPU (on single chip) 2 What is a Microcontroller Integrated chip that typically contains integrated
More informationArduino 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 informationLAMPIRAN. Universitas Sumatera Utara
LAMPIRAN 35 Features 2. High-performance, Low-power AVR 8-bit Microcontroller 3. Advanced RISC Architecture 131 Powerful Instructions Most Single-clock Cycle Execution 32 x 8 General Purpose Working Registers
More informationAVR Microcontrollers Architecture
ก ก There are two fundamental architectures to access memory 1. Von Neumann Architecture 2. Harvard Architecture 2 1 Harvard Architecture The term originated from the Harvard Mark 1 relay-based computer,
More information8-bit Microcontroller with 4K Bytes of In-System Programmable Flash AT90S4433 AT90LS4433. Features. Not Recommend for New Designs. Use ATmega8.
Features High-performance and Low-power AVR 8-bit RISC Architecture 118 Powerful Instructions Most Single Cycle Execution 32 x 8 General Purpose Working Registers Up to 8 MIPS Throughput at 8 MHz Data
More informationMarten van Dijk, Syed Kamran Haider
ECE3411 Fall 2015 Wrap Up Review Session Marten van Dijk, Syed Kamran Haider Department of Electrical & Computer Engineering University of Connecticut Email: vandijk, syed.haider@engr.uconn.edu Pulse Width
More informationWinford Engineering ETH32 Protocol Reference
Winford Engineering ETH32 Protocol Reference Table of Contents 1 1 Overview 1 Connection 1 General Structure 2 Communications Summary 2 Port Numbers 4 No-reply Commands 4 Set Port Value 4 Set Port Direction
More informationEmbedded Systems and Software
Embedded Systems and Software Lab 6 Considerations Lab 6 Considerations, Slide 1 Big Picture Connect to internal ADC + 0-5 V - Sensor To COM port on PC LCD RTC Optional: LCD display Lab 6 Considerations,
More information8-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 informationInterrupts and timers
Applied mechatronics, Lab project Interrupts and timers Sven Gestegård Robertz Department of Computer Science, Lund University 2018 Outline 1 Interrupts Interrupt types Execution of an interrupt Maskable
More informationW.E.S.L.E.Y. Waste Eliminating System for Lazy Engineering Youths. Final Report December 9, 2003 John Mercado
Waste Eliminating System for Lazy Engineering Youths Final Report December 9, 2003 John Mercado Table of Contents: Abstract... 3 Executive Summary... 3 Introduction... 3 Integrated Systems... 4 Mobile
More informationAutomatic Gate Prototype Based on Microcontroller of Atmel ATMega16
Journal of Electrical Technology UMY (JET-UMY), Vol. 1, No. 2, June 2017 ISSN 2550-1186 e-issn 2580-6823 Automatic Gate Prototype Based on Microcontroller of Atmel ATMega16 Anna Nur Nazilah Chamim *1,
More information#include <avr/io.h> #include <avr/interrupt.h> #define F_CPU UL // 8 MHz.h> #include <util/delay.h>
#include #include #define F_CPU 8000000UL // 8 MHz.h> #include unsigned char buttonpressed; int tempout; int tempin; int realtempout; int realtempin; int maxalarm;
More informationEE 308 Spring A software delay. To enter a software delay, put in a nested loop, just like in assembly.
More on Programming the 9S12 in C Huang Sections 5.2 through 5.4 Introduction to the MC9S12 Hardware Subsystems Huang Sections 8.2-8.6 ECT_16B8C Block User Guide A summary of MC9S12 hardware subsystems
More informationECE 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 informationATmega 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 informationET-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 informationAVR- M16 development board Users Manual
AVR- M16 development board Users Manual All boards produced by Olimex are ROHS compliant Rev. C, January 2005 Copyright(c) 2009, OLIMEX Ltd, All rights reserved Page1 INTRODUCTION AVR-M16 is header board
More informationFIFTH SEMESTER DIPLOMA EXAMINATION IN ENGINEERING/ TECHNOLOGY-MARCH 2014 EMBEDDED SYSTEMS (Common for CT,CM) [Time: 3 hours] (Maximum marks : 100)
(Revision-10) FIFTH SEMESTER DIPLOMA EXAMINATION IN ENGINEERING/ TECHNOLOGY-MARCH 2014 EMBEDDED SYSTEMS (Common for CT,CM) [Time: 3 hours] (Maximum marks : 100) PART-A (Maximum marks : 10) I. Answer all
More informationUBC104 Embedded Systems. Review: Introduction to Microcontrollers
UBC104 Embedded Systems Review: Introduction to Microcontrollers Processors General purpose processors: 80386 Pentium Core Duo Large number of pins External memory External peripherals * Figure from Intel
More informationINTERRUPT, TIMER/COUNTER. KONKUK UNIV. VLSI Design Lab. LSI Design Lab
INTERRUPT, TIMER/COUNTER KONKUK UNIV. V. 1 INTERRUPT 의개요 외부의요구에의해서현재실행중인프로그램을일시중지하고보다시급한작업을먼저수행한후다시원래의프로그램으로복귀하는것. EX) 스타를하다가택배가오면스타를일시중지하고택배를받은후다시스타를진행함. Interrupt 방식 : 택배아저씨가초인종을눌러줌. Polling 방식 : 택배아저씨가오는지일정시간간격으로살펴봄.
More informationUse a semaphore to avoid the enqueue and dequeue functions from accessing and modifying count variable at the same time.
Goal: In this project you will create an OS-driven multitasking device than can capture data at precise intervals, buffer the data to EEPROM, and send data over a serial interface to a computer, while
More informationLab 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 information8-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 information8-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 informationSECURE DIGITAL ACCESS SYSTEM USING IBUTTON
SECURE DIGITAL ACCESS SYSTEM USING IBUTTON Access control forms a vital link in a security chain. Here we describe a secure digital access system using ibutton that allows only authorised persons to access
More informationADC: Analog to Digital Conversion
ECE3411 Fall 2015 Lecture 5b. ADC: Analog to Digital Conversion Marten van Dijk, Syed Kamran Haider Department of Electrical & Computer Engineering University of Connecticut Email: {vandijk, syed.haider}@engr.uconn.edu
More informationAVR XMEGA TM. A New Reference for 8/16-bit Microcontrollers. Ingar Fredriksen AVR Product Marketing Director
AVR XMEGA TM A New Reference for 8/16-bit Microcontrollers Ingar Fredriksen AVR Product Marketing Director Kristian Saether AVR Product Marketing Manager Atmel AVR Success Through Innovation First Flash
More informationADC: Analog to Digital Conversion
ECE3411 Fall 2015 Lecture 5a. ADC: Analog to Digital Conversion Marten van Dijk, Syed Kamran Haider Department of Electrical & Computer Engineering University of Connecticut Email: {vandijk, syed.haider}@engr.uconn.edu
More informationEmbedded Systems and Software
Embedded Systems and Software Lecture 11 Interrupts Interrupts Slide 1 Interrupts One way to think of interrupts is that they are hardwaregenerated functions calls Internal Hardware When timer rolls over,
More informationBurglar Alarm Final Report
Burglar Alarm Submitted By: Brandon Maciel, Linda Thompson, Bradford Savage ETEE3255 Lab VII Instructor: Barry Sherlock Date Due: November 18 th, 2010 Abstract 1 The purpose of this project was to design,
More information8-bit Microcontroller with 4K/8K bytes In-System Programmable Flash AT90S4414 AT90S8515. Features. Pin Configurations
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 informationADSmartIO Driver Specification for Windows CE
Version: 1.0 ADS document #110110-4004A Last Saved: 12/21/00 2:51 PM Applied Data Systems Inc. 9140 Guilford Road, Columbia, MD 21046 301-490-4007 Driver Change Log Version Release # Date By Changes Draft
More informationFundamental concept in computation Interrupt execution of a program to handle an event
Interrupts Fundamental concept in computation Interrupt execution of a program to handle an event Don t have to rely on program relinquishing control Can code program without worrying about others Issues
More informationImplementing In-Application Programming on the ADuC702x
Implementing In-Application Programming on the ADuC702x By Johnson Jiao [Johnson.Jiao@analog.com] and Raven Xue [Raven.Xue@analog.com] Background The ADuC702x Precision Analog Microcontroller provides
More information8-bit Microcontroller with 8K Bytes In-System Programmable Flash. ATmega8515 ATmega8515L. Features
Features High-performance, Low-power AVR 8-bit Microcontroller RISC Architecture 130 Powerful Instructions Most Single Clock Cycle Execution 32 x 8 General Purpose Working Registers Fully Static Operation
More informationSquareWear Programming Reference 1.0 Oct 10, 2012
Content: 1. Overview 2. Basic Data Types 3. Pin Functions 4. main() and initsquarewear() 5. Digital Input/Output 6. Analog Input/PWM Output 7. Timing, Delay, Reset, and Sleep 8. USB Serial Functions 9.
More informationLAMPIRAN A. I. Gambar alat percobaan I.1. Power supply. 1. Rangkaian sekunder 2. Dioda. 3. Heatsink 4. Power supply (keseluruhan)
100 I. Gambar alat percobaan I.1. Power supply LAMPIRAN A 1. Rangkaian sekunder 2. Dioda 3. Heatsink 4. Power supply (keseluruhan) 101 I.2 Gambar bagian bagian alat pemanas induksi 1. Kumparan Solenoide
More informationWEATHER STATION WITH SERIAL COMMUNICATION
WEATHER STATION WITH SERIAL COMMUNICATION Written by: Wenbo Ye, Xiao Qu, Carl-Wilhelm Igelström FACULTY OF ENGINEERING, LTH Digital and Analogue Projects EITF11 Contents Introduction... 2 Requirements...
More informationCOMP2121: Microprocessors and Interfacing
Lecture 19: Interrupts II http://www.cse.unsw.edu.au/~cs2121 Lecturer: Hui Wu Session 1, 2006 Overview AVR Interrupts Interrupt Vector Table System Reset Watchdog Timer Timer/Counter0 Interrupt Service
More informationProcessor and compiler dependent
Fundamental concept in computation Interrupt execution of a program to handle an event Don t have to rely on program relinquishing control Can code program without worrying about others Issues What can
More information8-bit Microcontroller with 8K Bytes In-System Programmable Flash AT90S8515
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 informationDigital and Analogue Project Report
EITF 040 Digital and Analogue Project Report Group 6 Fida Saidani Qinghua Liu March, 2013 1 Abstract The aim of this project is to build an electronic device that makes use of the law of light reflection,
More information8-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// filename pwm.c // ATtiny84 (14 pin DIP)
// stepper motor driver for spectrometer // with manual speed and direction input // and adjustable scan speed and direction // stepper motor driver set to 32usteps/step (32Hz clk = 1 step/sec) // filename
More informationIntroduction 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 informationRobotics Training Module ABLab Solutions
Robotics Training Module ABLab Solutions www.ablab.in Table of Contents Course Outline... 4 Introduction to Robotics... 4 Overview of Basic Electronic... 4 Overview of Digital Electronic... 4 Power Supply...
More informationAN5123 Application note
Application note STSPIN32F0A - bootloader and USART protocol Introduction Cristiana Scaramel The STSPIN32F0A is a system-in-package providing an integrated solution suitable for driving three-phase BLDC
More informationInterrupt vectors for the 68HC912B32. The interrupt vectors for the MC9S12DP256 are located in memory from 0xFF80 to 0xFFFF.
Interrupts The Real Time Interrupt Interrupt vectors for the 68HC912B32 The interrupt vectors for the MC9S12DP256 are located in memory from 0xFF80 to 0xFFFF. These vectors are programmed into Flash EEPROM
More information