18 Jun, 2012 by Vishnu Aravind
Here's a quick tip for you. Every time you use a microcontroller (like PIC, AVR, anything for that matter) in your project, you'd definitely have a main loop that keeps looping the entire time. So, the best way to know if your microcontroller is indeed working and that it has not reset itself or done something funny, is to just toggle an output at the end of the loop. You can connect this to an LED with a resistor. Below is sample Assembly code for PIC.

         (some code here)

         BTFSC PORTB, 7
         GOTO turn_off_led
         BSF PORTB, 7 ;turns on LED
         GOTO main
         BCF PORTB, 7
         GOTO main

The LED connected to the 8th bit of PORTB keeps toggling after every loop, so you can tell whether the microcontroller is executing the program and is not stuck.

Suggested links:

We live in exponential times. We use so ...
What would it be like to travel inside a...
Ever wondered how many photos there are ...
When Windows XP first came out, we were ...
For generations we had used 'Rs.&#...
It's been a very long time since a n...