# Sparkfun Programmer w/ PIC16F883

#### jakegwood

Joined Apr 13, 2011
29
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

#### spinnaker

Joined Oct 29, 2009
7,837
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.

#### spinnaker

Joined Oct 29, 2009
7,837

#### jakegwood

Joined Apr 13, 2011
29
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.

Thanks again!

#### spinnaker

Joined Oct 29, 2009
7,837
www.sourceboost.com[/URL] 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.
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.

#### thatoneguy

Joined Feb 19, 2009
6,359
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.
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.

#### jakegwood

Joined Apr 13, 2011
29
Spinnaker: But isn't that just a set of ZIF sockets?

#### AlexR

Joined Jan 16, 2008
732
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.
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.

#### jakegwood

Joined Apr 13, 2011
29

#### t06afre

Joined May 11, 2009
5,934

http://store.melabs.com/prod/u2/U2BUN.html

I video I was watching brought this up... just wondering what makes it so much more expensive too...
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

Rich (BB code):
#include <p16F690.inc>
with
Rich (BB code):
#include <p16f883.inc>
And
Rich (BB code):
__config (_INTRC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_OFF & _MCLRE_OFF & _CP_OFF & _BOR_OFF & _IESO_OFF & _FCMEN_OFF)
with
Rich (BB code):
__CONFIG    _CONFIG1, _LVP_OFF & _FCMEN_ON & _IESO_OFF & _BOR_OFF & _CPD_OFF & _CP_OFF & _MCLRE_OFF & _PWRTE_ON & _WDT_OFF & _INTRC_OSC_NOCLKOUT
__CONFIG    _CONFIG2, _WRT_OFF & _BOR21V

#### spinnaker

Joined Oct 29, 2009
7,837
Spinnaker: But isn't that just a set of ZIF sockets?

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.