Let's Make Robots!

08.04.09 0044: BARE PICs

I've been spending the better part of the last few months studying to become more familiar with bare PICs. I'm not too sure what it is exactly that attracts me to using bare PICs in lieu of using an "Arduino" or "PICAXE", but I've made the decision to utilize bootloaded microcontrollers solely when prototyping.

Attempting to educate myself in the area of PIC programming in the C language has proven fatal and unproductive. Passed making an LED blink at a 50% duty cycle, my skills as as PIC programmer are very limited and useless in trying to construct any type of robotic project. The majority of my knowledge was acquired by studying the PIC tutorials located at: http://www.gooligum.com.au. The information that I've received from the previously stated website has proven very benificial in acquiring the paltry expertise I have now, but has quickly left me with unanswered inquiries.

Attempting to locate more conducive material for acquiring intelligence has also proven fatal. It seems as though no reference has a holistic approach at tackling bare PICs, which leaves me to believe that in order to utilize bare PICs, one must first select a specific PIC microcontroller due to the unique nature of which each is constructed and applied.

I've come to the conclusion that using the "learn-as-you-go" method is not beneficial to me and I require a methodology that provides me with a full perspective of PICs, starting with the history and architecture and ending with examples and applications.  

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Thomas Countz's picture

Right now I'm on vacation in Virgina Beach, and on the 8 hour drive here, I decided to read "The PIC Microcontroller: Your Personal Intoductory Course, 3rd Ed." I have refrained form reading it because I didn't have a hard copy, just an illegally downloaded ebook copy, but I decided to read it anyway. It's very helpful in putting things in simple English, which is where I have having trouble. It starts with the 16F54 and 16F57 and moves to 12F508 and 12F509 then finally to the 12F675. I like it a lot, and I can't wait to get a hard copy.

Al, you warn against learning to program in C, and I can't help but question why. I assume it's because I need to learn how each instruction is affecting the PIC instead of letting the assembler figure everything out. If that is the case, I can fully respect that, and understand that I have a bit a time commitment ahead of me. 

 Just as a note, I always get caught up when it comes to delay loops. I don't know what it is about them, but I have yet to wrap my brain fully around them. Nothing I can think of can help me understand them more except continually using them until I fully understand.

 

wolfc's picture

you were right about needing to learn how each instruction is affecting the PIC.  With assembly in microchip's MPLAB you can simulate whats going on in your chip.  it allows you to step through each instruction and see what is happening in each register.  this is extreamly helpful in figuring out what just went wrong when it doesnt work the way you think it should have. 

don't get too hung up over delay loops.  they really don't do anything at all.  basically you are letting the microcontroller waste clock cycles by counting to a number or looping untill a preset timer overflows.  Delay loops often look more complicated in the lower level PIC's since they dont use timers to do the counting for you. 

My advice is to get a led blinking on a 16Fxx series pic and then take advantage of the extra features in the 18Fxx series.  If you need any help with PIC assembly I've become pretty good at it.  I also have plenty of assembly programs that I'd be willing to send If your one of the people that learns by seeing.  

TinHead's picture

I did the bare PIC thing myself at first, using an 16f628 and JAL (kind of Pascal for PICs) to programm it, even build my own devel board for it. But then I found out about AVR's and I switched over, and never got back ti the PIC, cannot really tell why.

One thing  is maybe that AVR's have a gcc implementation whil PIC's don't and is seems to me easier to find open source projects for AVR's.

Of course Arduino helped a lot in the process, there is an equivalent for PIC's though: see here http://www.hackinglab.org/