meche
Junior Member level 2
Please I am new to the pic microcontroller and I just started with pic16f84a. My development platform is the MPLAB IDE, and PICKIT3. After building my hardware on a breadboard, I programmed the chip accordingly but the LED refused to blink. The project is just to blink an LED on and off (port RB0) with a delay of 1000ms. The led comes up but doesn't blink. I used a 8MHz crystal oscillator with two ceramic capacitors of value 20pF. I am just wondering what I am not doing right?
Do I need to set the OSCCON register? does the pic16f84a even have one? Below is my code for the header file:
Do I need to set the OSCCON register? does the pic16f84a even have one? Below is my code for the header file:
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 #pragma config FOSC = HS // Oscillator Selection bits (HS oscillator) #pragma config WDTE = OFF // Watchdog Timer (WDT disabled) #pragma config PWRTE = OFF // Power-up Timer Enable bit (Power-up Timer is disabled) #pragma config CP = OFF // Code Protection bit (Code protection disabled) // #pragma config statements should precede project file includes. // Use project enums instead of #define for ON and OFF. #include <xc.h> #include "newxc8_header.h" #define _XTAL_FREQ 8000000 void main(void) { TRISB0=0; while(1) { RB1=1; __delay_ms(1000); RB1=0; __delay_ms(1000); } return;
Last edited by a moderator: