PIC Microcontroller
Leverbaar
Acknowledgements ix Preface to the third edition xi Introduction 1(19) Some tips before starting 2(3) Binary, decimal and hexadecimal 2(3) An 8-bit system 5(1) Initial steps 5(5) Choosing your PIC microcontroller 6(4) Writing 10(1) Assembling 10(1) The file registers 10(3) A program template 13(7) Exploring the PIC5x series 20(70) Your first program 20(3) Configuration bits 22(1) Testing the program 23(1) Simulating 23(1) Emulating 23(1) Blowing the PIC microcontroller 24(1) Hardware 24(5) Using the testing instructions 29(3) Timing 32(12) Seven-segment displays 44(2) The program counter 46(2) Subroutines and the stack 48(17) Logic gates 65(4) The watchdog timer 69(4) Final instructions 73(1) The Status file register 74(1) The carry and digit carry flags 75(1) Pages 76(3) What caused the reset? 79(1) Indirect addressing 80(2) Some useful (but not vital) tricks 82(3) Final PIC5x program - `Bike buddy' 85(5) The PIC12F50x series (8-pin PIC microcontrollers) 90(10) Differences from the PIC16F54 90(4) The Status register 90(1) The Osccal register 91(1) Inputs and outputs 92(1) The Option register 92(1) The Tris register 93(1) The general purpose file registers 93(1) The MCLR 93(1) Configuration bits 93(1) Example project: `PIC dice' 94(6) Random digression 95(5) Intermediate operations using the PIC12F675 100(38) The inner differences 101(4) The Option and WPU registers 102(1) The Trisio register 103(1) Calibrating the internal oscillator 103(1) PCLATH: Higher bits of the program counter 104(1) Remaining differences 105(1) Interrupts 105(11) INTCON 106(1) The interrupt service routine 107(2) Interrupts during sleep 109(1) Maintaining the Status quo 109(1) New program template 110(2) Example project: `Quiz game controller' 112(4) EEPROM 116(6) EECON1 116(1) Reading from the EEPROM 116(1) Writing to the EEPROM 117(1) Example project: `Telephone card chip' 118(4) Further EEPROM examples: Music maker 122(1) Power monitor 122(1) Analogue to digital conversion 122(7) ADCONO 123(1) ANSEL: Analogue select register 124(1) A/D conversion interrupt 125(1) Example project: `Bath monitor' 125(4) Comparator module 129(5) Voltage reference 130(1) Comparator interrupts 130(1) Comparator example: `Sun follower' 131(1) Comparator example: Reading many buttons from one pin 132(2) Final project: Intelligent garden lights 134(4) Advanced operations and the future 138(5) Extra timers: TMRI & ... 138(1) Capture/Compare/PWM 139(1) USART: Serial communication 140(2) Programming tips 142(1) A PIC development environment 143(2) Sample programs 145(44) Program A LedOn -- Turns an LED on 145(1) Program B PushButton (1.0) -- If a push button is pressed, turns on an LED 146(1) Program C PushButton (2.0) -- Shorter version of PushButton 1.0 147(1) Program D Timing -- LED states toggled every second, and buzzer on every five seconds 148(2) Program E Traffic -- Pedestrian traffic lights junction is simulated 150(2) Program F Counter (1.0) -- Counts signals from a push button, resets after 16 152(2) Program G Counter (2.0) -- Stop reading button twice (otherwise, as Counter 1.0) 154(2) Program H Counter (3.0) -- Solves button bounce (otherwise, as Counter 2.0) 156(2) Program I StopClock -- A stop clock displaying tenths of seconds to minutes 158(4) Program J LogicGates -- Acts as the eight different gates 162(2) Program K Alarm -- An alarm system which can be set or disabled 164(1) Program L BikeBuddy -- A speedometer and mileometer for bikes 165(6) Program M PIC Dice -- A pair of dice are simulated 171(4) Program N Quiz -- Indicates which of three push buttons has been pressed first 175(2) Program O Phonecard -- To act like a phonecard which decrements a file register 177(4) Program P TempSense -- Displays whether temperature is too hot, too cold or OK 181(2) Program Q 183(6) Appendix A Specifications of some Flash PIC microcontrollers 189(2) Appendix B Pin layouts of some Flash PIC microcontrollers 191(1) Appendix C Instructions glossary 192(3) Appendix D Number system conversion 195(1) Appendix E Bit assignments of various file registers 196(7) Appendix F If all else fails, read this 203(1) Appendix G Contacts and further reading 204(1) Appendix H PICKit™ 1 & BFMP Info 205(2) Appendix I Answers to the exercises 207(15) Appendix J Some Basic commands in assembly 222(1) Index 223
Ingenaaid
1e druk | Verschenen in 2005
Rubriek: