It is currently 15 Dec 2018 08:54

All times are UTC + 1 hour




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: timer question
PostPosted: 21 Feb 2018 16:17 
Offline

Joined: 21 Feb 2018 15:12
Posts: 5
i am using pic18f26k80. i need to have timer alternate 30 minute cycles. i got it to do 6 & 12 minute cycles and then modified code to try to do 30 minute cycles with the following code and it did not work. any sugestions?
int counter;
int x;
void interrupt()
{
if(INTCON.TMR0IF)
{
if(counter <180001)
{
TMR0L = 50271;
INTCON.TMR0IF = 0;
counter++;
}
else
{
counter = 0;
TMR0L = 50271;
INTCON.TMR0IF = 0;
counter++;
}
}
}
void main()
{
INTCON = 0b10100000;
T0CON = 0b11000111;
PORTC = 0b00000000;
TRISC = 0b00000000;
while(1)
{
x = counter;
if(x <90001)
{
LATC = 0b00000100;
}
else
{
LATC = 0B00000000;
}
}


}


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

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 3 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: