ECED3204: Microprocessor Part III--Clock, I/O and Interrupt

Size: px
Start display at page:

Download "ECED3204: Microprocessor Part III--Clock, I/O and Interrupt"

Transcription

1 ECED3204: Microprocessor Part III--Clock, I/O and Interrupt Jason J. Gu Department of 1 Outline i. Part III.1 System Clock Configuration ii. Part III.2 Parallel I/O iii. Part III.3 Interrupt Handling, Resets, and Power Management iv. Part III.4 Advanced Parallel I/O 2 1

2 Part III.1 System Clock Configuration 3 Outline i. Overview of System Clock Generation ii. The Clock System of the AVR Mega Devices iii. System Clock Prescaler 4 2

3 Overview of System Clock Generation Clock signal Time delays are dependent on accurate system clock frequency MCU includes complex circuitry that generates and distributes clock signals to every peripheral module Devices used to generate clock signal: ceramic resonators, crystal oscillators, and RC circuits Frequency division: using count down counter Frequency multiplication: phase lock loop (PLL) 5 The Clock System of the AVR Mega Devices Clock distribution of AVR Mega devices: illustrated in Figure 6 3

4 Clock Distribution of AVR Mega Devices (cont d.) CPU clock(clk_cpu): used with AVR core operation I/O clock(clk_i/o): used with I/O modules Flash clock(clk_flash): controls flash memory interface Asynchronous clock (clk_asy): allows asynchronous timer/counter to be clocked directly from an external clock or an external 32 khz clock crystal ADC (clk_adc) clock: provides an operation clock required by the ADC module 7 The Clock System of the AVR Mega Devices (cont d.) Table 7.1 Mega device clocking options select 8 4

5 The Clock System of the AVR Mega Devices (cont d.) Default clock source: calibrated internal RC oscillator 1.0 MHz system clock External clock: used to generate clock signals required by all the modules Square wave with stable frequency When as external clock source is used, it is connected to XTAL1, XTAL2 is unconnected. 9 The Clock System of the AVR Mega Devices (cont d.) Watchdog oscillator: circuit used to detect software errors; derived from the on-chip 128 khz RC oscillator Low-frequency oscillator: khz watch oscillator that can serve as the clock source The crystal should be connected as shown in figure 10 5

6 The Clock System of the AVR Mega Devices (cont d.) Timer/counter oscillator: can be operated from an external khz watch crystal or an external clock source System clock prescaler Clock source selected by the clock multiplexer: further divided by the system clock prescaler 11 System Clock Prescaler (cont d.) Possible prescaling factor: chosen by the CLKPR register CKDIV8 fuse determines the initial value of the CLKPS bits CKDIV8 unprogrammed, CLKPS=0000, otherwise 0011 CKDIV8 : can be programmed using AVR Studio IDE 12 6

7 Part III.2 Parallel I/O 13 Outline i. Introduction to I/O PORTs ii. I/O Pin Driving Circuit Structure iii. Electrical Characteristic Consideration for I/O Interfacing iv. Overview of the AVR Mega Parallel PORTs v. Simple I/O Devices vi. Interfacing with a D/A Converter 14 7

8 I/O Introduction to I/O PORTs I/O Port: consists of a group of pins and a set of registers including data registers (or latch), data direction register, and control register(s) (optional) I/O addressing issue: shared or distinct from memory components Address space: currently I/O devices and memory components share the same address space. Addressing modes and instructions 15 I/O Introduction to I/O PORTs AVR Mega devices have dedicated I/O space that contains 64 locations from 0x20 to 0x5F using following instructions: 16 8

9 I/O Introduction to I/O PORTs AVR Mega640 has more than 64 I/O An extended I/O space from 0x60 to 0x1FF is added. only accessed using LD/LDS/LDD and ST/STS/STD 17 I/O Introduction to I/O PORTs (cont d.) I/O synchronization: communication with peripheral devices via interface chips Synchronization between the processor and the interface chip Synchronization between interface chip and peripheral devices Synchronization issue for parallel PORTs Not an issue for today s microcontrollers 18 9

10 I/O Introduction to I/O PORTs (cont d.) Synchronization issue for serial interface Polling or the interrupt method used to make sure that the new I/O operation can be started Achieved by following certain data transfer protocols USART,SPI,I2C, will be covered later. 19 I/O Pin Driving Circuit Structure Totem pole: pin is driven high or low, according to the corresponding bit setting in the OUT register Totem pole with pull-down Totem pole with pull-up Figure 8.1 Totem pole block diagram 20 10

11 I/O Pin Driving Circuit Structure 21 I/O Pin Driving Circuit Structure (cont d.) Bus keeper Pin is kept at its logic level when the pin is no longer driven to any logic state 22 11

12 I/O Pin Driving Circuit Structure (cont d.) Wired-OR Pin is driven high when the corresponding bit in the OUT register is written to 1 When OUT register is set to 0, corresponding pin is not driven and can be pulled low with the internal or an external pull-resistor 23 I/O Pin Driving Circuit Structure (cont d.) Wired-AND Pin is driven low when the corresponding bit in the OUT register is written to 0 When OUTn is set to 1, the Pn pin is released, allowing the pin to be pulled high 24 12

13 Electrical Characteristic Consideration for I/O Interfacing Voltage-level compatibility: due to differing IC technologies Input high voltage (V IH ) Input low voltage (V IL ) Output high voltage (V OH ) Output low voltage (V OL ) For X to drive Y V OHX >=V IHY V OLX <=V ILY 25 Electrical Characteristic Consideration for I/O Interfacing 26 13

14 Electrical Characteristic Consideration for I/O Interfacing (cont d.) Current drive capability Whether the microcontroller can supply (when the output voltage is high, also called source) or sink (when the output voltage is low) the current needed by the I/O devices that it interfaces with Input high current (I IH ), flowing in, input V high Input low current (I IL ), flowing out, input V low Output high current (I OH ), flowing out, output V high Output low current (I OL ), flowing in, output V low 27 Electrical Characteristic Consideration for I/O Interfacing (cont d.) Timing compatibility Main consideration is that the setup- and hold-time requirements for all latches and flip-flops in a digital system must be satisfied 28 14

15 Overview of the AVR Mega Parallel PORTs AVR Mega MCU may have 11 parallel ports Note: No PORT I 29 Overview of the AVR Mega Parallel PORTs Configuring the mega I/O pins DDxn bit in the DDRx register selects the direction of the Pxn pin Toggling the mega I/O pin SBI instruction can be used to perform this operation 30 15

16 Overview of the AVR Mega Parallel PORTs example: Instruction sequence to output the value 0x53 to Port A. ldi r16,0xff ; configure Port A for output out DDRA,r16 ; ldi r16,0x53 ; output the value of 0x53 to Port A out PORTA,r16; // C code DDRA = 0xFF; configure Port A for output PORTA = 0x53; output the value of 0x53 to Port A 31 Overview of the AVR Mega Parallel PORTs (cont d.) Reading the pin value PORT pin can be read through the PINxn bit of the PINx register Unconnected pins Simplest method to ensure a defined level of an unused pin is to enable the internal pull-up Alternate PORT functions Refer to Tables 8.4 through

