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
I need PIC16f886 timer based 1 min interrupt occur program.
I tried in hitech c compiler, its not working. 4Mhz osc
I need PIC16f886 timer based 1 min interrupt occur program.
I tried in hitech c compiler, its not working. 4Mhz osc
Code:
#include<htc.h>
__CONFIG(0x20A1);
__CONFIG(0X0700);
unsigned int ivalue=0,Display=0;
void main()
{
TRISA=0x03;
PORTA=0x00;
TRISC=0x07;
TRISB=0x00;
PORTB=0x00;
PORTC=0b00000000;
T1OSCEN=0;
ANSEL=0x03;
ANSELH=0x00;
OSCCON= 0b01101101;
OSCTUNE= 0x00;
GIE=1;
PEIE=1;
T0IE=1;
T0CS=0;
T0SE=0;
PSA=0; // Prescaler assign for Timer0
PS2=1,PS1=1,PS0=1;
// OPTION=0X86;
TMR0=0;
PIE1=0;
PIE2=0;
C1ON=0; //Comparator1 off
C2ON=0; //Comparator2 off
SSPEN = 0; //Disable SPI n I2C
while(1)
{
PORTB=~PORTB;
if(ivalue=30)
{
RA4=1;
}
}
}
void interrupt_isr()
{
if(T0IF)
{
T0IF=0;
ivalue++;
}
}