Microcontroller FundamentalsLearning ObjectivesMicrocomputer ArchitectureComponents of a MicrocontrollerATmega16 MicrocontrollerAtmel STK500STK500 LEDPORT header pins on the STK500Need to jumper pin header to LEDsTurning off an LED on the STK500Turning on an LED on the STK500STK500 SwitchBinary and Hexadecimal Numbers - 1Binary and Hexadecimal Numbers - 2Binary and Hexadecimal Numbers - 3Binary and Hexadecimal Numbers - 4Binary and Hexadecimal Numbers - 5Binary and Hexadecimal Numbers - 6Microcontroller FundamentalsB. Furman07SEP2010Learning Objectives Explain the general architecture of a microcontroller List the key features of the ATmega16 microcontroller Explain the features and elements on the STK500 Explain how the switches and LEDs on the STK500 are driven Explain the concepts of microcontroller pins as inputs and outputs Convert between binary and hexadecimal digitsMicrocomputer Architecturehttp://www.engr.colostate.edu/~dga/mechatronics/figures/7-1.gif CPUComponents of a Microcontrollerhttp://www.engr.colostate.edu/~dga/mechatronics/figures/7-2.gifATmega16 MicrocontrollerPin numberPin nameSpecial functionSource: http://www.atmel.com/dyn/resources/prod_documents/doc2466.pdfNote the limitations!p. 291Atmel STK500Source: http://www.rfsource.gr/product/micro/STK500/stk500_en.htmUniversal Evaluation Board for Atmel AVR MicrocontrollersMomentary switches(8 ea.)LED (8 ea.)Ports A-Eheader pinsPrimaryRS-232LED header pinsSpareRS-232switch header pinsSTK500 LEDSource: http://www.atmel.com/dyn/resources/prod_documents/doc1925.pdf+5VPORT header pins on the STK500 ATmega16 pins come out to “header” pins+5VATmega16PORTx header pinNeed to jumper pin header to LEDs You will add a “jumper” wire to connect header pin to LED pins+5V“jumper” wireATmega16PORTx header pinLEDn header pinTurning off an LED on the STK500 Writing bits to the PORTxregister will affect the voltage on the pins: A “1” puts VTG(=5V) on the pin LED is OFF+5V“jumper” wirePORTx registerATmega16PORTx header pinLEDn header pinVTG= +5V01OffTurning on an LED on the STK500 Writing bits to the PORTxregister will affect the voltage on the pins: A “0” puts GND on the pin LED is ON+5V“jumper” wirePORTx registerATmega16PORTx header pinLEDn header pinVTG= +5V01OnSTK500 SwitchSource: http://www.atmel.com/dyn/resources/prod_documents/doc1925.pdfBinary and Hexadecimal Numbers - 1 Microcontrollers are fundamentally digital (as opposed to ‘analog’) and use binarylogic Two states: high and low, 1 or 0, on or off Often 5V or 0V One binary digit is called a bit It can take on two possible states: 1 or 0 Eight binary digits is called a byte Four binary digits is called a nibbleBinary and Hexadecimal Numbers - 21100110176543210Bit No.Lower nibble(4 bits)Upper nibble(4 bits)LSB(Least Significant Bit)MSB(Most Significant Bit)Binary and Hexadecimal Numbers - 31138Base 10113883010010001081031011010123=+++×+×+×+×1101Base 2131048212021210123=+++×+×+×+×Base 10Place ValueQuestion: What is the MAXIMUM value (base 10 decimal) that can be represented by 4 bits?Binary and Hexadecimal Numbers - 4000 0 0000 1 1001 0 2001 1 3010 0 4010 1 5011 0 6011 1 7100 0 8100 1 9101 0 A101 1 B110 0 C110 1 D111 0 E111 1 FHEXBinary DecimalFill out the tablePractice• 0xFF in binary• 0x0A in binary• 0xD5 in binary• 0x1B in decimalBinary and Hexadecimal Numbers - 5000 000000 111001 022001 133010 044010 155011 066011 177100 088100 199101 010A101 111B110 012C110 113D111 014E111 115FHEXBinary DecimalFill out the tablePractice• 0xFF in binary1 1 1 1|1 1 1 1• 0x0A in binary0 0 0 0|1 0 1 0• 0xD5 in binary1 1 0 1|0 1 0 1• 0x1B in decimal1x24+ 1x23+0x22+1x21+1x20=27Binary and Hexadecimal Numbers - 6000 000000 111001 022001 133010 044010 155011 066011 177100 088100 199101 010A101 111B110 012C110 113D111 014E111 115FHEXBinary Decimal• 10 bits can represent how many different
View Full Document