17 Overview of the AVR Mega Parallel PORTs example: Instruction sequence to input the value to Port A, store in r20 ldi r16,0x00 ; configure Port A for input out DDRA,r16 ; in r20, PINA ; input the value from port A to r20 // C code DDRA = 0x00; configure Port A for input r20 = PINA; input the value from port A to r20 33 Overview of the AVR Mega Parallel PORTs (cont d.) Alternate PORT functions Refer to Tables 8.4 through

18 Overview of the AVR Mega Parallel PORTs (cont d.) Alternate PORT functions Refer to Tables 8.4 through Overview of the AVR Mega Parallel PORTs (cont d.) Alternate PORT functions Refer to Tables 8.4 through

19 Overview of the AVR Mega Parallel PORTs (cont d.) Alternate PORT functions Refer to Tables 8.4 through Overview of the AVR Mega Parallel PORTs (cont d.) Alternate PORT functions Refer to Tables 8.4 through

20 Overview of the AVR Mega Parallel PORTs (cont d.) Alternate PORT functions Refer to Tables 8.4 through Overview of the AVR Mega Parallel PORTs (cont d.) Alternate PORT functions Refer to Tables 8.4 through

21 Overview of the AVR Mega Parallel PORTs (cont d.) Alternate PORT functions Refer to Tables 8.4 through Overview of the AVR Mega Parallel PORTs (cont d.) Alternate PORT functions Refer to Tables 8.4 through

22 Overview of the AVR Mega Parallel PORTs (cont d.) Alternate PORT functions Refer to Tables 8.4 through Overview of the AVR Mega Parallel PORTs (cont d.) Alternate PORT functions Refer to Tables 8.4 through

23 Simple I/O Devices Interfacing with LEDs: indicates the system operation mode 45 Simple I/O Devices Interfacing with LEDs: indicates the system operation mode example: flash all led for every 500ms #include <avr/io.h> #include <util/delay.h> int main(void) { DDRK = 1<<0; while(1) { PORTK = 0x00; _delay_ms(500); PORTK = 1<<0; _delay_ms(500); } } 46 23

24 Simple I/O Devices Interfacing with seven-segment displays: used for decimal digits and a small subset of letters 47 Simple I/O Devices Interfacing with seven-segment displays: decoder 48 24

25 Simple I/O Devices Interfacing with seven-segment displays: used for decimal digits and a small subset of letters Display #5 to 0 following pattern for 600ms repeated: Seven Segment Display Example.include "atxmega128a1def.inc".def rowcnt = r26.def digcnt = r27.def repcnt = r28.cseg.org 0x00 rjmp start.org 0xF6 start: ldi r16,low(ramend) out CPU_SPL,r16 ; SPL for MEGA ldi r16,high(ramend) out CPU_SPH,r16 ; SPH for MEGA call setcpuclkto32mwith16mcrystal ldi r16, 0xFF sts PORTA_DIR, r16 sts PORTB_DIR,r16 forever: ldi ZL,low(segTable << 1) ldi ZH,high(segTable << 1) ldi rowcnt,10 ; there are ten rows in segtable rowlp: ldi repcnt,100 ; a row in segtable must be repeated for 100 times replp: ldi digcnt,6 ; each row has six digits 50 25

26 Seven Segment Display Example diglp: lpm r16,z+ sts PORTA_OUT,r16 ; output segment pattern lpm r16,z+ sts PORTB_OUT,r16 ; output digit select ldi r16,1 call delayby1ms dec digcnt brne diglp ; reach the end of a sequence? subi ZL,12 ; reset segment pattern pointer to the start of a sequence sbci ZH,0 ; " dec repcnt ; repeat 100 times? brne replp dec rowcnt brne rowlp jmp forever 51 Seven Segment Display Example. segtable:.db 0x30,0xDF,0x6D,0xEF,0x79,0xF7,0x33,0xFB,0x5B,0xFD,0x5F,0xFE.db 0x6D,0xDF,0x79,0xEF,0x33,0xF7,0x5B,0xFB,0x5F,0xFD,0x70,0xFE.db 0x79,0xDF,0x33,0xEF,0x5B,0xF7,0x5F,0xFB,0x70,0xFD,0x7F,0xFE.db 0x33,0xDF,0x5B,0xEF,0x5F,0xF7,0x70,0xFB,0x7F,0xFD,0x7B,0xFE.db 0x5B,0xDF,0x5F,0xEF,0x70,0xF7,0x7F,0xFB,0x7B,0xFD,0x7E,0xFE.db 0x5F,0xDF,0x70,0xEF,0x7F,0xF7,0x7B,0xFB,0x7E,0xFD,0x30,0xFE.db 0x70,0xDF,0x7F,0xEF,0x7B,0xF7,0x7E,0xFB,0x30,0xFD,0x6D,0xFE.db 0x7F,0xDF,0x7B,0xEF,0x7E,0xF7,0x30,0xFB,0x6D,0xFD,0x79,0xFE.db 0x7B,0xDF,0x7E,0xEF,0x30,0xF7,0x6D,0xFB,0x79,0xFD,0x33,0xFE.db 0x7E,0xDF,0x30,0xEF,0x6D,0xF7,0x79,0xFB,0x33,0xFD,0x5B,0xFE.include "sysclock_xmega.asm".include "delays_xmega.asm" 52 26

27 Seven Segment Display Example The C language version of the program is as follows: #include <avr/io.h> #include "delays_xmega.h" #include "sysclock_xmega.h" #define ROWS 10 #define REPCNT 100 #define DIGITS 6 unsigned char segtable[10][12] = { {0x30,0xDF,0x6D,0xEF,0x79,0xF7,0x33,0xFB,0x5B,0xFD,0x5F,0xFE}, {0x6D,0xDF,0x79,0xEF,0x33,0xF7,0x5B,0xFB,0x5F,0xFD,0x70,0xFE}, }; {0x79,0xDF,0x33,0xEF,0x5B,0xF7,0x5F,0xFB,0x70,0xFD,0x7F,0xFE}, {0x33,0xDF,0x5B,0xEF,0x5F,0xF7,0x70,0xFB,0x7F,0xFD,0x7B,0xFE}, {0x5B,0xDF,0x5F,0xEF,0x70,0xF7,0x7F,0xFB,0x7B,0xFD,0x7E,0xFE}, {0x5F,0xDF,0x70,0xEF,0x7F,0xF7,0x7B,0xFB,0x7E,0xFD,0x30,0xFE}, {0x70,0xDF,0x7F,0xEF,0x7B,0xF7,0x7E,0xFB,0x30,0xFD,0x6D,0xFE}, {0x7F,0xDF,0x7B,0xEF,0x7E,0xF7,0x30,0xFB,0x6D,0xFD,0x79,0xFE}, {0x7B,0xDF,0x7E,0xEF,0x30,0xF7,0x6D,0xFB,0x79,0xFD,0x33,0xFE}, {0x7E,0xDF,0x30,0xEF,0x6D,0xF7,0x79,0xFB,0x33,0xFD,0x5B,0xFE} 53 Seven Segment Display Example int main(void) { unsigned char k1, k2, k3; setcpuclkto32mwith16mcrystal(); PORTA_DIR = 0xFF; // configure Port A for output, PORTA= 0xFF for MEGA PORTB_DIR = 0xFF; // configure Port B for output to drive digit select while(1) { for(k1 = 0; k1 < ROWS; k1++) for(k2 = 0; k2 < REPCNT; k2++) for(k3 = 0; k3 < DIGITS; k3++) { PORTA_OUT = segtable[k1][k3*2]; PORTB_OUT = segtable[k1][k3*2+1]; delayby1ms(1); } } } 54 27

