Sparkfun Programmer w/ PIC16F883

Discussion in 'Embedded Systems and Microcontrollers' started by jakegwood, Jan 23, 2012.

  1. jakegwood

    Thread Starter New Member

    Apr 13, 2011
    29
    0
    So about two years ago I got a programming board from Sparkfun (http://www.sparkfun.com/products/4) and a couple 16F883 and unfortunately I didn't put too much time into learning about them. I just picked it up today and in order to test it, I want to make sure I have code that works and also that uses the internal oscillator. I believe the firmware is out of date, so I'll have to take care of that first, but I just want to make sure I have code that works. So, if someone just has basic LED blinking code (in assembly, I assume?) that they know will work for this chip using the internal oscillator (much of what I found online requires a outside crystal) it would be great if you could post it!

    Thanks,

    Jake
     
  2. spinnaker

    AAC Fanatic!

    Oct 29, 2009
    4,887
    1,012
    Do yourself a favor and forget about that programmer and get one of these:

    http://www.microchipdirect.com/ProductSearch.aspx?Keywords=DV164131

    It comes with a demo board and lessons. Everything ready to go.

    You could also get the PicKit II which is older and does not support the newer Pics but has a couple of features the III does not have like a logic analyzer which you will find very useful.

    http://www.microchipdirect.com/ProductSearch.aspx?keywords=PG164120

    There are tons of tutorials on the internet on how to do things with Pics. All you need to do is search,


    Here is a good one.
    http://www.mikroe.com/eng/products/view/285/book-pic-microcontrollers-programming-in-c/

    You don't need to do assembler. You can program in C or BASIC. The 18F family is optimized to work with C but C will work on the 16F.
     
  3. spinnaker

    AAC Fanatic!

    Oct 29, 2009
    4,887
    1,012
    Wow $49.95! Sorry to see that. You could have easily bought a PicKit III for that price. I don't understand how Sparkfun can do that to their customers.


    BTW the PicKits will allow you to do in circuit programming and debugging. Extremely useful once you start building circuits.
     
  4. jakegwood

    Thread Starter New Member

    Apr 13, 2011
    29
    0
    I was going to get that from the get-go, but I really wanted to have the ZIF socket.
     
  5. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    6,357
    718
    I don't find a use for the ZIF outside of big EPROMs anymore

    For PICs, just put them on a breadboard, then run the MCLR, V+, GND, PGC, and PGD to a 5 pin header plugged into the breadboard and with a voltage regulator you are ready to go if you have a PICKit 2 or 3

    However, since you already have that, go to www.sourceboost.com and download their compiler. The free mode is not very limited, and even the full version costs $50 (non-commercial use). There are many sample programs that come with it (from blinking an LED to LCD Display to Real Time OS), just choose your PIC as the target, and hit Build, then program the .hex file with your board.
     
  6. spinnaker

    AAC Fanatic!

    Oct 29, 2009
    4,887
    1,012
    There are better options.

    I have a set of these

    http://www.j1sys.com/icsp-adapters/
     
  7. jakegwood

    Thread Starter New Member

    Apr 13, 2011
    29
    0
    Okay... that's good to know. I didn't know they were that easy to adapt. I thought the ZIF was necessary to keep all the pins in one state. Thanks for the advice.

    So the compiler is needed... but what about my programmer... that won't upgrade that too, will it? I have been having trouble uploading the software I downloaded from the sparkfun website.

    Thanks again!
     
  8. spinnaker

    AAC Fanatic!

    Oct 29, 2009
    4,887
    1,012
    I have always thought that their memory limitations are a bit restrictive for the free version, even the lite version. The only version that that is worth it is the full version and I might be tempted just to go for the c++ version.

    C18 and HiTech are unlimited for memory but you do have some optimization limits.
     
  9. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    6,357
    718
    He has PIC16 chips, so C18 isn't an option. Hi-Tech doesn't do any optimization, which requires more memory.

    If he just wants to blink an LED, I doubt he will hit any limits of any compiler he chooses though. MikroC is another choice he can look at as well.

    If he decides to buy, BoostC is the best bang for buck, which is why I am in love with it.
     
  10. jakegwood

    Thread Starter New Member

    Apr 13, 2011
    29
    0
    Spinnaker: But isn't that just a set of ZIF sockets?
     
  11. AlexR

    Well-Known Member

    Jan 16, 2008
    735
    54
    Frankly I wouldn't bother with the C++ version. I made the mistake of paying extra for the C++ but I find that I don't use any of the C++ features and use it as a straight out C compiler.
    A full blown C++ program using classes will eat up a lot more RAM/ROM resources than equivalent C program and the 8 bit PIC chips just don't have the resources to waste.
     
  12. jakegwood

    Thread Starter New Member

    Apr 13, 2011
    29
    0
  13. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    Forget all about ZIF sockets. They are not needed. But some like to keep that illusion alive. So they can trick you to purchase worthless programmers. To days PIC programmers are ICSP type. That means you can program the chip in circuit. No need to take in and out of circuit. Depending on the chip only 5 or 6 wires are needed.
    So to your code. I think you can use the PICKIT2 Starter Kit Lessons found here http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName=en023805 Scroll down to you find code examples section.
    You have to replace

    Code ( (Unknown Language)):
    1. #include <p16F690.inc>
    with
    Code ( (Unknown Language)):
    1.  
    2. #include <p16f883.inc>
    3.  
    And
    Code ( (Unknown Language)):
    1.  
    2. __config (_INTRC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_OFF & _MCLRE_OFF & _CP_OFF & _BOR_OFF & _IESO_OFF & _FCMEN_OFF)
    3.  
    4.  
    with
    Code ( (Unknown Language)):
    1.  
    2. __CONFIG    _CONFIG1, _LVP_OFF & _FCMEN_ON & _IESO_OFF & _BOR_OFF & _CPD_OFF & _CP_OFF & _MCLRE_OFF & _PWRTE_ON & _WDT_OFF & _INTRC_OSC_NOCLKOUT
    3.  __CONFIG    _CONFIG2, _WRT_OFF & _BOR21V
    4.  
     
  14. spinnaker

    AAC Fanatic!

    Oct 29, 2009
    4,887
    1,012

    Yes they are Zif sockets but they have sim sockets along side them so you can make connections for prototyping. Personally I like them but to each his own.
     
Loading...