Monday 14 April 2014

microcontroller - Good book for PIC 18F beginner?





Possible Duplicate:
Books about pic18f?



I'm looking for good book for a beginner that would explain basic things about PIC microcontrollers, MPLAB IDE and MPLAB C compiler and programming in C.


I have decent, but basic knowledge of digital electronics. I already know how to write programs in C, so I just need some kind of fast transition to C language for embedded systems. It would be great if book includes examples.



Answer



You are going about this the wrong way. Unlike programming large machines with operating system, on microcontrollers you have to know how things work down to the hardware. That means now a compiler gets in the way by obscuring things, as apposed to dealing with all that machine stuff you don't have to care about on a large system. Writing in a HLL on a microcontroller can still be useful, but only if you understand the underlying hardware.


Blindly using a compiler and calling library routines to manage the hardware may sound like the easy way to go, but it's not good for learning, and since you're really not learning what is going on at the low levels, stuff will happen and you won't understand what is going on.


So to really answer you question, the best book for learning a PIC 18 is the datasheet for that PIC 18. If you are looking for something generic to start with, try the 18F2520. That's a easy to handle 28 pin part, and comes with a good mix of general peripherals. It also has plenty of RAM and program memory to do lots of useful projects.


When you first read the datasheet, you need to look carefully at the parts that talk about the general architecture, like the memory model, instruction set, stack, pointer registers, etc. That will be the same for all PIC 18. Different PIC 18 models vary in the amount of memory and mix of peripherals. Once you can write basic code using the core, you can try out peripherals one at a time and learn them individually.



As for MPLAB, that is a separate document. Actually MPLAB isn't a big deal to learn. What takes more is the assembler, the linker, possibly the librarian, and how they interact and how to use them. Once you get all that, you can throw in a compiler, but now you'll understand what it's actually doing and therefore what the various gotchas and restrictions are that you just don't see on big systems.


No comments:

Post a Comment

arduino - Can I use TI's cc2541 BLE as micro controller to perform operations/ processing instead of ATmega328P AU to save cost?

I am using arduino pro mini (which contains Atmega328p AU ) along with cc2541(HM-10) to process and transfer data over BLE to smartphone. I...