FAQ on Microprocessors: From Assembly to C with the PIC18Fxx2

    1. What is this book's objective?
    2. What previous background is needed for this book?
    3. How is this book different from other introductory titles on microprocessors?
    4. Why use a microcontroller in an introductory course on microprocessors rather than the x86 family?
    5. Why is C used for the hardware interfacing examples instead of assembly language?
    6. What is on the book's CDROM?
    7. What do I need to exercise the book's examples?
    8. Why is a protoboard/parts kit approach used for the hardware examples instead of a ready-made printed circuit board that is pre-populated?
    9. Why did you choose the PIC18F242 as the microcontroller instead of one of the many other available choices?
    10. Can this book be used in a traditional microcontroller course in which the students are already familiar with assembly language?
  1. The book uses the HI-TECH PICC18 compiler; I would like to use the Microchip MCC18 compiler; is this possible?
  2. What is this book's objective?
      1. In an educational environment, this book is intended to be used as a first course in microprocessors using the PIC18xx2 microcontroller. The first seven chapters provide an introduction to assembly language programming using the PIC18 instruction set, with all assembly language examples set in a C language context. The remaining eight chapters cover microcontroller interfacing topics using the PIC18F242, with all examples written in C in order to promote maximum understanding of the hardware topic being studied.
      2. For the hobbyist, this book provides an all-in-one coverage of the PIC18F242, with no previous knowledge of microcontrollers assumed.
      3. TOP
  3. What previous background is needed for this book?
      1. Previous exposure to basic digital logic concepts and experience in some high level programming language is needed. The first chapter reviews digital logic concepts as a refresher. A subset of the C language is used in the book, with C statements introduced gradually in the context of their implementation in PIC18 assembly.
      2. TOP
  4. How is this book different from other introductory titles on microprocessors?
      1. This book combines an introduction to assembly language programming with hardware interfacing in a C language context by using a microcontroller as the base processor, instead of a general purpose processor such as an x86 family member. This exposes the reader to a much broader topic list, and provides a wide range of skills that proves immediately useful for incorporating a microcontroller into design projects.
      2. TOP
    1. Why use a microcontroller in an introductory course on microprocessors rather than the x86 family?
      1. At Mississippi State University, our microprocessor course sequence used to be x86-based for the introductory course, followed by an optional microcontroller-based course. The introductory microprocessor course is required of electrical engineering (EE), computer engineering (CPE), computer science (CS), and software engineering (SE) majors. We found that many EE students elected not to take the optional microcontroller course, and this caused problems in our capstone EE/CPE senior design course where some form of microcontroller is usually required regardless of the project emphasis. It was not an option to require EE majors to take the optional microcontroller course as we are under pressure to reduce curriculum hours, the same as many other institutions. The Computer Engineering Steering committee decided that embedded system knowledge greatly enhances the quality of senior design projects, and hence decided to shift the introductory course to use a microcontroller. This change in course emphasis does require tradeoffs to be made in that assembly language programming content was reduced in favor of more hardware interfacing topics. However, assembly language programming is reinforced in our curriculum for CS and CPE majors by a follow-on required computer architecture course that uses the Hennessey and Patterson textbook Computer Organization & Design: The Hardware/Software Interface. This change also allowed our optional microcontroller course to begin at a higher level; this course currently emphasizes ethernet-enabled embedded systems.
      2. TOP
    2. Why is C used for the hardware interfacing examples instead of assembly language?
      1. I feel that the goal of introducing students to assembly language programming is accomplished in the first seven chapters in which PIC18 assembly language is covered in a C language context. When the hardware topics are started, C is used to reduce the complexity of the code examples and to focus the student's attention on the hardware interfacing issues, and not the coding. The use of C in the first seven chapters for assembly language coverage topics prepares the student for the transition to C examples in the hardware chapters.
      2. TOP
  5. What is on the book's CDROM?
      1. The book CDROM contains a 120-day demo of the HITECH C Compiler for the PIC18F242, complete listings for the book examples, the Jolt/Colt serial bootloaders, and all of the book figures in .png format.
      2. TOP
  6. What do I need to exercise the book's examples?
      1. The book's assembly language examples can be simulated with the freely-available integrated design environment called MPLAB from Microchip. The book's hardware interfacing examples are based on a reference PIC18F242 system that is built on a protoboard. An external programmer such as the PICSTART® programmer available from Microchip is initially needed to program the PIC18F242. However, once the serial interface is added to the board, the Jolt/Colt serial bootloaders can be used to program the PIC18F242 in-circuit. The book appendix contains a total of 13 lab experiments, of which eight are hardware lab experiments that builds the reference board and uses it to exercise all of the on-board PIC18F242 hardware modules. A complete part list of the PIC18F242 reference system is provided in the book's appendix. This part kit can be purchased in single item quantities from suppliers such as Digi-Key. At Mississippi State University, we purchase this kit from Electronix Express at a substantially reduced price over single quantity ordering. The protoboard and wiring kit can be purchased from Web-Tronics. The hardware interfacing examples are written in C and the book CDROM contains a 120-day demo of the HI-TECH Software PIC18F242 C compiler.
      2. TOP
  7. Why is a protoboard/parts kit approach used for the hardware examples instead of a ready-made printed circuit board that is pre-populated?
      1. This was done for several reasons. One reason is flexibility; modifying a lab experiment is as simple as changing a particular IC choice. Also, it is easy to replace parts when part failures occurs. Another reason is that the experience of bringing a microcontroller system to life from a bag of parts is valuable; it gives the student the confidence that they can do this if needed in the future. It also forces the student to read datasheets and view each component separately; when handed a pre-populated PCB many students view it as a monolithic element and do not grasp the importance of the individual components and their interconnections, no matter how well this subject is covered in lecture. The protoboard approach also provides a valuable hardware debugging experience when the inevitable wiring mistakes are made; it forces a student to develop a methodical approach to hardware debugging that will serve them well in the future. Finally, the parts kit can be used in future courses such as senior design, which may require an embedded microcontroller.
      2. TOP
  8. Why did you choose the PIC18F242 as the microcontroller instead of one of the many other available choices?
      1. The PIC18F242 was chosen because of its rich set of set of on-chip hardware modules that includes an analog-to-digital converter, I2C module, USART module, three parallel ports, and four timers. The 28-pin dual-in-line package and its ready availability from vendors such as Digi-Key makes it suitable for a lab prototyping environment. The PIC18xx2 instruction set is small enough so as to not be overwhelming to the student new to assembly language, and yet contains the traditional features that one expects in an instruction set such as relative branches and indirect addressing. C language constructs map naturally to the PIC18 instruction set, making it easy to introduce assembly language statements in a C language context. PIC18Fxx2 software development is well supported in the form of the freely available MPLAB Integrated Design Environment by Microchip for assembly language programming and C compilers from Hi-Tech Software and Microchip. The ability to in-circuit flash program the PIC18F242 using a serial bootloader makes for quick turnaround for program modifications.
      2. TOP
  9. Can this book be used in a traditional microcontroller course in which the students are already familiar with assembly language?
      1. In this case, the first seven chapters on PIC18 assembly language could be covered in a survey mode or assigned as external reading. Chapters 8-15 covers all of the PIC18 hardware subsystems, with enough interfacing examples to keep a class busy for an entire semester if all of the topics are covered in detail. In the appendix, the five assembly language labs could be skipped, and the eight hardware experiments used as the primary lab experience. Chapter 14 contains three capstone projects, and modifications to these projects could be assigned as end-of-semester projects for the class after the eight hardware experiments are completed. Chapter 15 contains a survey of advanced hardware topics, and these could be covered in more detail given the extra time gained by skimming the assembly language chapters.
      2. TOP
  10. The book uses the HI-TECH PICC18 compiler; I would like to use the Microchip MCC18 compiler; is this possible?
      1. On the main page, I have added a link to a MCC18 page that contains an archive of the book's examples modified to be compatible with both the HI-TECH PICC18 and Microchip MCC18 compilers. The required changes for compability did not compromise the clarity or basic functionality of the code examples so the book figures can still be used as references for the code, despite the changes. There is also a document on the same page that explains the differences between the PICC18 and MCC18 compilers.
      2. TOP