Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
UBC104  Embedded Systems Microcontroller / 8051 family
Topics for Today <ul><li>Microcontrollers </li></ul><ul><li>Memory </li></ul><ul><li>Registers </li></ul><ul><li>Ports </l...
Processors <ul><li>General purpose processors: </li></ul><ul><ul><li>80386 </li></ul></ul><ul><ul><li>Pentium </li></ul></...
Functions of Pins <ul><li>Designed to be generic </li></ul><ul><li>Indented to move data around </li></ul>* Figure from In...
General Purpose Registers <ul><li>Registers are dedicated for moving data </li></ul><ul><ul><li>EAX, EBX, ECX, EDX: genera...
Pentium <ul><li>Bigger, </li></ul><ul><li>better, </li></ul><ul><li>more </li></ul>* Figure from Intel Pentium Datasheet
Microcontrollers <ul><li>Support for peripherals inside uController </li></ul><ul><li>Limited number of pins </li></ul><ul...
Microcontroller Families <ul><li>68H12: Motorola 68H11, 68HC12, … </li></ul><ul><li>8051:  Intel 8051, 8052, 80251,… </li>...
Rita51J <ul><li>8051 </li></ul><ul><li>128K of SRAM </li></ul><ul><li>128K FLASH ROM </li></ul><ul><li>Serial port  </li><...
Motes <ul><li>Sensor nodes based on Atmel ATMega128 </li></ul>* Figures from CrossbowMPR-MIBUser Manual
AT91SAM7P64 <ul><li>16/32 bit ARM7TDMI </li></ul><ul><li>64K Bytes Program Flash, 16K Bytes RAM,  </li></ul><ul><li>USB 2....
AT91SAM7P64 * Figure from www.olimex.com
Microcontroller Families <ul><li>68H12: Motorola 68H11, 68HC12, … </li></ul><ul><li>8051:  Intel 8051, 8052, 80251,… </li>...
8051 History <ul><li>Introduced 1980 </li></ul><ul><li>12 MHz </li></ul><ul><li>128  bytes  Internal RAM </li></ul><ul><li...
Typical features of modern 8051 <ul><li>32 input / output lines. </li></ul><ul><li>Internal data (RAM) memory - 256 bytes....
8051 Manufacturers <ul><li>AMD: Enhanced 8051 parts (no longer producing 80x51 parts)  </li></ul><ul><li>Atmel: FLASH and ...
Selection of Atmel 8051Devices * Figure from Atmel Function Spreadsheet -- Yes 3 2 34 2.7-5.5 60 2048 128 AT89C51RE2 -- Ye...
Datasheets – Your New Friends! * Figure from Atmel AT89C51RD2 Datasheet
Packaging <ul><li>Plastic Dual In-Line package (PDIL) </li></ul>* Figure from Atmel AT89C51RD2 Datasheet
Packaging I <ul><li>Very small Quad Flat Package (VQFP) </li></ul>* Figure from Atmel AT89C51RD2 Datasheet
Packaging II <ul><li>Plastic Leaded Chip Carrier (PLCC) </li></ul>* Figure from Atmel AT89C51RD2 Datasheet
Packaging
Pin-Out of an 8051
8051 Components <ul><li>Ports </li></ul><ul><li>RAM </li></ul><ul><li>Interrupt Controller </li></ul><ul><li>Timer </li></...
MCBX51 Board
MCBx51 Board * Figure from MCBx51 Datasheet
8051 Internal RAM * Figure from Atmel AT89C51RD2 Datasheet
Special Function Registers (SFRs) * Figure from Atmel AT89C51RD2 Datasheet
Special Function Registers (SFR) * Figure from Atmel AT89C51RD2 Datasheet
Special Function Registers (SFR) * Figure from Atmel AT89C51RD2 Datasheet
* Figure from Atmel AT89C51RD2 Datasheet
Pin-Out of an 8051
Ports <ul><li>Driving low-power peripherals ie. LEDs, relays </li></ul>
Port Defintion in Header Files <ul><ul><li>#define Sfr(x, y)  sfr x = y </li></ul></ul><ul><ul><li>#define Sbit(x, y, z)  ...
Philips ARM LPC Example <ul><ul><li>void Initialize() { </li></ul></ul><ul><ul><li>/* Initialize PLL */ </li></ul></ul><ul...
Another Example <ul><ul><li>static unsigned short  ADC_Read ( unsigned char  ch) { </li></ul></ul><ul><ul><li>unsigned int...
Accessing Ports in C <ul><ul><li>void main (void)  { </li></ul></ul><ul><ul><li>unsigned int i;  /* Delay var */ </li></ul...
Exercise 4 <ul><li>Becoming familiar with the development environment: </li></ul><ul><ul><li>Simulation & Execution on boa...
Upcoming SlideShare
Loading in …5
×

Notes 4

986 views

Published on

  • Be the first to comment

  • Be the first to like this

Notes 4

  1. 1. UBC104 Embedded Systems Microcontroller / 8051 family
  2. 2. Topics for Today <ul><li>Microcontrollers </li></ul><ul><li>Memory </li></ul><ul><li>Registers </li></ul><ul><li>Ports </li></ul>
  3. 3. Processors <ul><li>General purpose processors: </li></ul><ul><ul><li>80386 </li></ul></ul><ul><ul><li>Pentium </li></ul></ul><ul><ul><li>Core Duo </li></ul></ul><ul><li>Large number of pins </li></ul><ul><li>External memory </li></ul><ul><li>External peripherals </li></ul>* Figure from Intel 386 DX Datasheet
  4. 4. Functions of Pins <ul><li>Designed to be generic </li></ul><ul><li>Indented to move data around </li></ul>* Figure from Intel 386 DX Datasheet
  5. 5. General Purpose Registers <ul><li>Registers are dedicated for moving data </li></ul><ul><ul><li>EAX, EBX, ECX, EDX: general purpose registers </li></ul></ul><ul><ul><li>EBP: Base pointer </li></ul></ul><ul><ul><li>ESP: Stack pointer </li></ul></ul><ul><ul><li>ESI, EDI: Index register </li></ul></ul>
  6. 6. Pentium <ul><li>Bigger, </li></ul><ul><li>better, </li></ul><ul><li>more </li></ul>* Figure from Intel Pentium Datasheet
  7. 7. Microcontrollers <ul><li>Support for peripherals inside uController </li></ul><ul><li>Limited number of pins </li></ul><ul><li>Dedicated purpose </li></ul><ul><ul><li>Controlling devices, taking measurements </li></ul></ul>
  8. 8. Microcontroller Families <ul><li>68H12: Motorola 68H11, 68HC12, … </li></ul><ul><li>8051: Intel 8051, 8052, 80251,… </li></ul><ul><li>PIC: Microchip PIC16F628, 18F452, 16F877, … </li></ul><ul><li>AVR: Atmel ATmega128, ATtiny28L, AT90S8515,… </li></ul>
  9. 9. Rita51J <ul><li>8051 </li></ul><ul><li>128K of SRAM </li></ul><ul><li>128K FLASH ROM </li></ul><ul><li>Serial port </li></ul><ul><li>Digital I/O lines </li></ul>* Figure from www.rigelcorp.com
  10. 10. Motes <ul><li>Sensor nodes based on Atmel ATMega128 </li></ul>* Figures from CrossbowMPR-MIBUser Manual
  11. 11. AT91SAM7P64 <ul><li>16/32 bit ARM7TDMI </li></ul><ul><li>64K Bytes Program Flash, 16K Bytes RAM, </li></ul><ul><li>USB 2.0 </li></ul><ul><li>10 bit ADC 384 ksps 2x UARTs </li></ul><ul><li>I2C, SPI </li></ul><ul><li>3x 32bit TIMERS </li></ul><ul><li>4x PWM, WDT </li></ul>* Figure from www.olimex.com
  12. 12. AT91SAM7P64 * Figure from www.olimex.com
  13. 13. Microcontroller Families <ul><li>68H12: Motorola 68H11, 68HC12, … </li></ul><ul><li>8051: Intel 8051, 8052, 80251,… </li></ul><ul><li>PIC: Microchip PIC16F628, 18F452, 16F877, … </li></ul><ul><li>AVR: Atmel ATmega128, ATtiny28L, AT90S8515,… </li></ul> We are going to look at 8051s
  14. 14. 8051 History <ul><li>Introduced 1980 </li></ul><ul><li>12 MHz </li></ul><ul><li>128 bytes Internal RAM </li></ul><ul><li>4 kbytes ROM </li></ul><ul><li>1 Serial port support </li></ul>
  15. 15. Typical features of modern 8051 <ul><li>32 input / output lines. </li></ul><ul><li>Internal data (RAM) memory - 256 bytes. </li></ul><ul><li>Up to 64 kbytes of ROM memory (usually flash) </li></ul><ul><li>Three 16-bit timers / counters </li></ul><ul><li>9 interrupts (2 external) with two priority levels. </li></ul><ul><li>Low-power Idle- and Power-down modes </li></ul>
  16. 16. 8051 Manufacturers <ul><li>AMD: Enhanced 8051 parts (no longer producing 80x51 parts) </li></ul><ul><li>Atmel: FLASH and semi-custom parts </li></ul><ul><li>Dallas: Battery backed, program download, and fastest variants </li></ul><ul><li>Intel: 8051 through 80c51gb / 80c51sl </li></ul><ul><li>ISSI: IS80C51/31 runs up to 40MHz </li></ul><ul><li>Matra: 80c154, low voltage static variants </li></ul><ul><li>OKI: 80c154, mask parts </li></ul><ul><li>Philips87c748 thru 89c588 - more variants than anyone else </li></ul><ul><ul><li>now NXP </li></ul></ul><ul><li>Siemens: 80c501 through 80c517a, and SIECO cores </li></ul><ul><li>SMC: COM20051 with ARCNET token bus network engine </li></ul><ul><li>SSI: 80x52, 2 x HDLC variant for MODEM use </li></ul>from http://www.faqs.org/faqs/microcontroller-faq/8051/
  17. 17. Selection of Atmel 8051Devices * Figure from Atmel Function Spreadsheet -- Yes 3 2 34 2.7-5.5 60 2048 128 AT89C51RE2 -- Yes 3 1 32 2.7-5.5 60 2048 64 AT89C51RD2 -- Yes 3 1 32 2.7-5.5 60 1280 32 AT89C51RC2 -- -- 3 1 32 4.0-6.0 33 512 32 AT89C51RC -- Yes 3 1 32 2.7-5.5 60 1280 16 AT89C51RB2 -- Yes 3 1 32 2.7-5.5 60 2048 64 AT89C51ID2 -- Yes 3 1 34 2.7-5.5 60 1280 32 AT89C51IC2 -- Yes 3 1 32 2.7-5.5 60 2048 64 AT89C51ED2 8 Yes 3 1 32 3-5.5 60 2304 64 AT89C51AC3 8 -- 3 1 34 3-5.5 40 1280 32 AT89C51AC2 8 -- 2 1 20 3-5.5 40 512 16 AT89C5115 10-bit A/D channels SPI 16-bit Timers UART I/O Pins Vcc (V) F.max (MHz) RAM (Bytes) Flash (Kbytes) Device
  18. 18. Datasheets – Your New Friends! * Figure from Atmel AT89C51RD2 Datasheet
  19. 19. Packaging <ul><li>Plastic Dual In-Line package (PDIL) </li></ul>* Figure from Atmel AT89C51RD2 Datasheet
  20. 20. Packaging I <ul><li>Very small Quad Flat Package (VQFP) </li></ul>* Figure from Atmel AT89C51RD2 Datasheet
  21. 21. Packaging II <ul><li>Plastic Leaded Chip Carrier (PLCC) </li></ul>* Figure from Atmel AT89C51RD2 Datasheet
  22. 22. Packaging
  23. 23. Pin-Out of an 8051
  24. 24. 8051 Components <ul><li>Ports </li></ul><ul><li>RAM </li></ul><ul><li>Interrupt Controller </li></ul><ul><li>Timer </li></ul><ul><li>SPI Controller </li></ul>* Figure from Atmel AT89C51RD2 Datasheet
  25. 25. MCBX51 Board
  26. 26. MCBx51 Board * Figure from MCBx51 Datasheet
  27. 27. 8051 Internal RAM * Figure from Atmel AT89C51RD2 Datasheet
  28. 28. Special Function Registers (SFRs) * Figure from Atmel AT89C51RD2 Datasheet
  29. 29. Special Function Registers (SFR) * Figure from Atmel AT89C51RD2 Datasheet
  30. 30. Special Function Registers (SFR) * Figure from Atmel AT89C51RD2 Datasheet
  31. 31. * Figure from Atmel AT89C51RD2 Datasheet
  32. 32. Pin-Out of an 8051
  33. 33. Ports <ul><li>Driving low-power peripherals ie. LEDs, relays </li></ul>
  34. 34. Port Defintion in Header Files <ul><ul><li>#define Sfr(x, y) sfr x = y </li></ul></ul><ul><ul><li>#define Sbit(x, y, z) sbit x = y^z </li></ul></ul><ul><ul><li>#define Sfr16(x,y) sfr16 x = y </li></ul></ul><ul><ul><li>/* BYTE Register */ </li></ul></ul><ul><ul><li>Sfr (P0 , 0x80); </li></ul></ul><ul><ul><li>Sbit (P0_7 , 0x80, 7); </li></ul></ul><ul><ul><li>Sbit (P0_6 , 0x80, 6); </li></ul></ul><ul><ul><li>Sbit (P0_5 , 0x80, 5); </li></ul></ul><ul><ul><li>Sbit (P0_4 , 0x80, 4); </li></ul></ul><ul><ul><li>Sbit (P0_3 , 0x80, 3); </li></ul></ul><ul><ul><li>Sbit (P0_2 , 0x80, 2); </li></ul></ul><ul><ul><li>Sbit (P0_1 , 0x80, 1); </li></ul></ul><ul><ul><li>Sbit (P0_0 , 0x80, 0); </li></ul></ul><ul><ul><li>Sfr (P1 , 0x90); </li></ul></ul><ul><ul><li>Sbit (P1_7 , 0x90, 7); </li></ul></ul><ul><ul><li>Sbit (P1_6 , 0x90, 6); </li></ul></ul><ul><ul><li>Sbit (P1_5 , 0x90, 5); </li></ul></ul>
  35. 35. Philips ARM LPC Example <ul><ul><li>void Initialize() { </li></ul></ul><ul><ul><li>/* Initialize PLL */ </li></ul></ul><ul><ul><li>/* Setting Multiplier and divider values */ </li></ul></ul><ul><ul><li>PLLCFG=0x25; </li></ul></ul><ul><ul><li>feed(); </li></ul></ul><ul><ul><li>/* Enabling the PLL */ </li></ul></ul><ul><ul><li>PLLCON=0x1; </li></ul></ul><ul><ul><li>feed(); </li></ul></ul><ul><ul><li>/* Wait for the PLL to lock to set frequency */ </li></ul></ul><ul><ul><li>while(!(PLLSTAT & PLOCK)){} </li></ul></ul><ul><ul><li>/* Connect the PLL as the clock source */ </li></ul></ul><ul><ul><li>PLLCON=0x3; </li></ul></ul><ul><ul><li>feed(); </li></ul></ul><ul><ul><li>... </li></ul></ul>
  36. 36. Another Example <ul><ul><li>static unsigned short ADC_Read ( unsigned char ch) { </li></ul></ul><ul><ul><li>unsigned int i; </li></ul></ul><ul><ul><li>ADCR = 0x00200300 | ch; // Init ADC & select channel </li></ul></ul><ul><ul><li>ADCR |= 0x01000000; // Start A/D Conversion </li></ul></ul><ul><ul><li>do { </li></ul></ul><ul><ul><li>i = ADDR; // Read A/D Data Register </li></ul></ul><ul><ul><li>} while ((i & 0x80000000) == 0); // Wait for end of A/D Conversion </li></ul></ul><ul><ul><li>return (i >> 6) & 0x03FF; // bit 6:15 is 10 bit AD value </li></ul></ul><ul><ul><li>} </li></ul></ul>
  37. 37. Accessing Ports in C <ul><ul><li>void main (void) { </li></ul></ul><ul><ul><li>unsigned int i; /* Delay var */ </li></ul></ul><ul><ul><li>unsigned char j; /* LED var */ </li></ul></ul><ul><ul><li>while (1) { /* Loop forever */ </li></ul></ul><ul><ul><li>for (j=0x01; j< 0x80; j<<=1) { /* Blink LED 0, 1, 2, 3, 4, 5, 6 */ </li></ul></ul><ul><ul><li>P1 = j; /* Output to LED Port */ </li></ul></ul><ul><ul><li>for (i = 0; i < 10000; i++) { /* Delay for 10000 Counts */ </li></ul></ul><ul><ul><li>wait (); /* call wait function */ </li></ul></ul><ul><ul><li>} </li></ul></ul><ul><ul><li>} </li></ul></ul><ul><ul><li>for (j=0x80; j> 0x01; j>>=1) { /* Blink LED 6, 5, 4, 3, 2, 1 */ </li></ul></ul><ul><ul><li>P1 = j; /* Output to LED Port */ </li></ul></ul><ul><ul><li>for (i = 0; i < 10000; i++) { /* Delay for 10000 Counts */ </li></ul></ul><ul><ul><li>wait (); /* call wait function */ </li></ul></ul><ul><ul><li>} </li></ul></ul><ul><ul><li>} </li></ul></ul><ul><ul><li>} </li></ul></ul><ul><ul><li>} </li></ul></ul>
  38. 38. Exercise 4 <ul><li>Becoming familiar with the development environment: </li></ul><ul><ul><li>Simulation & Execution on board </li></ul></ul><ul><ul><li>Debugging </li></ul></ul><ul><ul><li>Using peripherals Ports </li></ul></ul><ul><ul><li>Using low-level C e.g. bit-level operations </li></ul></ul>

×