28 Simple I/O Devices (cont d.) Generating a digital waveform using an I/O pin: I/O voltage level manipulated and an appropriate delay (equal to half of the waveform period) inserted between the two voltage levels Making a sound using an I/O pin Create a frequency in audible range with pin connected to a speaker 55 Simple I/O Devices (cont d.) Interfacing with DIP switches: INPUT // code for MEGA ldi r16,0x00 ; input out DDRJ,r16 ; in r20, PINJ ;to r20 // C code for MEGA DDRJ = 0x00; for input r20 = PINJ;to r

29 Interfacing with a D/A Converter Important DAC characteristics Resolution Conversion time Number of channels Input format 57 Interfacing with a D/A Converter The AD7302 DAC: dual-channel, 8-bit, DAC chip from Analog Devices that has a parallel interface with the microcontroller Vout=2*VREF*N/

30 Interfacing with a D/A Converter (cont d.) Figure 8.22 Circuit connection between the AD7302 and the Mega D/A Converter example Use figure 8.22 assembly program to generate a triangular wave from VoutA pin and sine wave from the VoutB pin, assuming that the MEGA2560 is running with an 8 MHz crystal oscillator. Divide both waveforms into 50 points per period 60 30

31 D/A Converter example Solution: To divide 360 into 50 points, then the sine waveform starts from 0 o to o and repeats. Since there is no negative value in the sine waveform, we need to use the following equation to calculate the voltage corresponding to x o : Voltage= 5/2 * [sine(x) + 1] To generate this voltage, we need to send the following value to the DAC: N = (sine x + 1) * 255 / 2 For example, we need to send 127 (or 128) to DAC to generate the sine wave value at 0 o. 61 D/A Converter example.include <m2560def.inc>.def lpcnt = r26.equ NN = 100.cseg.org 0x00 rjmp start.org 0xF6 start: ldi r16,low(ramend) out SPL,r16 ldi r16,high(ramend) out SPH,r16 ldi r16,0xff ; configure PORTA for output sts DDRA,r16 ; " sts DDRB,r16 ; configure PORTB for output forever: ldi ZL,low(waveforms << 1) ; use Z as a pointer to the table ldi ZH,high(waveforms << 1) ; " ldi lpcnt,nn 62 31

32 D/A Converter example loop: cbi PORTB,1 ; select channel A cbi PORTB,0 ; enable data write to DAC lpm r16,z+ ; output data to be converted to voltage out PORTA,r16 ; " sbi PORTB,0 ; pull WR high to start DAC sbi PORTB,1 ; select channel B cbi PORTB,0 ; enable data write to DAC lpm r16,z+ ; output data to be converted to voltage out PORTA,r16 ; " sbi PORTB,0 ; start DAC nop ; insert time to allow DAC complete nop ; conversion nop nop dec lpcnt ; reach the end of waveform table? brne loop rjmp forever 63 D/A Converter example ; ; Values to generate the triangular and sine waves are stored alternately in the same ; table to simplify data access. ; waveforms:.db 0,128,10,143,20,159,31,174,41,189,51,202,61,215,71,226,82,235,92,243.db 102,249,112,253,122,255,133,255,143,253,153,249,163,243,173,235.db 184,226,194,215,204,202,214,189,224,174,235,159,245,143,255,128.db 245,112,235,96,224,81,214,66,204,53,194,40,184,29,173,20,163,12,153,6.db 143,2,133,0,122,0,112,2,102,6,92,12,82,20,71,29,61,40,51,53.db 41,66,31,81,20,96,10,

33 Part III.3 Interrupt Handling, Resets, and Power Management 65 Outline i. Basic Concepts on Interrupt ii. Resets iii. The AVR Mega Interrupts iv. AVR Mega Reset v. AVR Mega Watchdog Timer vi. Power Management and Sleep Modes 66 33

34 Basic Concepts on Interrupt Interrupt: asynchronous signal indicating the need for attention, or a synchronous event in software indicating the need for a change in execution Hardware interrupt: state of execution saved; execution of an interrupt handler (interrupt service routine) begins Software interrupt: implemented as instructions in the instruction set 67 Basic Concepts on Interrupt (cont d.) Why interrupt is useful I/O operations Example: polling to determine data availability for data in or data our, CPU time is wasted. Using interrupt can prevent that Routine tasks Example: updating/redisplaying time of day, using timer interrupts. Response to emergent events Examples: fire alarm, power failure, or overheat 68 34

35 Basic Concepts on Interrupt (cont d.) Enabling and disabling interrupts Maskable interrupt (can be disabled) vs. nonmaskable interrupt Prioritizing multiple interrupts: how to handle several interrupts pending at same time Servicing the interrupt CPU executes interrupt service routine and then resumes the interrupted program note: The last instruction of an interrupt service routine must be return from interrupt (RETI) 69 Basic Concepts on Interrupt (cont d.) The interrupt vector: starting address of the interrupt service routine Stored in a fixed location in the interrupt vector table Writing an Interrupt-driven program Step 1: Initialization of interrupt vector table (no need for MEGA MCU) Step 2: Write the service routine Step 3: Enable interrupts 70 35

36 Resets Power-up reset: all critical registers, the program counters, and flip-flops are forced to a default value Other reset sources: manual reset, brown-out reset, watchdog reset, clock monitor reset, software reset, etc. 71 The AVR Mega Interrupts Categories of interrupt sources Internal peripheral interrupts External pin interrupts (INT0-INT7) Pin change interrupts (PCINT0-PCINT2) AVR Mega device interrupt vectors ATMega640/1280/2560: 100-pin Mega devices See Table

37 The AVR Mega Interrupts 73 The AVR Mega Interrupts 74 37

