ragav4456
Full Member level 4
- Joined
- Aug 1, 2012
- Messages
- 228
- Helped
- 19
- Reputation
- 38
- Reaction score
- 17
- Trophy points
- 1,308
- Activity points
- 2,568
Hi frnds
I have problem in Internal oscillator selection in PIC16f886. I tried the following code, its not working.
Configuration bits declaration error will come.
Code:
#include <htc.h>
// 13-1 12-0 11-0 10-0 9876-0 5-1 4-1 3-0 100
//__CONFIG(0x2034);
//__CONFIG _CONFIG2(0X0100);
__CONFIG _CONFIG1(FOSC_INTRC_NOCLKOUT & WDTE_OFF & PWRTE_OFF & MCLRE_ON & CP_OFF & CPD_OFF & BOREN_ON & IESO_OFF & FCMEN_ON & LVP_ON)
__CONFIG _CONFIG2(BOR4V_BOR40V & WRT_OFF);
void main()
{
int value;
TRISA=0x00;
PORTA=0x00;
TRISB-0x00;
PORTB=0xFF;
OSCCON= 0b01100101;
OSCTUNE= 0x0E;
while(1)
{
PORTB=0xFF;
for(value=0;value<10000;value++);
for(value=0;value<10000;value++);
PORTB=0x00;
for(value=0;value<10000;value++);
for(value=0;value<10000;value++);
}
}
I have problem in Internal oscillator selection in PIC16f886. I tried the following code, its not working.
Configuration bits declaration error will come.
Code:
#include <htc.h>
// 13-1 12-0 11-0 10-0 9876-0 5-1 4-1 3-0 100
//__CONFIG(0x2034);
//__CONFIG _CONFIG2(0X0100);
__CONFIG _CONFIG1(FOSC_INTRC_NOCLKOUT & WDTE_OFF & PWRTE_OFF & MCLRE_ON & CP_OFF & CPD_OFF & BOREN_ON & IESO_OFF & FCMEN_ON & LVP_ON)
__CONFIG _CONFIG2(BOR4V_BOR40V & WRT_OFF);
void main()
{
int value;
TRISA=0x00;
PORTA=0x00;
TRISB-0x00;
PORTB=0xFF;
OSCCON= 0b01100101;
OSCTUNE= 0x0E;
while(1)
{
PORTB=0xFF;
for(value=0;value<10000;value++);
for(value=0;value<10000;value++);
PORTB=0x00;
for(value=0;value<10000;value++);
for(value=0;value<10000;value++);
}
}