WORLD’S SIMPLEST PROGRAM using PIC12F629




This is where you start with programming. Build the PIC Programmer MkV and build the World’s Simplest circuit on a PC board for a PIC12F629 chip, LED and resistor.
When the World’s Simplest Program is “burnt” into the chip, the LED will flash.
This is not a “normal” program as the Watch-Dog Timer has been turned ON and after 18mS it resets the chip to “org 0X00” and the program executes the 8 instructions again.

Worlds Simplest programme


At the 6th and 7th instruction, the state of GP4 will change from HIGH to LOW or LOW to HIGH and this will toggle the LED.
At the 8th instruction the micro will go to sleep and after about 18,000 microseconds, it will be woken up by the watch-dog timer and go to location 0x00.
At instruction 3, we have added a pre-scaler to the WDT to extend its timing to 18mS x 8 = 0.144Secs. You can change this value and note the different flash-rate.
Making bit 3 of the option_reg = 0 will produce a very fast flash-rate as the prescaler will be removed from the WDT.
This program tests your programmer and the chip you are burning as well as the circuit containing the LED.
It also shows the function of the watch-dog timer.
Normally, when the WDT is turned ON, it must be periodically cleared (reset) via the instruction clrwdt so that it does not come into operation.
For instance, before entering a delay loop, the WDT is reset.
If not, it may reset your program and you will be wondering why your project does not work.
Go to
PIC12F629 data and read page 12: OPTION Register. It shows how the bits are allocated to the WDT. Change these bits and see how the flash-rate changes.

 

For more detail: WORLD’S SIMPLEST PROGRAM using PIC12F629




Current Project / Post can also be found using:

  • pic12f629 programmer
  • pic12f629 programming tutorial
  • pic12f629 programming
  • 12F629 Programming

Leave a Comment

*
= 4 + 5

Read previous post:
PIC-2 USB BURNER
PIC-2 USB BURNER using PIC18F2550

This project is a clone of PICkit-2, (the most successful and cheapest PIC programmer on the market). But PICkit-2 is...

Close
Scroll to top