DOC PREVIEW
UCSC CMPE 012 - Microcontrollers and Embedded Systems

This preview shows page 1-2-3-4-29-30-31-32-33-60-61-62-63 out of 63 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 63 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 63 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 63 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 63 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 63 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 63 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 63 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 63 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 63 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 63 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 63 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 63 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 63 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 63 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

CMPE12 Cyrus BazeghiFun with Motorola/Freescale HC11Microcontrollers and Embedded SystemsCMPE12 Cyrus Bazeghi2•A microprocessor•Usually not cutting edge•Dependable•All major bugs well known•Predictable•Critical for real-time processing•On-chip peripherals and memory•Parallel and serial digital I/O•Analog I/O•Counters and timers•Internal ROM and/or EPROMWhat is a microcontroller?CMPE12 Cyrus Bazeghi3What are microcontrollers used in?• Watches• Microwaves• Stereo ReceiversSome products that you might know:• NASA‟s Sojourner Rover – 8-bit Intel 80C85• Palm Vx handheld – 32-bit Motorola Dragonball EZ• Sonicare toothbrush – 8-bit Zilog Z8• The Vendo V-MAX 720 Soda Machine – Motorola HC11• Miele dishwasher – 8-bit Motorola 68HC05• Hunter 44550 Programmable Thermostat – (4-bit cpu)Microcontrollers • ATMs• PDA‟s, MP3 players• AutomobilesCMPE12 Cyrus Bazeghi4Microcontrollers Microcontroller unit sales are 15x higher than microprocessors.… and are MUCH, MUCH cheaper.CMPE12 Cyrus Bazeghi5Microcontrollers Microcontrollers are a large market•8-bit controllers are the largest, but not growing the fastest.CMPE12 Cyrus Bazeghi6Microcontrollers • 8-bit microcontroller growth rate for 2003 is at 9.42%.• Microcontroller growth rate in general is 11.5%.• 8-bit controllers loosing market share in 2003. Was 62.36% in 1998 down to 56.76% in 2003.Source: Cahners In-Stat GroupCMPE12 Cyrus Bazeghi7• 16- and 32-bit and higher are on the rise. They will double their unit market share from 15.11% in 1998 up to 31.56% in 2003, decreasing 4-bit and 8-bit devices.• But, in 2003, the 8-bit microcontrollers will outnumber the higher bit units by almost 80% in the market place.Source: Cahners In-Stat GroupMicrocontrollersCMPE12 Cyrus Bazeghi8Microcontrollers So what languages are they being programmed in?Language „98-‟99 „99-‟00Assembly ~ 21% ~ 10%C ~ 69% ~ 80%C++ ~ 5% ~ 6%Java ~ 1 % ~ 2%Other ~ 3 % ~ 2%Source: TRON Association Survey 1998/99 & 1999/2000CMPE12 Cyrus Bazeghi9•M6801 CPU core•ROM (8KB), EEPROM (512B), RAM (256B)•Counter/Timer system•A/D converter•D/A in kit•Parallel I/O•Serial I/O (SPI and SCI)•Expansion bus•To add more memoryMotorola/Freescale M68HC11CMPE12 Cyrus Bazeghi10HC11 Micro KitAC/DC Power adapterSerial cable to PCLCD DisplayLEDsSwitchesHC11 µCCMPE12 Cyrus Bazeghi11Design environment:•Edit the source file on an PC•Assemble on UNIX machine> “hc11build file.asm”•Download program to the PC with terminal program•Upload to the microkit using serial cableTo use kits at home•9-12V AC adapter•Serial download cable•Connection to ITS machines•Free serial communication software (e.g. TeraTerm)HC11 Micro KitCMPE12 Cyrus Bazeghi12Micro Kit Usage Always have “#include <v2_18g3.asm>” as part of your program, this file:•Sets up memory, including the stack pointer•Jumps to your “main” label•Also includes a basic library of I/O routines•Take a look at it!http://www.soe.ucsc.edu/classes/cmpe012/Fall09/In the handouts and links page under “HC11 Stuff”CMPE12 Cyrus Bazeghi13HC11 ArchitectureHC11CMPE12 Cyrus Bazeghi14M8601 CPU Core • 8-bit• CISC• Accumulator-based• Results wind up in a 8-bit accumulator A or B• 16-bit results go to accumulator AB, called D• Two index registers for addressing memory or for counting - X and Y• Dedicated stack pointer• Push and Pop instructions use this – grows toward smaller memory addresses like in LC-3• Program Counter• Condition CodesCMPE12 Cyrus Bazeghi15Check out the lab manual• It is online on the class website • Contains a section on the HC11• It is a great referenceAlso get the programmer reference guide, free at BELS (basement of BE)CMPE12 Cyrus Bazeghi16M8601 CPU Core ALU – Arithmetic Logic UnitCMPE12 Cyrus Bazeghi17HC11 MicrocontrollerCMPE12 Cyrus Bazeghi18•More present then in LC-3•Single-bit flags set appropriately for most instructions(several instructions do not, including push and pop)C Carry/BorrowV OverflowZ ZeroN NegativeH Half-CarryHC11 Microcontroller Condition CodesCMPE12 Cyrus Bazeghi19HC11 code What it doescmpa #4 Subtract AccA - 4, set CCRbge mylabel Branch if(CCR[Z]=1 OR CCR[N]=0)Example of how condition codes are usedHC11 MicrocontrollerCMPE12 Cyrus Bazeghi20HC11 Assembly Syntax• Have separate sections for data declarations and for instructions– Use “.sect .data” for data sections– Use “.sect .text” for instructions sections.• Have more data types– “.space” for array declarations– “.byte” declares just a byte– “.word” declares 16-bits also– “.asciz” declares a string of characters– “.ascii” declares a string, no NULL terminator • Comments use a “C++” style “//”CMPE12 Cyrus Bazeghi21Data Declaration Examples.sect .data myvar: .word 0x1000 // init a wordmyarray: .space 20 // 20 entriesmychar: .byte „a‟ // a charactermybyte: .byte 23 // DEC integermyhi: .asciz “Hi” // a stringmyhi2: .ascii “Hi” // a string.sect .text// Instructions would start here.// Can have many .text and .data sections.CMPE12 Cyrus Bazeghi22Bits set by the user to tell the processor how to dothingsI Interrupt MaskX XIRQ maskS Disable STOP instructionsHC11 Microcontroller Configuration RegistersCMPE12 Cyrus Bazeghi23Return to Addressing ModesAddressing Modes:LC-3 has:• PC-Relative• Base Displacement• IndirectHC11 has many: • Check opcode listings to see what modes work with what instructions• Also check what condition codes are setCMPE12 Cyrus Bazeghi24HC11 Addressing Modes•Immediate (IMM)•Extended (EXT)•Direct (DIR)•Indexed (INDX and INDY)•Inherent (INH)•Relative (REL)Supports these addressing modes:CMPE12 Cyrus Bazeghi25Immediate addressing• 1 or 2 byte immediate depending on register involved (LDAA vs. LDD)• ALWAYS include a #• Several formats for different bases -- C-style constants instead of what is in the HC11 manual (don‟t use !,$,@,%)•Decimal: LDAA #245•Hexadecimal: LDAA #0x61•Octal: LDAA #041•Binary: LDAA #0b11000011•ASCII: LDAA #‟a‟HC11 Addressing ModesCMPE12 Cyrus Bazeghi26• Access an absolute memory location• Essentially the same mode, but with 8-bit (direct)or 16-bit (enhanced or extended) addresses• The assembler will decide on which to use basedon how many bits are needed• Example// Your data starts at address


View Full Document

UCSC CMPE 012 - Microcontrollers and Embedded Systems

Download Microcontrollers and Embedded Systems
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Microcontrollers and Embedded Systems and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Microcontrollers and Embedded Systems 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?