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 CCS Technical Support

Disable Chip When Using Timer0 Interrupt in Pic18F97J60

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



Joined: 25 Aug 2009
Posts: 175

View user's profile Send private message Yahoo Messenger

Disable Chip When Using Timer0 Interrupt in Pic18F97J60
PostPosted: Wed Apr 25, 2012 10:55 am     Reply with quote

Hi all
I have a problem: when I make declaration to use timer0 interrupt, my program not run, and when I test delete declaration of timer0, my program run correctly.
I'm using pic 18F97J60
And PCWH complier 4.078

Config fuses :
Code:

#fuses NOWDT,HS,NOPROTECT,NODEBUG


Setup timer0:
Code:

setup_timer_0( RTCC_INTERNAL);
set_timer0(0);
enable_interrupts(int_timer0);


Please show me way to solve this problem: )
Thanks and regards Smile
_________________
Begin Begin Begin !!!
bkamen



Joined: 07 Jan 2004
Posts: 1615
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Wed Apr 25, 2012 2:14 pm     Reply with quote

You really need to show us a complete example.

I use the 97j60's fairly regularly and don't have the issue you're talking about.

Without seeing the rest, it's hard for me (or any of us) to help.

Post a short but compilable example please.

-Ben

p.s. You're running this on real hardware, right?
_________________
Dazed and confused? I don't think so. Just "plain lost" will do. :D
Ttelmah



Joined: 11 Mar 2010
Posts: 19496

View user's profile Send private message

PostPosted: Wed Apr 25, 2012 2:48 pm     Reply with quote

Obvious thing that would hang the chip, is if you enable the interrupt, have already got the global level enabled, and haven't got a handler present. Instant crash....

Best Wishes
tienchuan



Joined: 25 Aug 2009
Posts: 175

View user's profile Send private message Yahoo Messenger

PostPosted: Thu Apr 26, 2012 3:34 am     Reply with quote

Thanks Ttelmah and bkamen

My program only declares Timer0 interrupt and don't do anything in timer0 ISR, but when I declare Timer0, my program is not run ?

My program :
Code:

void main(void)
   {
      TRISA=0;
      TRISB=0;
      TRISJ=0;
      TRISE=0;
      TRISD=0;
      TRISH=0;
      TRISG=0X04;//rs232
      TRISC=0X80;//rs232
     
      PORTJ=0;
      PORTE=0;
      PORTD=0;
      portb=0;
           
      setup_timer_0( RTCC_INTERNAL);
      set_timer0(0);
     
      //enable_interrupts(int_timer0);
      enable_interrupts(int_rda2);
      enable_interrupts(int_rda);
      enable_interrupts(global);   
     
   
     
      lcd_init();
     
      lcd_putc("\f");
      lcd_gotoxy(1,1);
      printf(lcd_putc,"DO AN TOT NGHIEP");
      lcd_gotoxy(3,2);
      printf(lcd_putc,"DTVT-BKDN");
      delay_ms(3000);
      LCD_MoveLeft(20);
      lcd_putc("\f");
     
      lcd_gotoxy(3,1);
      printf(lcd_putc,"GPS Tracking");
      lcd_gotoxy(3,2);
      printf(lcd_putc,"H&C Solutions");
      delay_ms(2000);
      LCD_MoveRight(20);
      lcd_putc("\f");   
   
     
     
     
      fputs("AT+CMGD=1",ID1);
      fputc(13,ID1);
      delay_ms(500);
           
      //fputs("AT+CDNSORIP=1\n",ID1);// da cau hinh tren sim               AT+CIPSCONT// luu cau hinh nay!
      //delay_ms(1000);
     
      while(1)
      { 
         
       portb=0;
       delay_ms(500);
       portb=0xff;
       delay_ms(1000);
      }
    }



and here is my circuit:
[/img]
_________________
Begin Begin Begin !!!
tienchuan



Joined: 25 Aug 2009
Posts: 175

View user's profile Send private message Yahoo Messenger

PostPosted: Mon Apr 30, 2012 8:59 am     Reply with quote

pls show me way to solve that problem ?
thnks
_________________
Begin Begin Begin !!!
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