Here is my first circuit with a microcontroller. It is a PIC16F886. I have programmed the PIC using a Pickit 2 that simply lights a LED on PORTC PIN 0 (RC0). From the PicKit 2 everything works as it should. So I made up this circuit and cannot get anything. I am running off a 7.5V DC adaptor (actually 13.3V) going through a 7805 Voltage Regulator. When I don't have my chip in Voltage at output is 5 volts right on. When I put my chip in Voltage at my Voltage Regulator Output is 10.5V I have a 1uf capacitor between my output and ground on my Voltage Regulator. I have a 4 mhz ceramic resonator on my OSC1 and OSC2 (Pins 9 and 10 of my PIC). I have a .01mf capacitor between my VDD and Vss (Pins 19 and 20 of my PIC.)
Here is my program. Its pretty simple and straighforward.
Any help is greatly appreciated. This simple circuit is driving me crazy. Thanks.
Here is my program. Its pretty simple and straighforward.
Rich (BB code):
#include <pic.h> //Include Hitech CC Header File
__CONFIG (HS, MCLREN, WDTDIS, PWRTEN, BORDIS, LVPDIS, UNPROTECT); //Config for PIC16F886 Master Clear Reset, High Power,
#define LED1 RB0
main() //Calling the MAIN Function
{ //Start of the MAIN Function
ANSEL = 0; //Initialize A/D ports off
CM1CON0 = 0; //Initialize Comparator 1 off
CM2CON0 = 0; //Initialize Comparator 2 off
PORTB = 0x00;
PORTC = 0x00; //Clear PORTC ports. In hex.
RBPU = 0; //Weak Pullups enabled on PORTB
TRISC = 0x00; //All PORTC I/O outputs
//TRISC = 0xFF; //All PORTA I/O inputs **Commented Out**
PORTA = 0b00001000; //RA3 Is an input. Same as the above line that is commented out, except I did an individual port (RA3)
TRISB = 0x00; //PIC16F886 All PORTC are set as outputs
while (1 == 1) //The While Loop. Loops forever
{ //The Start of the While Loop
// if (RA3 == 1) //The If-Else Loop. Test RA3 Port
// { //The Start of the If-Else Loop
LED1 = 1; //If SW1 not pressed, turn on RC0/DS1 LED
// } //The End of the If part of the If-Else Loop
// else //The Else part of the If-Else Loop
// { //The Start of the Else Part of the If-Else Loop
// RC0 = 0; //If SW1 pressed, turn off RC1/DS1 LED
// } //The End of the Else part of the If-Else Loop
} //The End of the While Loop
} //The End of the MAIN Function
Attachments
-
291.7 KB Views: 22
-
293.9 KB Views: 21
-
276.1 KB Views: 19