PIC Resources

Discussion in 'General Electronics Chat' started by sirch2, Apr 15, 2014.

  1. sirch2

    Thread Starter Well-Known Member

    Jan 21, 2013
    A few posts in recent threads, mainly by The_RB, have got me looking at PICs again. I did a few PIC based projects a decade or more ago but then I wondered off on to other things and have recently been doing Atmel based stuff. What really piqued my interest was the fact that some PIC chips can be had for pence rather than pounds and so become a viable alternative for counting, timing and the like.

    So I started looking for resources and whilst there seems to be a lot out there, there does seem to be a lot of conflicting advice and wreckage. For example, as a way of testing the water I went looking for an example of how to read/write an SD Card from a PIC because this is one of my current projects (I know this is a bit more than simple counting/timing but one would assume it is a solved problem). Google seems to find a lot of people in my position with questions about how to do this but very few answers and these seem to be riddled with broken links etc. even Microchip’s own link to its MMC library code seems to be broken. There also seem to be a wide variety of chips, compilers, programmers and the like which leads me to the question – how do you get started? Out of the plethora of chips there must be a handful that are “preferred” by hobbyists? Which compiler? Which programmer? Which forums give good advice to the inexperienced?

    At this stage these are more just idle musings than a serious intent to get back into the PIC world but assuming I can get a toe-hold on this mountain it may lead me to use PICs more in future. I also really would like to know if there is a definitive solution to the SD Card issue (i.e. one that says buy an xxfnnn chip, connect Pin p to SD Card CE, etc. download this example code and away you go …).
  2. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    I wouldn't call using an SD card from a PIC a beginner's project but you always get to choose your own starting line.

    First off Microchip allows you to freely download their compilers and support libraries. Sure, the code is larger then the paid versions, so you get the choice to either buy more expensive chips (for larger memories) or pay for their best optimizing compiler today and use smaller chips. Pay me now or pay me later. (I pay them later.)

    Microchip has just gone thru some major revisions to their compilers and the support libraries. The new compilers seem to need the new libraries to work, but they do seem to work (after a bumpy start). The older work (compiler and libraries) are all there too.

    I have no advice on the newer compilers and libraries as I am just starting to work with them. Using the older C18 compiler and libs I had little trouble getting SD cards to work once I understood that code has a 5 to 7 K footprint, so get a PIC with lots of memory. Interface is simple (or non-existent for a 3.3V supply PIC). I'd probably advise you to go with the new XC8 compiler & new libs so you don't learn things twice (and the new seems better).

    The PICkit 3 is an excellent programmer and in circuit debugger. That allows you to step thru your code as it is running inside your PIC. While you can simulate code nothing beats watching it run on your hardware.

    The Microchip forums give excellent advice, link on their home page.

    As far as which chip goes... I'd like to say you can't make a bad choice but my last project I went thru 2-3 chips and still did not have all the features I wanted. It may help to choose the same chip as a sample project used or some sample code you are interested in. The more current chips seem to go for 3.3V operation which may or may not be a problem. DO find the MAPS part selector to wander thru the choices.
  3. elec_mech

    Senior Member

    Nov 12, 2008
    A lot of hobbyists use boards developed by others to use with their microcontroller to do more "advanced" things like play MP3's, read/write to SD cards, etc. Sparkfun is one among many. The idea being most hobbyists only want to make one or two of a particular project and it costs less to buy a ready-made board than to develop your own circuit and code completely from scratch. Based on your descriptions, you're more interested in doing this yourself.

    I would think it is possible to use an ATMEL microcontroller (perhaps not an Arduino since it uses a bootloader), but I'm not sure. A PIC can certainly do it. Typically, the best place I've found for determining how to do something like this is visit the forum for your microcontroller and/or compiler.

    Personally, I like using BASIC to program, so for PIC's I've used PicBasicPro (PBP) by melabs. It is not a cheap compiler, but they have less expensive versions with some limitations. There are other compilers to look at as well. If you're familiar with C, Microchip offers a free C compiler as I understand it (XC8).

    In any event, here is a posting on a PBP forum using a PIC to write to an SD card. This project has a lot of other features such as reading a real time clock and using USB, so you'll have to sort a little to just get the SD portion, but it is there. If you're familiar with something other than BASIC, it shouldn't be too hard to pull the code you need and rewrite it for your preferred compiler.
  4. sirch2

    Thread Starter Well-Known Member

    Jan 21, 2013
    Thanks guys. I picked SD as a compare and contrast example because I already have it running on an ATMega328 so I thought it would be good to try to understand what the equivalent would be doing that in the PIC world and as I said I was a bit surprised that there didn't seem to be any complete, easy to follow tutorials. May be I'm just a bit thick.

    I did find the MAPS tool but after putting in some basic requirements I still ended up with a list of hundreds of parts. It would be nice to have some pointers on how to narrow this down.

    Anyway I may well pick up a PICkit 3 in the not too distant future and have a play...
  5. bance


    Aug 11, 2012
    Try this thread....

    HTH Steve
  6. atferrari

    AAC Fanatic!

    Jan 6, 2004
    Maybe (stress on maybe) you find making a choice difficult because you are trying to choose one and only one micro from that big lot.

    I use:

    18F452 - dated et al, when I need to test anything simple.

    18F4520 - when a comparator is also needed. Successful control of three switchd cap filters worked OK.

    18F4431 - when I need PWM with better resolution (lower frequencies) because it has a special module with an extra prescaler.

    Because of the lot of RAM it has, I used it also to implement the "Life" game in a 128x64 GLCD (what I enjoyed a lot doing!).

    18F4585 - for CAN

    18F4550 - for basic USB tests.

    All of them 40-pins chips.

    Also I bought 18F1320 and one more that I cannot recall now.

    And to avoid those critical weekends with just one IC burnt, I buy always 4 of each and forget being nervous.

    I always tend to start with a "big" one and when building the final version try to downsize to a smaller one (if available, what locally rarely happens).

    I still use PICstartplus, work in Assembler and my debugging tools are LEDs and carefully progressive testing.
  7. sirch2

    Thread Starter Well-Known Member

    Jan 21, 2013
    Thanks, nice idea to have some general purpose chips and then down size for a specific project. I also tend to buy a few at a time, like you said saves lost time waiting to get replacements.