Your SlideShare is downloading. ×
0
PICs.ppt
PICs.ppt
PICs.ppt
PICs.ppt
PICs.ppt
PICs.ppt
PICs.ppt
PICs.ppt
PICs.ppt
PICs.ppt
PICs.ppt
PICs.ppt
PICs.ppt
PICs.ppt
PICs.ppt
PICs.ppt
PICs.ppt
PICs.ppt
PICs.ppt
PICs.ppt
PICs.ppt
PICs.ppt
PICs.ppt
PICs.ppt
PICs.ppt
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

PICs.ppt

1,709

Published on

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,709
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
67
Comments
0
Likes
1
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Getting Started with PICs: Introducing Microcontrollers in Grade Twelve Computer Engineering Brad North
  • 2. Agenda <ul><li>What is a Microcontroller? </li></ul><ul><li>Where are Microcontrollers Used? </li></ul><ul><li>Why Use Microcontrollers in G12? </li></ul><ul><li>What You Need to Get Started </li></ul><ul><li>P16F84 Characteristics </li></ul><ul><li>“ The PIC Process” </li></ul><ul><li>Resources </li></ul><ul><li>Questions </li></ul>
  • 3. What is a Microcontroller? <ul><li>“ A computer inside a chip”: </li></ul><ul><ul><li>CPU </li></ul></ul><ul><ul><li>ROM </li></ul></ul><ul><ul><li>RAM </li></ul></ul><ul><ul><li>Bi-directional ports </li></ul></ul><ul><ul><li>Interrupts </li></ul></ul><ul><ul><li>Internal clock </li></ul></ul><ul><ul><li>Many other functions…… </li></ul></ul>
  • 4. Where Are Microcontrollers Used? <ul><li>DVD, TV, VCR </li></ul><ul><li>XBOX, Nintendo, Game Boy </li></ul><ul><li>Carbon Monoxide Alarms </li></ul><ul><li>PDAs, cellphones </li></ul><ul><li>Automobiles </li></ul><ul><li>Garage door openers </li></ul><ul><li>Household appliances </li></ul><ul><li>Automatic pilot systems </li></ul><ul><li>Astronauts’ space suits </li></ul>
  • 5. Why Use Microcontrollers in G12? <ul><li>Students are highly motivated </li></ul><ul><li>Potential to expand and modify projects is unlimited </li></ul><ul><li>Reasonably priced – P16F84 - under $9 each </li></ul><ul><li>Free Software and documents </li></ul><ul><li>Covers many Ministry Expectations </li></ul>
  • 6. <ul><li>Compare high-level and low-level programming languages </li></ul><ul><li>Explain how to determine memory requirements for information storage </li></ul><ul><li>Describe the function and interaction of a control unit, arithmetic logic unit, and memory registers in a simple CPU </li></ul><ul><li>Use a diagram to illustrate how buses move data and instructions between memory and the CPU. </li></ul><ul><li>Explain several computer-controlled systems that interact with real-world devices </li></ul>ICE 4MO Ministry Expectations …
  • 7. … ICE 4M Ministry Expectations <ul><li>Describe the constructs of a simple assembly or machine-level language </li></ul><ul><li>Identify similarities and differences among memory addressing techniques </li></ul><ul><li>Design an effective system consisting of a computer and interface that integrates input and output devices </li></ul><ul><li>Write programs to process input and control output devices through interfaces </li></ul><ul><li>Write low-level programs </li></ul>
  • 8. What You Need To Get Started <ul><li>P16F84 & 18-pin DIP socket </li></ul><ul><li>4 MHz crystal oscillator </li></ul><ul><li>Breadboard, 7805, LEDs, resistors </li></ul><ul><li>Programmer </li></ul><ul><li>Power adapter </li></ul><ul><li>Parallel port cable </li></ul>Hardware
  • 9. <ul><li>MPLAB IDE v5.70 </li></ul><ul><li>Programmer Software </li></ul><ul><li>Programmer Firmware </li></ul>Software Documentation/Resources <ul><li>P16F84 Datasheet (.pdf) </li></ul><ul><li>MPLAB Manual and Tutorial (.pdf) </li></ul>
  • 10. P16F84 Characteristics <ul><li>Datasheet </li></ul><ul><li>1024 x 14 program memory </li></ul><ul><li>68 x 8 User RAM Registers (data memory) </li></ul><ul><li>13 Bi-directional ports </li></ul><ul><li>Internal oscillator </li></ul><ul><li>Interrupts </li></ul>
  • 11. <ul><li>1. Harvard Architecture </li></ul><ul><ul><li>2 separate memory blocks , which can be accessed simultaneously: </li></ul></ul><ul><ul><ul><ul><li>Program Memory </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Data Memory </li></ul></ul></ul></ul>
  • 12. <ul><li>i. Program Memory </li></ul><ul><li>Flash EEPROM – where your program from assembler code is written to. </li></ul><ul><li>Program memory bus is 14 bits wide ( Mid-Range PIC MCUs ) </li></ul><ul><li>PIC16F84 has 1K x 14 bits of program memory space = 1,024 words x 14 bits </li></ul><ul><li>Addresses are in hex: last available address is 3FF </li></ul>
  • 13. <ul><li>ii. Data Memory </li></ul>12 Special Function Registers (SFR) which control the PIC <ul><li>68 General Purpose Registers (GPR) </li></ul><ul><li>First GPR is 0Ch </li></ul><ul><li>Last is 4Fh </li></ul>
  • 14. <ul><li>2. Instruction Cycle/Clock Cycle </li></ul><ul><ul><ul><li>RISC – 35 Word Instruction Set </li></ul></ul></ul><ul><ul><ul><li>All instructions are processed in one instruction cycle except for program branches (i.e. subroutine) </li></ul></ul></ul><ul><li>3. W (Working Register) </li></ul><ul><ul><ul><li>8-bit register – also referred to as the &quot;accumulator&quot; in other MPUs </li></ul></ul></ul><ul><ul><ul><li>ALL data must be placed into the W register first, then moved from the W register to any other register (i.e. MOVLW, MOVF) </li></ul></ul></ul>
  • 15. “The PIC Process” <ul><li>Coding & Assembling in MPLAB 5.70 </li></ul>Downloading to the programmer using PICALLW Building Circuit & testing, editing
  • 16. <ul><li>Write Source Code </li></ul>Text editor (.asm file)
  • 17. RISC Instruction Set <ul><li>35 instructions </li></ul><ul><li>Mnemonic instructions and operands are the “commands” used to write the code </li></ul>
  • 18. Coding Structure Label Field Instruction, Directives Field Data Field Comment Field
  • 19. 2. Assemble Code (MPASM)
  • 20. <ul><li>.lst (list) file </li></ul>3. Object Files Created
  • 21. .hex file
  • 22. 4. Download to Programmer <ul><li>1. PICSTART PLUS </li></ul><ul><ul><ul><li>Download via MPLAB </li></ul></ul></ul><ul><ul><li>2. P16PRO/PICALL </li></ul></ul><ul><ul><ul><li>Download .hex file via PICALLW </li></ul></ul></ul>
  • 23. Resources <ul><li>Documentation and MPLAB software </li></ul><ul><ul><li>www.microchip.com </li></ul></ul><ul><li>Programmer Software </li></ul><ul><ul><li>2 options </li></ul></ul><ul><ul><ul><li>PICSTART PLUS </li></ul></ul></ul><ul><ul><ul><ul><li>Part and parcel of MPLAB </li></ul></ul></ul></ul><ul><ul><ul><ul><li>$US200 </li></ul></ul></ul></ul><ul><ul><ul><li>P16PRO/PICALL </li></ul></ul></ul><ul><ul><ul><ul><li>$US20/30 assembled </li></ul></ul></ul></ul><ul><ul><ul><ul><li>www.electronics123.com </li></ul></ul></ul></ul><ul><li>Programmer Firmware (for P16PRO/PICALL) </li></ul><ul><ul><li>$US20 </li></ul></ul><ul><ul><li>www.picallw.com </li></ul></ul>
  • 24. Additional Resources <ul><li>Easy PIC’n </li></ul><ul><ul><li>Benson, David ( www.sq-1.com ) </li></ul></ul><ul><li>Poptronics Magazine </li></ul><ul><ul><li>PICtronics section ( www. poptronics .com ) </li></ul></ul>
  • 25. <ul><li>? </li></ul>

×