Programming 16-Bit PIC Microcontrollers in C
Learning to Fly the PIC 24By
- Lucio Di Jasio
- Lucio Di Jasio
â¢ A Microchip insider tells all on the newest, most powerful PICs ever! â¢ FREE CD-ROM includes source code in C, the Microchip C30 compiler, and MPLAB SIM softwareâ¢ Includes handy checklists to help readers perform the most common programming and debugging tasksThe new 16-bit PIC24 chip provides embedded programmers with more speed, more memory, and more peripherals than ever before, creating the potential for more powerful cutting-edge PIC designs. This book teaches readers everything they need to know about these chips: how to program them, how to test them, and how to debug them, in order to take full advantage of the capabilities of the new PIC24 microcontroller architecture.Author Lucio Di Jasio, a PIC expert at Microchip, offers unique insight into this revolutionary technology, guiding the reader step-by-step from 16-bit architecture basics, through even the most sophisticated programming scenarios. This bookâs common-sense, practical, hands-on approach begins simply and builds up to more challenging exercises, using proven C programming techniques. Experienced PIC users and newcomers to the field alike will benefit from the textâs many thorough examples, which demonstrate how to nimbly side-step common obstacles, solve real-world design problems efficiently, and optimize code for all the new PIC24 features. You will learn about:â¢ basic timing and I/O operations, â¢ multitasking using the PIC24 interrupts, â¢ all the new hardware peripherals â¢ how to control LCD displays, â¢ generating audio and video signals, â¢ accessing mass-storage media, â¢ how to share files on a mass-storage device with a PC, â¢ experimenting with the Explorer 16 demo board, debugging methods with MPLAB-SIM and ICD2 tools, and more!
PRIMARY MARKET: Embedded Engineers, Programmers, and Designers, SW & HW engineersSECONDARY MARKET: electrical and computer engineering students, hobbyists
Published: March 2007
"No stone is left unturned. The book hits flash memory, communications, LCD support, and analog-to-digital converter support...Unless you are a C30 and PIC24 wiz already, pick up this book before beginning work with one."William Wong, Electronic Design.
- 1. Take offâ¦The most dangerous phases of flightâ¦ take off and landing. The parallel with learning a new development tool and possibly an entirely new language â¦We learn about the C30 compiler (student version) and we start developing code for the new 16-bit families of dsPIC and PIC24 microcontrollers. - Use of MPLAB and the Simulator as a familiar environment, - continuous parallels with assembly programming, Proceed through:1.1. Step by step installation of the compiler1.2. Walk through some of the most basic steps of creating a new MPLAB project with the C30 language suite1.3. the first #include, accessing the PICmicro resources in C1.4. the first interrupt1.5. Timing clock and 1.6. Hello (Embedded) World1.7. Linking and running within the simulator2. Touch and Goâ¦ i.e. stay in the pattern and practice your landings. Debugging code with MLAB in a C30 project.2.1. Watch for your Airspeed, that is: keep an eye on the clock (watch windows, stopwatch)2.2. touch and goes, breakpoints and single stepping through C code (what the optimizer does to it)2.3. use of the logic analyzer view2.4. in the real cockpit: leaving the protected world of the simulator and starting to use the ICD2 2.5. tips for the perfect landing: print statements, bit toggling, asserts and other old tricks3. Basic maneuvers basic C language constructs3.1. allocating variables (and learn about RAM mapping)3.2. loops (and learn about FLASH addressing )3.3. conditions (and learn about register mappings)3.4. functions (and learn about interrupts and subroutine calls) 4. Inside the engine compartment advanced, for assembly experts who donât trust compilers4.1. What is my code translated to? A look at the assembly code generated by simple constructs4.2. How efficient is it really? Comparing side by side an assembly routine to the compiler generated code.4.3. the starter: C0 code 4.4. Leaning the mixture: Optimizing code4.5. How is the compiler really allocating resources RAM and ROM4.6. Owner maintenance: Mixing in some inline assembly4.7. Buy certified or build your own: using canned libraries vs. your own libraries5. Flying Cross Country, exploring more of the environmentthe $100 burger; get some experience doing useful things like:5.1. sending debugging data to the serial port to display on Hyperterminal (UART)5.2. reading keystrokes from a PS2 keyboard (bit banging)5.3. RTCC implementation (TIMER1)5.4. reading a pot and using some Floating point math (ADC)5.5. storing data in NVM (on chip/off chip) (EEPROM)5.6. using a PWM as a D/A converter (PWMs)5.7. reading a rotating gray encoder (Capture/Interrupts)5.8. reading from a touch pad sensor (ADC)5.9. Generating video output (Timers/Interrupts)6. Complex endorsement (retractable gear and constant speed props)6.1. Encryption and Decryption 6.2. Interfacing to a graphic LCD display6.2.1. low level routines6.2.2. Menus and string management6.3. Interfacing to an SD memory card (SPI)6.3.1. low level access routines6.3.2. File system development6.4. Writing a basic interpreter7. Final check ride: build a WAV player7.1. deciphering the WAV file format7.2. Mass storage7.3. The user interface7.4. Advanced filtering 7.5. Putting it all together7.6. Connect it to the audio panel and fly away: Ethernet and USB connectivity8. License to Learn8.1. closing words of wisdom8.2. ideas and pointers to continue learning