38 The AVR Mega Reset and Interrupt Vectors Placement 75 The AVR Mega Interrupts (cont d.) The Mega AVR microcontroller configuration register (MCUCR): controls interrupt vectors placement; controls enabling of I/O pins pull-up and the JTAG interface 76 38

39 The AVR Mega Interrupts (cont d.) Special instruction to change the IVSEL bit In r16,mcucr Mov r17,r16 Ori r16,(1<<ivce) ; set the IVCE bit Out MCUCR,r16 Ori r17,(1<<ivsel) ; set the IVSEL bit and clear the IVCE bit Out MCUCR,r17 Instruction in C Unsigned char temp; Temp = MCUCR; MCUCR = temp (1<<IVCE); //sets the IVCE MCUCR = temp (1<<IVSEL); //sets IVSEL & clear IVCE 77 The AVR Mega Interrupts (cont d.) AVR Mega external interrupt pins INT7:0 pins trigger interrupt requests to the MCU; pins shared with PORTD (0-3) and E (4-7), controlled by EICRA and EICRB register

40 The AVR Mega Interrupts (cont d.) 79 The AVR Mega Interrupts (cont d.) EIMSK to enable the interrupt and EIFR to flag the interrupt

41 The AVR Mega Interrupts : example Example: Write an instruction sequence to enable INT0 and INT1 interrupt. INT0 on rise edge and INT1 on falling edge. 81 The AVR Mega Interrupts : example.include <m644adef.inc>.def tmp = r16.cseg.org 0x00 jmp start jmp INT0_Vect.org 0xF6 Start: ldi tmp, low(ramend) out SPL,tmp ldi tmp, high(ramend) out SPH, tmp lds tmp,ddrd ; configure PD0/INT0, PD1/INT1 for input andi tmp,0xfc sts DDRD,tmp ldi tmp, 0x0B sts EICRA, tmp ; //INT0 on rising edge, INT1 on falling edge ldi tmp,0x03 ; " sts EIMSK,tmp ; // enable INT0,INT1 sei again: jmp again ;// loop INT0_Vect: nop reti Code in Assembling,compiled 82 41

42 The AVR Mega Interrupts : example #include <avr\io.h> #include <avr\interrupt.h> unsigned char cnt; int main (void) { DDRD &= 0xFC ; //configure PD0/INT0, PD1/INT1 for input EICRA =0x0B ; //INT0 on rising edge, INT1 on falling edge EIMSK =0x03 ; // enable INT0,INT1 sei(); cnt =0; while(1); //wait for interrupt } // INT0 interrupt ISR(INT0_vect) { cnt++; } // INT1 interrupt ISR(INT1_vect) { cnt++; } Code in C (compiled) 83 The AVR Mega Interrupts (cont d.) Pin change interrupt ATMega640/1280/2560 has 24 pins (PCINT23~0) that generate interrupt whenever one or more of these pins toggle, PCINT23-16 pin toggles will trigger PCINT2; PCINT15-8 pin toggles will trigger PCINT1; PCINT7-0 pin toggles will trigger PCINT0; PCICR register enable three pin change interrupts PCIFR flag the interrupts PCMSK2,1,0 control the enabling and disabling 24 pins 84 42

43 The AVR Mega Interrupts (cont d.) 85 The AVR Mega Interrupts (cont d.) 86 43

44 The AVR Mega Interrupts (cont d.) 87 The AVR Mega Interrupts (cont d.) Writing interrupt service routine in C for AVR Mega devices 88 44

45 The AVR Mega Interrupts (cont d.) Interrupt service routine format required by AVR Studio C compiler ISR (vector number of the interrupt) {... } Symbolic names of all interrupt vector numbers and interrupt vectors have been defined in the appropriate header file (C lang.) and include file (assembly lang.) 89 The AVR Mega Interrupts : example Example: Write a sequence of C statements to configure PCINT0, PCINT1, PCINT4, PCINT8, PCINT9, PCINT14, PCINT18, PCINT20, and PCINT23 to interrupt the MEGA CPU. Solution: #include <avr\io.h> #include <avr\interrupt.h> unsigned char cnt; int main(void) { PCMSK2 = 0x94; // enable PCINT23, PCINT20, and PCINT18, PCMSK1 = 0x43; // enable PCINT14, PCINT9, and PCINT8, PCMSK0 = 0x13; // enable PCINT4, PCINT1, and PCINT0, PCICR = 0x07; // enable interrupts PCINT2~PCINT0, sei(); // enable interrupt globally cnt=0; while(1); } ISR(PCINT0_vect) { cnt++; } code in assembling?? 90 45

46 The AVR Mega Interrupts (cont d.) 91 AVR Mega Reset Power-on reset: supply voltage is below the power-on reset threshold (V POT ) External reset: low level is present on the RESET pin for longer than the minimum pulse width Brown-out reset: supply voltage V CC is lower than the brown-out reset threshold (V BOT ) and the brown out detector is enabled 92 46

47 AVR Mega Reset (cont d.) JTAG AVR reset: while logic 1 exists in the reset register Watchdog reset: watchdog timer overflows and the watchdog is enabled Reset service routine finds out the cause of reset by examining the MCU status register (MCUSR) 93 AVR Mega Reset (cont d.) 94 47

48 AVR Mega Watchdog Timer Derives its clock signal from an on-chip 128 khz oscillator Triggers an interrupt or reset when the counter overflows Timing out is prevented by executing the WDR instruction to restart the WDT 95 AVR Mega Watchdog Timer 96 48

49 AVR Mega Watchdog Timer 97 AVR Mega Watchdog Timer Practice in assignment 98 49

50 Power Management and Sleep Modes Mega sleep modes IDLE mode ADC noise reduction mode Power-down mode Power-save mode Standby mode Extended standby mode Power reduction register 99 Power Management and Sleep Modes

51 Power Management and Sleep Modes ldi r16,0x0f;extended standby sts SMCR,r16 sleep SMCR = 0x0F; _asm volatile_( sleep ); 101 Power Reduction Modes Configure PRR0 & PRR1 register to disable the clock to some modules

52 Power Reduction Modes Configure PRR0 103 Power Reduction Modes Configure PRR

53 Part III.4 Advanced Parallel I/O 105 Outline i. Interfacing a Parallel PORT to a Keypad ii. Driving the Stepper Motor iii. Direct Memory Access (DMA) Transfer iv. Liquid Crystal Displays (LCDs)

54 Interfacing a Parallel PORT to a Keypad Keypad: arranged as an array of switches (mechanical, membrane, capacitive, or Hall effect construction) Mechanical keypads Advantages: low cost and construction strength Disadvantage: contact bounce 107 Interfacing a Parallel PORT to a Keypad (cont d.) Keypad input program stages Keypad Scanning: performed row by row and column by column Keyboard Debouncing Hardware debouncing techniques Set-reset latches Noninverting CMOS buffer with high input impedance Integrated debouncers

55 Interfacing a Parallel PORT to a Keypad (cont d.) Hardware debouncing techniques 109 Interfacing a Parallel PORT to a Keypad (cont d.)

56 Interfacing a Parallel PORT to a Keypad (cont d.) Keypad input program stages (cont d.) Keyboard debouncing Software debouncing techniques Wait-and-see: adequate for most applications ASCII code lookup: can be embedded in the program that performs the scanning and debouncing Keypad interfacing and coding will be used in lab3 111 Driving the Stepper Motor Stepper motors: digital motors Convenient for applications where a high degree of positional control is required Principles of rotation Clockwise full-step rotation Counterclockwise full-step rotation

57 Driving the Stepper Motor Clockwise fullstep rotation Counterclock wise full-step rotation (reverse the polarities of C3,C4) 113 Driving the Stepper Motor Half-step operation: rotor (in a four-pole step) is moved to eight discrete positions (45 degrees)

58 Driving the Stepper Motor (cont d.) Discrete stepper motor drivers See Figure 10.8 Driving a stepper motor Transistors: switch the current to each of the coils Fly-back diodes: protect the transistors from reverse bias Transistor loads: windings in the stepper motor Windings: inductors, storing energy as magnetic field Integrated stepper motor driver Darlington array chip ULN2003: replacement to discrete transistors 115 Driving the Stepper Motor (cont d.)

59 Driving the Stepper Motor (cont d.) 117 Driving the Stepper Motor (cont d.)

60 Driving the Stepper Motor (cont d.) Integrated stepper motor driver Darlington array chip ULN2003: replacement to discrete transistors 119 Driving the Stepper Motor (cont d.) Write subroutine to rotate the motor sent the data to PORTA in sequence straight forward see text example

61 Direct Memory Access (DMA) Transfer Data transfer in which the CPU is responsible for setup; CPU not involved during the data transfer phase MEGA AVU 8 bit doesn t have DMA MEGA 32 bit has DMA XMega has DMA controller brief introduction 121 Direct Memory Access (DMA) Transfer (cont d.) DMA registers Control register (CTRL) Status register (STATUS) Interrupt flag register (INTFLAGS) 16-bit temporary register (TEMP): controls the overall operation DMA channel operation: supported by it own set of registers

62 Direct Memory Access (DMA) Transfer (cont d.) 123 Direct Memory Access (DMA) Transfer (cont d.)

63 Direct Memory Access (DMA) Transfer (cont d.) 125 Direct Memory Access (DMA) Transfer (cont d.) Table 10.4 DMA channel register summary

64 Direct Memory Access (DMA) Transfer (cont d.) Example: Write a sequence of C statements to configure the DMA transfer from channel A of the Timer/Counter1 associated with Port F and data memory starting from 0x2000. Solution: DMA.CTRL = DMA_ENABLE_bm; // enable DMA DMA.CH0.CTRLA = DMA_CH_ENABLE_bm; // enable DMA channel 0 DMA.CH0.CTRLA = 0x81; // set DMA channel 0 burst length to 2 bytes DMA.CH0.ADDRCTRL = 0x91; // source reload on burst, destination no reload DMA.CH0.TRIGSRC = DMA_CH_TRIGSRC_TCC0_CCA_gc; DMA.CH0.TRFCNT = 1024; DMA.CH0.SRCADDR0 = (uint32_t)((uint16_t)(&tcc1.cca)) & 0xFF; DMA.CH0.SRCADDR1 = (uint32_t)(((uint16_t)(&tcc1.cca))>>8) & 0xFF; DMA.CH0.SRCADDR2 = (uint32_t)(((uint16_t)(&tcc1.cca))>>16) & 0xFF; DMA.CH0.DESTADDR0 = 0; DMA.CH0.DESTADDR1 = 0x20; DMA.CH0.DESTADDR2 = 0; while(!(dma.ch0.ctrlb & DMA_CH_TRNIF_bm)); // wait for DMA transfer to complete 127 Liquid Crystal Displays (LCDs) Advantages High contrast Low power consumption Small footprint Ability to display both characters and graphics

65 Figure A liquid crystal display (LCD) 129 The HD44780 LCD Controller Figure Block diagram of a HD44780-based LCD kit

66 The HD44780 LCD Controller (cont d.) Display data RAM (DDRAM) Stores display data represented in 8-bit character codes Extended capacity is 80 x 8 bits (80 characters) Character generator ROM (CGROM) Generates 5 x 8- or 5 x10-dot character patterns from 8-bit character codes 131 The HD44780 LCD Controller (cont d.) Character generator RAM (CGRAM) Permits user to define his or her own character fonts LCD controller registers Instruction register (IR): stores instruction codes Data register (DR): data written into the DR register are automatically written into the DDRAM or the CGRAM by an internal operation

67 The HD44780 LCD Controller (cont d.) Instructions Clear display Return home Entry mode set Cursor or display shift Function set Set CGRAM address Set DDRAM address Read busy flag and address 133 The HD44780 LCD Controller (cont d.)

68 The HD44780 LCD Controller (cont d.) 135 The HD44780 LCD Controller (cont d.) Note: for 2 line, and 4 line refer to text

69 The HD44780 LCD Controller (cont d.) Note: over 80 characters refer to text 137 The HD44780 LCD Controller (cont d.)

70 The HD44780 LCD Controller (cont d.) Interfacing the HD44780 to the AVR microcontroller Data transfer between the HD44780 and the Atmel AVR can be done in 4 bits or 8 bits at a time Choice of using I/O PORTs to interface with the LCD module or treating the LCD as a memory device 139 The HD44780 LCD Controller (cont d.)

71 The HD44780 LCD Controller (cont d.) 141 The HD44780 LCD Controller (cont d.) LCD Startup Sequence: Power on Wait 30 ms Execute function set instruction Wait 40 ms Execute display control instruction Wait 40 ms Execute display clear instruction Wait 1.64 ms Execute entry mode set instruction Wait 40 ms OK See Figure next slide

72 The HD44780 LCD Controller (cont d.) 143 The HD44780 LCD Controller (cont d.) Writing LCD programs Example: Procedure for sending a command to the IR register Step 1: Pull the RS and the E signals to low Step 2: Pull the R/W signal to low Step 3: Pull the E signal to high

73 Example: Procedure for sending a command to the IR register (cont d.) Step 4: Output the given LCD instruction to the I/O PORT attached to the LCD data bus; the I/O PORT connected to the LCD data bus must be configured for output before this can be done Step 5: Pull the E signal to low, and make sure that the internal operation is completed; this is achieved by calling a delay subroutine Refer to Examples 10.4 through The HD44780 LCD Controller (Examples) All kinds utility in Asm for LCD lcdutil_xmega.asm All kinds utility in C for LCD lcdutil_xmega_c Display two line message in C for LCD eg10_08c C head file lcdutil_xmega_h C test file lcdtest.c

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

Input/Output Devices. Lecturer: Sri Parameswaran Notes by: Annie Guo

Input/Output Devices. Lecturer: Sri Parameswaran Notes by: Annie Guo Input/Output Devices Lecturer: Sri Parameswaran Notes by: Annie Guo 1 Lecture Overview Input devices Input switches Basics of switches Keypads Output devices LCD 2 Input Switches Most basic binary input

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

COMP2121: Microprocessors and Interfacing

COMP2121: 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 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

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

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

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

AVR Microcontrollers Architecture

AVR 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 information

Interrupts (II) Lecturer: Sri Parameswaran Notes by: Annie Guo

Interrupts (II) Lecturer: Sri Parameswaran Notes by: Annie Guo Interrupts (II) Lecturer: Sri Parameswaran Notes by: Annie Guo 1 External Interrupts The external interrupts are triggered by the INT7:0 pins. If enabled, the interrupts will trigger even if the INT7:0

More information

Microprocessors & Interfacing

Microprocessors & Interfacing Lecture Overview Microprocessors & Interfacing Input/Output Devices Input devices Input switches Basics of switches Keypads Output devices LCD Lecturer : Dr. Annie Guo S2, 2008 COMP9032 Week8 1 S2, 2008

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

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

INTERRUPTS in microprocessor systems

INTERRUPTS 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 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 7 Interrupts Author: Paweł Russek http://www.fpga.agh.edu.pl/upt ver. 25/05/16 1/11 1. Introduction

More information

ECED 3204 Microprocessor Midterm Reference Solution

ECED 3204 Microprocessor Midterm Reference Solution ECED 3204 Microprocessor Midterm Reference Solution Date: October 26 2017 Time: 7:00pm-9:00pm Room: B225, B227, B229 Student name ID 1) Problem one has following two sub problems: a. Write an instruction

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

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 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 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 7 Interrupts Author: Paweł Russek http://www.fpga.agh.edu.pl/upt ver. 01/07/14 1/12 1. Introduction

More information

INTERRUPT, TIMER/COUNTER. KONKUK UNIV. VLSI Design Lab. LSI Design Lab

INTERRUPT, TIMER/COUNTER. KONKUK UNIV. VLSI Design Lab. LSI Design Lab INTERRUPT, TIMER/COUNTER KONKUK UNIV. V. 1 INTERRUPT 의개요 외부의요구에의해서현재실행중인프로그램을일시중지하고보다시급한작업을먼저수행한후다시원래의프로그램으로복귀하는것. EX) 스타를하다가택배가오면스타를일시중지하고택배를받은후다시스타를진행함. Interrupt 방식 : 택배아저씨가초인종을눌러줌. Polling 방식 : 택배아저씨가오는지일정시간간격으로살펴봄.

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

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

VCC PB2 (SCK/ADC1/T0/PCINT2) PB1 (MISO/AIN1/OC0B/INT0/PCINT1) PB0 (MOSI/AIN0/OC0A/PCINT0)

VCC PB2 (SCK/ADC1/T0/PCINT2) PB1 (MISO/AIN1/OC0B/INT0/PCINT1) PB0 (MOSI/AIN0/OC0A/PCINT0) Features High Performance, Low Power AVR 8-Bit Microcontroller Advanced RISC Architecture 120 Powerful Instructions Most Single Clock Cycle Execution 32 x 8 General Purpose Working Registers Fully Static

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

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

8-bit Microcontroller with 1K Byte Flash. ATtiny11. ATtiny12

8-bit Microcontroller with 1K Byte Flash. ATtiny11. ATtiny12 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 Up

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

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

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

AVR XMEGA Product Line Introduction AVR XMEGA TM. Product Introduction.

AVR XMEGA Product Line Introduction AVR XMEGA TM. Product Introduction. AVR XMEGA TM Product Introduction 32-bit AVR UC3 AVR Flash Microcontrollers The highest performance AVR in the world 8/16-bit AVR XMEGA Peripheral Performance 8-bit megaavr The world s most successful

More information

AVR 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 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 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

Microcontroller basics

Microcontroller basics FYS3240 PC-based instrumentation and microcontrollers Microcontroller basics Spring 2017 Lecture #4 Bekkeng, 30.01.2017 Lab: AVR Studio Microcontrollers can be programmed using Assembly or C language In

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

AVR42772: Data Logger Demo Application on XMEGA A1U Xplained Pro. Introduction. Features. AVR XMEGA Microcontrollers APPLICATION NOTE

AVR42772: Data Logger Demo Application on XMEGA A1U Xplained Pro. Introduction. Features. AVR XMEGA Microcontrollers APPLICATION NOTE AVR XMEGA Microcontrollers AVR42772: Data Logger Demo Application on XMEGA A1U Xplained Pro APPLICATION NOTE Introduction This application note covers some of the power saving features of the Atmel XMEGA

More information

Clock and Fuses. Prof. Prabhat Ranjan Dhirubhai Ambani Institute of Information and Communication Technology, Gandhinagar

Clock and Fuses. Prof. Prabhat Ranjan Dhirubhai Ambani Institute of Information and Communication Technology, Gandhinagar Clock and Fuses Prof. Prabhat Ranjan Dhirubhai Ambani Institute of Information and Communication Technology, Gandhinagar Reference WHY YOU NEED A CLOCK SOURCE - COLIN O FLYNN avrfreaks.net http://en.wikibooks.org/wiki/atmel_avr

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

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

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

MICROPROCESSOR BASED SYSTEM DESIGN

MICROPROCESSOR 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 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

