With 8-bit PIC's like the 12C509, there are no Flash equivallents. You are either good at programming and get it right first time, or you fill up a garbo skip parked outside your office/house/garden shed with dead parts that didn't work because you made a boo-boo programming these one-time parts. To help the terminally dsylexic, Microchip came out with the J-series UV eraseable parts. Cooking them under a UV lamp for quarter of an hour, or out in the sunlight in the Arizona desert for two years (the non-urgent projects) would neatly erase the chip. Unfortunately, it also erased the OSCCAL value (see further down). So you had to read the chip FIRST, and then replace the OSCCAL value by writing that value back into your program or presetting it manually into your programmer.
The 12F675 and it's dinky brothers has TWO sets of configuration bits which should be preserved at program time. These are the OSCCAL and BANDGAP bits. Most sensible programmers (the machines not the people) can be set to avoid overwriting these bits when programming or erasing the chip which means you can dispense with reinserting them back into your program. Hell... you got 1,000 12F675's to program it'll be a bit of a chore to read the value from each of them first and to embed it manually thereafter. So basically, you can dispense with PBP's OSCCAL defines and setting for the 12F675... it's really intended for UV parts.
You're just about to ask "Why are these bits important?", so I'll tell you...
The OSCCAL value trims the internal 4MHz oscillator to as close to 4Mhz as they can be bothered to get it in the factory. Still no replacement for using an Xtal or Resonator when doing high-speed comms, but the internal oscillaor is however reliable enough for 2400 baud providing you don't screw-up OSCCAL too much. If you do lose OSCCAL by inadvertantly erasing it, the chip is still fully useable, but the timing won't be 4.000MHz... (it never is anyway) but could vary by a percentage point or so. Let's face it, if you're blinking an LED at one Hz, you don't really care if it's 1.0000Hz, or 0.98Hz or 1.02Hz.
The BANDGAP bits are used to trim the on chip voltage reference. This voltage reference is NOT the VRef for the Comparators set by VRCON, but just a variable voltage divider used to trim the reference for POR/BOR. If they are changed the reference will probably not meet the accuracy specifications in the Data Sheet. No big deal for Hobbyists or non-critical applications either.
@ DEVICE INTRC_OSC_NOCLKOUT
The above line tells the PIC to use the internal oscillator (INTRC_OSC) no xtals, resonators or other external circuitry required, and we don't want the clock appearing on any pin (NOCLKOUT) leaving BOTH those pins available for I/O.
@ DEVICE MCLR_OFF
That line tells the PIC to use it's internal MCLR circuitry, and leaves that pin free for Input. Note that the MCLR pin (GP3) is INPUT ONLY.
Melanie
Bookmarks