CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

timer0 problem on 12F683

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
filjoa



Joined: 04 May 2008
Posts: 260

View user's profile Send private message

timer0 problem on 12F683
PostPosted: Tue Aug 03, 2010 5:38 pm     Reply with quote

hi

I try use timer0 on PIC12F683 but when I use timer0 I cant use other interrupts..

For example, my code if I remove timer0 function my interrupt int_ra3 work fine, if I use code like this, program break on enable_interrupts(INT_RA3)...
Quote:

#include <12F683.h>
#FUSES NOWDT, INTRC_IO, NOCPD, NOPROTECT, NOMCLR, PUT, NOBROWNOUT, NOIESO, NOFCMEN
#use delay(clock=8000000)

int8 n=0;

#int_ra
void int_isr(void)
{
disable_interrupts(GLOBAL);
disable_interrupts(INT_RA3);

reset_cpu();
}

#int_TIMER0
void TIMER0_isr(void)
{
if (n>=7) n=0;
n=n+1;
}

void main()
{
int8 i,aux=0,aux2=0;
int16 time;

enable_interrupts(GLOBAL);
disable_interrupts(INT_RA3);
enable_interrupts(INT_TIMER0);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);


while(input(PIN_A3)==1);

do {
aux=n;
if (input(PIN_A3) == 1) aux2=1;
} while ((aux2 != 1));



time=200;
for (i=0;i<=4;i++)
{
if (i>=2) time=time+90;
output_a(0x01);
output_high(PIN_A5);
delay_ms(time);
output_a(0x02);
output_low(PIN_A5);
delay_ms(time);
output_a(0x03);
output_high(PIN_A5);
delay_ms(time);
output_a(0x06);
output_low(PIN_A5);
delay_ms(time);
output_a(0x07);
output_high(PIN_A5);
delay_ms(time);
output_a(0x16);
output_low(PIN_A5);
delay_ms(time);
}

switch (aux)
{
case 1 : output_a(0x01);
break;
case 2 : output_a(0x02);
break;
case 3 : output_a(0x03);
break;
case 4 : output_a(0x06);
break;
case 5 : output_a(0x07);
break;
case 6 : output_a(0x16);
break;
}

disable_interrupts(GLOBAL);
disable_interrupts(INT_TIMER0);

clear_interrupt(INT_RA3);
enable_interrupts(GLOBAL);
ext_int_edge(H_TO_L);
enable_interrupts(INT_RA3);

delay_ms(10000);
output_a(0x00);
output_low(PIN_A5);

SLEEP();
}

Program stop work when I have bold... someone know a solution to enable interrupt INT_RA3?

Best regards
filjoa



Joined: 04 May 2008
Posts: 260

View user's profile Send private message

PostPosted: Wed Aug 04, 2010 1:53 pm     Reply with quote

hi

some one know if I have an error on my code?

best regards
filjoa



Joined: 04 May 2008
Posts: 260

View user's profile Send private message

PostPosted: Sat Aug 07, 2010 6:21 am     Reply with quote

this problem can not be a bug in CCS?
rockuup



Joined: 07 Aug 2010
Posts: 4

View user's profile Send private message

PostPosted: Sat Aug 07, 2010 8:07 am     Reply with quote

I'm newbie but I think PIN_A3 not support edge detect interrupt. I think only PIN_RA2 is support this
filjoa



Joined: 04 May 2008
Posts: 260

View user's profile Send private message

PostPosted: Sat Aug 07, 2010 11:09 am     Reply with quote

Hi

thanks for your opinion but it support edge detect interrupt, because all work fine if I dont have "enable_interrupts(INT_TIMER0);"

when I dont use "enable_interrupts(INT_TIMER0);" I can enable and disable disable_interrupts(INT_RA3);

I think with the problem stay on INT_TIMER0 but I don't know where... :s
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group