acret Ameya Centre for Robotics & Embedded Technology Syllabus for Diploma in Embedded Systems (Total Eight Modules-4 Months -320 Hrs.

acret Ameya Centre for Robotics & Embedded Technology Syllabus for Diploma in Embedded Systems (Total Eight Modules-4 Months -320 Hrs. acret Ameya Centre for Robotics & Embedded Technology Syllabus for Diploma in Embedded Systems (Total Eight Modules-4 Months -320 Hrs.) Module 0 Introduction Introduction to Embedded Systems, Real Time

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

PIC Microcontroller Introduction

PIC Microcontroller Introduction PIC Microcontroller Introduction The real name of this microcontroller is PICmicro (Peripheral Interface Controller), but it is better known as PIC. Its first ancestor was designed in 1975 by General Instruments.

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

SANKALCHAND PATEL COLLEGE OF ENGINEERING, VISNAGAR. ELECTRONICS & COMMUNICATION DEPARTMENT Question Bank- 1

SANKALCHAND PATEL COLLEGE OF ENGINEERING, VISNAGAR. ELECTRONICS & COMMUNICATION DEPARTMENT Question Bank- 1 SANKALCHAND PATEL COLLEGE OF ENGINEERING, VISNAGAR ELECTRONICS & COMMUNICATION DEPARTMENT Question Bank- 1 Subject: Microcontroller and Interfacing (151001) Class: B.E.Sem V (EC-I & II) Q-1 Explain RISC

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

ATmega128. Introduction

ATmega128. Introduction ATmega128 Introduction AVR Microcontroller 8-bit microcontroller released in 1997 by Atmel which was founded in 1984. The AVR architecture was conceived by two students (Alf-Egil Bogen, Vergard-Wollen)

More information

Embedded Systems and Software

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

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

2. (2 pts) If an external clock is used, which pin of the 8051 should it be connected to?

2. (2 pts) If an external clock is used, which pin of the 8051 should it be connected to? ECE3710 Exam 2. Name _ Spring 2013. 5 pages. 102 points, but scored out of 100. You may use any non-living resource to complete this exam. Any hint of cheating will result in a 0. Part 1 Short Answer 1.

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

Microcontroller and Embedded Systems:

Microcontroller and Embedded Systems: Microcontroller and Embedded Systems: Branches: 1. Electronics & Telecommunication Engineering 2. Electrical & Electronics Engineering Semester: 6 th Semester / 7 th Semester 1. Explain the differences

More information

8-bit Microcontroller. Application Note. AVR134: Real-Time Clock (RTC) using the Asynchronous Timer. Features. Theory of Operation.

8-bit Microcontroller. Application Note. AVR134: Real-Time Clock (RTC) using the Asynchronous Timer. Features. Theory of Operation. AVR134: Real-Time Clock (RTC) using the Asynchronous Timer Features Real-Time Clock with Very Low Power Consumption (4µA @ 3.3V) Very Low Cost Solution Adjustable Prescaler to Adjust Precision Counts Time,

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

M68HC08 Microcontroller The MC68HC908GP32. General Description. MCU Block Diagram CPU08 1

M68HC08 Microcontroller The MC68HC908GP32. General Description. MCU Block Diagram CPU08 1 M68HC08 Microcontroller The MC68HC908GP32 Babak Kia Adjunct Professor Boston University College of Engineering Email: bkia -at- bu.edu ENG SC757 - Advanced Microprocessor Design General Description The

More information

8. Power Management and Sleep Modes

8. Power Management and Sleep Modes 8. Power Management and Sleep Modes 8.1 Features Power management for adjusting power consumption and functions Five sleep modes Idle Power down Power save Standby Extended standby Power reduction register

More information

Understanding the basic building blocks of a microcontroller device in general. Knows the terminologies like embedded and external memory devices,

Understanding the basic building blocks of a microcontroller device in general. Knows the terminologies like embedded and external memory devices, Understanding the basic building blocks of a microcontroller device in general. Knows the terminologies like embedded and external memory devices, CISC and RISC processors etc. Knows the architecture and

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

FIFTH SEMESTER DIPLOMA EXAMINATION IN ENGINEERING/ TECHNOLOGY-MARCH 2014 EMBEDDED SYSTEMS (Common for CT,CM) [Time: 3 hours] (Maximum marks : 100)

FIFTH 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 information

Timers and Interrupts. Mark Neil - Microprocessor Course

Timers and Interrupts. Mark Neil - Microprocessor Course Timers and Interrupts 1 Example Product: Signal Generator A Signal Generator should be programmable. A user can use the the LCD display and the keyboard to change the: Frequency scale Amplitude scale Offset

More information

8-bit Microcontroller with 4K/8K bytes In-System Programmable Flash AT90S4414 AT90S8515. Features. Pin Configurations

8-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 information

Interrupts and timers

Interrupts 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 information

8-bit Microcontroller with 8K Bytes In-System Programmable Flash AT90S8515

8-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 information

AVR Training Board-I. VLSI Design Lab., Konkuk Univ. LSI Design Lab

AVR 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 information

VLSI Design Lab., Konkuk Univ. Yong Beom Cho LSI Design Lab

VLSI 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 information

DEV-1 HamStack Development Board

DEV-1 HamStack Development Board Sierra Radio Systems DEV-1 HamStack Development Board Reference Manual Version 1.0 Contents Introduction Hardware Compiler overview Program structure Code examples Sample projects For more information,

More information

The Atmel ATmega328P Microcontroller

The 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 information

Introduction to Microcontroller Apps for Amateur Radio Projects Using the HamStack Platform.

Introduction to Microcontroller Apps for Amateur Radio Projects Using the HamStack Platform. Introduction to Microcontroller Apps for Amateur Radio Projects Using the HamStack Platform www.sierraradio.net www.hamstack.com Topics Introduction Hardware options Software development HamStack project

More information

Mega128-DEVelopment Board Progressive Resources LLC 4105 Vincennes Road Indianapolis, IN (317) (317) FAX

Mega128-DEVelopment Board Progressive Resources LLC 4105 Vincennes Road Indianapolis, IN (317) (317) FAX Mega128-DEVelopment Board Progressive Resources LLC 4105 Vincennes Road Indianapolis, IN 46268 (317) 471-1577 (317) 471-1580 FAX http://www.prllc.com GENERAL The Mega128-Development board is designed for

More information

EE 308: Microcontrollers

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

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

Chapter 9. Input/Output (I/O) Ports and Interfacing. Updated: 3/13/12

Chapter 9. Input/Output (I/O) Ports and Interfacing. Updated: 3/13/12 Chapter 9 Input/Output (I/O) Ports and Interfacing Updated: 3/13/12 Basic Concepts in I/O Interfacing and PIC18 I/O Ports (1 of 2) I/O devices (or peripherals) such as LEDs and keyboards are essential

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

8051 Microcontroller

8051 Microcontroller 8051 Microcontroller The 8051, Motorola and PIC families are the 3 leading sellers in the microcontroller market. The 8051 microcontroller was originally developed by Intel in the late 1970 s. Today many

More information

The Atmel ATmega168A Microcontroller

The 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 information

EMBEDDED SYSTEMS COURSE CURRICULUM

EMBEDDED SYSTEMS COURSE CURRICULUM On a Mission to Transform Talent EMBEDDED SYSTEMS COURSE CURRICULUM Table of Contents Module 1: Basic Electronics and PCB Software Overview (Duration: 1 Week)...2 Module 2: Embedded C Programming (Duration:

More information

Fredrick M. Cady. Assembly and С Programming forthefreescalehcs12 Microcontroller. шт.

Fredrick M. Cady. Assembly and С Programming forthefreescalehcs12 Microcontroller. шт. SECOND шт. Assembly and С Programming forthefreescalehcs12 Microcontroller Fredrick M. Cady Department of Electrical and Computer Engineering Montana State University New York Oxford Oxford University

More information

Microcomputer Architecture and Programming

Microcomputer Architecture and Programming IUST-EE (Chapter 1) Microcomputer Architecture and Programming 1 Outline Basic Blocks of Microcomputer Typical Microcomputer Architecture The Single-Chip Microprocessor Microprocessor vs. Microcontroller

More information

Diploma in Embedded Systems

Diploma in Embedded Systems Diploma in Embedded Systems Duration: 5 Months[5 days a week,3 hours a day, Total 300 hours] Module 1: 8051 Microcontroller in Assemble Language Characteristics of Embedded System Overview of 8051 Family

More information

ARDUINO MEGA INTRODUCTION

ARDUINO 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 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

;Compiler Options.NOLIST.INCLUDE "C:\Program Files (x86)\atmel\avr Tools\AvrAssembler2\Appnotes\m8515def.inc"

;Compiler Options.NOLIST.INCLUDE C:\Program Files (x86)\atmel\avr Tools\AvrAssembler2\Appnotes\m8515def.inc ;* CharTest.asm ;* ;* Created: 28/06/2017 9:37 p.m. ;* Author: ob1 ;ST7820 128 x 64 graphics mode character display 8 lines x 21 characters ;Modification and redistribution under provisions of GNU general

More information

TEVATRON TECHNOLOGIES PVT. LTD Embedded! Robotics! IoT! VLSI Design! Projects! Technical Consultancy! Education! STEM! Software!

TEVATRON TECHNOLOGIES PVT. LTD Embedded! Robotics! IoT! VLSI Design! Projects! Technical Consultancy! Education! STEM! Software! Summer Training 2016 Advance Embedded Systems Fast track of AVR and detailed working on STM32 ARM Processor with RTOS- Real Time Operating Systems Covering 1. Hands on Topics and Sessions Covered in Summer

More information

SH69P55A EVB. Application Note for SH69P55A EVB SH69P55A EVB SH69V55A

SH69P55A EVB. Application Note for SH69P55A EVB SH69P55A EVB SH69V55A Application Note for SH69P55A EVB SH69P55A EVB The SH69P55A EVB is used to evaluate the SH69P55A chip's function for the development of application program. It contains of a SH69V55A chip to evaluate the

More information

8-bit Microcontroller with 2/4/8K Bytes In-System Programmable Flash. ATtiny261/V ATtiny461/V ATtiny861/V. Preliminary

8-bit Microcontroller with 2/4/8K Bytes In-System Programmable Flash. ATtiny261/V ATtiny461/V ATtiny861/V. Preliminary Features High Performance, Low Power AVR 8-Bit Microcontroller Advanced RISC Architecture 123 Powerful Instructions Most Single Clock Cycle Execution 32 x 8 General Purpose Working Registers Fully Static

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

Microcontrollers. Fig. 1 gives a comparison of a microprocessor system and a microcontroller system.

Microcontrollers. Fig. 1 gives a comparison of a microprocessor system and a microcontroller system. Syllabus: : Introduction to, 8051 Microcontroller Architecture and an example of Microcontroller based stepper motor control system (only Block Diagram approach). (5 Hours) Introduction to A microcontroller

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

INTRO TO I/O INTERFACE

INTRO TO I/O INTERFACE Basic I/O Interface Introduction This chapter outlines some of the basic methods of communications, both serial and parallel, between humans or machines and the microprocessor. We first introduce the basic

More information

Question Bank Microprocessor and Microcontroller

Question Bank Microprocessor and Microcontroller QUESTION BANK - 2 PART A 1. What is cycle stealing? (K1-CO3) During any given bus cycle, one of the system components connected to the system bus is given control of the bus. This component is said to

More information

8-bit Microcontroller with 2/4/8K Bytes In-System Programmable Flash. ATtiny261 ATtiny461 ATtiny861. Automotive

8-bit Microcontroller with 2/4/8K Bytes In-System Programmable Flash. ATtiny261 ATtiny461 ATtiny861. Automotive Features High Performance, Low Power AVR 8-Bit Microcontroller Advanced RISC Architecture 123 Powerful Instructions Most Single Clock Cycle Execution 32 x 8 General Purpose Working Registers Fully Static

More information

8-bit Microcontroller with 1K Byte Flash. ATtiny15L

8-bit Microcontroller with 1K Byte Flash. ATtiny15L Features High-performance, Low-power AVR 8-bit Microcontroller Advanced RISC Architecture 90 Powerful Instructions Most Single Clock Cycle Execution 32 x 8 General Purpose Working Registers Fully Static

More information

Department of Electronics and Instrumentation Engineering Question Bank

Department of Electronics and Instrumentation Engineering Question Bank www.examquestionpaper.in Department of Electronics and Instrumentation Engineering Question Bank SUBJECT CODE / NAME: ET7102 / MICROCONTROLLER BASED SYSTEM DESIGN BRANCH : M.E. (C&I) YEAR / SEM : I / I

More information

SYLLABUS UNIT - I 8086/8088 ARCHITECTURE AND INSTRUCTION SET

SYLLABUS UNIT - I 8086/8088 ARCHITECTURE AND INSTRUCTION SET 1 SYLLABUS UNIT - I 8086/8088 ARCHITECTURE AND INSTRUCTION SET Intel 8086/8088 Architecture Segmented Memory, Minimum and Maximum Modes of Operation, Timing Diagram, Addressing Modes, Instruction Set,

More information

Mechatronics and Microcomputers. Stipendium Hungaricum 2018/2019 Autumn Semester Szilárd Aradi, PhD

Mechatronics and Microcomputers. Stipendium Hungaricum 2018/2019 Autumn Semester Szilárd Aradi, PhD Mechatronics and Microcomputers Stipendium Hungaricum 2018/2019 Autumn Semester Szilárd Aradi, PhD ATmega128 CPU Single-level pipelining Egyciklusú ALU működés Reg. reg., reg. konst. közötti műveletek

More information

Chapter 1. Microprocessor architecture ECE Dr. Mohamed Mahmoud.

Chapter 1. Microprocessor architecture ECE Dr. Mohamed Mahmoud. Chapter 1 Microprocessor architecture ECE 3130 Dr. Mohamed Mahmoud The slides are copyright protected. It is not permissible to use them without a permission from Dr Mahmoud http://www.cae.tntech.edu/~mmahmoud/

More information

8-bit XMEGA D Microcontroller XMEGA D MANUAL. Preliminary

8-bit XMEGA D Microcontroller XMEGA D MANUAL. Preliminary This document contains complete and detailed description of all modules included in the AVR XMEGA TM D Microcontroller family. The XMEGA D is a family of low power, high performance and peripheral rich

More information

EC 6504 MICROPROCESSOR AND MICROCONTROLLER

EC 6504 MICROPROCESSOR AND MICROCONTROLLER DEPARTMENTOFELECTRONICS&COMMUNICATIONENGINEERING EC 6504 MICROPROCESSOR AND MICROCONTROLLER UNIT I THE 8086 MICROPROCESSOR PARTA 1. What is microprocessor? What is the difference between a MP and CPU?

More information