18 Jun, 2012
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.


main
         (some code here)

         BTFSC PORTB, 7
         GOTO turn_off_led
         BSF PORTB, 7 ;turns on LED
         GOTO main
turn_off_led
         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
Travel inside a Black Hole
How much data can Facebook store?
How to get the new Indian currency symbol on your PC
Air Warrior: Domination
Home