Libstock
It is currently 25 Oct 2014 00:50

All times are UTC + 1 hour




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: 01 Dec 2011 08:10 
Offline

Joined: 01 Dec 2011 07:49
Posts: 5
using tmr0 at pic 16f877a to make 10 min delay or what ever the delay using 4 MHz oscillatory i tried to write the code but there is error and this is the code
unsigned i;
void interrupt(){
intcon = 0b00100000;
i++;
if (i==305)
portd=1;
tmr0if_bit=0;
tmr0=0;

}
void main() {
intcon = 0b10100000;
option_reg = 0b00000111;
trisd=0;
trisb=0;
PORTB=0;
portd=0;
tmr0=0;
i = 0;
while(1)
{
if(tmr0if_bit=1){
interrubt;
}
}
}

and thanks in advance


Top
 Profile  
 
PostPosted: 01 Dec 2011 10:39 
Offline
User avatar

Joined: 16 Jun 2011 13:48
Posts: 3565
Hello,

I do not know whether there are typing mistake or not, but you can not call interrupt function from your code.
And if you are doing polling you do not need interrupt function.

You can check timer interrupts examples in examples folder in compiler.

Best regards.


Top
 Profile  
 
PostPosted: 01 Dec 2011 13:50 
Offline

Joined: 01 Dec 2011 07:49
Posts: 5
janko.kaljevic wrote:
Hello,

I do not know whether there are typing mistake or not, but you can not call interrupt function from your code.
And if you are doing polling you do not need interrupt function.

You can check timer interrupts examples in examples folder in compiler.

Best regards.


thnx it is work :)


Top
 Profile  
 
PostPosted: 01 Dec 2011 13:52 
Offline

Joined: 01 Dec 2011 07:49
Posts: 5
thnx it is work nw :)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: Bing [Bot], LDias, Majestic-12 [Bot] and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group