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

enabling timer interrupt cause reset
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
tophe59



Joined: 13 Oct 2005
Posts: 32
Location: France

View user's profile Send private message

PostPosted: Tue Oct 25, 2005 4:57 am     Reply with quote

I have made simplify code. But same problem Crying or Very sad Heeelp meeee Crying or Very sad

Code:
#include "18F4620.h"


#use delay (clock=10000000)
#fuses HS,NOWDT,NOPROTECT,NOLVP// ,H4
#use fast_io(A)
#use fast_io(B)
#use fast_io(C)
#use fast_io(D)
#use fast_io(E)

// a faire:
// animer du texte
// ...

//***definition des E/S Divers  ***

#define pwm1   pin_c1   //         psx -> moteur 1
#define pwm2   pin_c2   //          psx -> moteur 2


//**** definition des commande******


//******Déclaration des variables globales *********
   int    i,j,secondes,adc_preced;
   int      tps_servo,servo[8];
   int    image_n,menu_choix;
   int      duty1;
   int    xdraw,ydraw; //position X Y pour drawblaise
   long   intertim;


//***************** timer 1 **********************
#int_timer1
   void timer1()
   {//      5< servo <23
   SET_TIMER1(0xfe0b+get_timer1()); //inter toutes les 200us (ck timer 0.2us)
   }
//***************** main **********************
   void main(void)
   {
   set_tris_c(0x11);//port c 0=en sortie      set_tris_c(0x00);//sortie
   set_tris_d(0x00);
   set_tris_b(0x00);
   set_tris_a(0x00);//sortie
//   set_tris_a(0xff);//entrée
   set_tris_e(0x00);//sortie

   setup_timer_1 (T1_INTERNAL|T1_DIV_BY_8); //init timer

   enable_interrupts(INT_TIMER1);
   enable_interrupts(global);
   for(;;){delay_us(10);}
   }



Code:
         Filename: test_timer.LST

               ROM used: 246 bytes (0%)
                         Largest free fragment is 65286
               RAM used: 44 (1%) at main() level
                         46 (1%) worst case
               Stack:    1 worst case (0 in main + 1 for interrupts)

*
0000:  GOTO   00C0
*
0008:  MOVFF  FE8,05
000C:  MOVFF  FD8,06
0010:  MOVFF  FE0,07
0014:  MOVLB  0
0016:  MOVFF  FE9,0D
001A:  MOVFF  FEA,08
001E:  MOVFF  FE1,09
0022:  MOVFF  FE2,0A
0026:  MOVFF  FD9,0B
002A:  MOVFF  FDA,0C
002E:  MOVFF  FF3,14
0032:  MOVFF  FF4,15
0036:  MOVFF  FFA,16
003A:  MOVFF  00,0F
003E:  MOVFF  01,10
0042:  MOVFF  02,11
0046:  MOVFF  03,12
004A:  MOVFF  04,13
004E:  BTFSS  F9D.0
0050:  GOTO   005A
0054:  BTFSC  F9E.0
0056:  GOTO   00A0
005A:  MOVFF  0F,00
005E:  MOVFF  10,01
0062:  MOVFF  11,02
0066:  MOVFF  12,03
006A:  MOVFF  13,04
006E:  MOVFF  0D,FE9
0072:  MOVFF  08,FEA
0076:  MOVFF  09,FE1
007A:  MOVFF  0A,FE2
007E:  MOVFF  0B,FD9
0082:  MOVFF  0C,FDA
0086:  MOVFF  14,FF3
008A:  MOVFF  15,FF4
008E:  MOVFF  16,FFA
0092:  MOVFF  05,FE8
0096:  MOVFF  07,FE0
009A:  MOVFF  06,FD8
009E:  RETFIE 0
....................  #include "18F4620.h"
....................  //////// Standard Header file for the PIC18F4620 device //////////////// 
.................... #device PIC18F4620 
.................... #list 
.................... 
....................   
....................   
.................... #use delay (clock=10000000) 
.................... #fuses HS,NOWDT,NOPROTECT,NOLVP// ,H4 
.................... #use fast_io(A) 
.................... #use fast_io(B) 
.................... #use fast_io(C) 
.................... #use fast_io(D) 
.................... #use fast_io(E) 
....................   
.................... // a faire: 
.................... // animer du texte 
.................... // ... 
....................   
.................... //***definition des E/S Divers  *** 
....................   
.................... #define pwm1   pin_c1   //         psx -> moteur 1 
.................... #define pwm2   pin_c2   //          psx -> moteur 2 
....................   
....................   
.................... //**** definition des commande****** 
....................   
....................   
.................... //******Déclaration des variables globales ********* 
....................    int    i,j,secondes,adc_preced; 
....................    int      tps_servo,servo[8]; 
....................    int    image_n,menu_choix; 
....................    int      duty1; 
....................    int    xdraw,ydraw; //position X Y pour drawblaise 
....................    long   intertim; 
....................   
....................   
.................... //***************** timer 1 ********************** 
.................... #int_timer1   
....................    void timer1() 
....................    {//      5< servo <23 
....................    SET_TIMER1(0xfe0b+get_timer1()); //inter toutes les 200us (ck timer 0.2us)   
00A0:  MOVF   FCE,W
00A2:  MOVFF  FCF,03
00A6:  ADDLW  0B
00A8:  MOVWF  2C
00AA:  MOVLW  FE
00AC:  ADDWFC 03,W
00AE:  MOVWF  2D
00B0:  MOVFF  2D,FCF
00B4:  MOVFF  2C,FCE
....................    tps_servo++; 
00B8:  INCF   1C,F
....................    } 
....................   
....................   
....................   
....................   
....................   
....................   
.................... //*************************************************** 
.................... //*************************************************** 
.................... //*************************************************** 
.................... // 
.................... //                   Prog principal 
.................... // 
.................... //*************************************************** 
.................... //*************************************************** 
.................... //*************************************************** 
....................   
00BA:  BCF    F9E.0
00BC:  GOTO   005A
....................    void main(void) 
....................    { 
00C0:  CLRF   FF8
00C2:  BCF    FD0.7
00C4:  BSF    0D.7
00C6:  CLRF   FEA
00C8:  CLRF   FE9
00CA:  MOVF   FC1,W
00CC:  ANDLW  C0
00CE:  IORLW  0F
00D0:  MOVWF  FC1
00D2:  MOVLW  07
00D4:  MOVWF  FB4
....................    set_tris_c(0x11);//port c 0=en sortie      set_tris_c(0x00);//sortie 
00D6:  MOVLW  11
00D8:  MOVWF  F94
....................    set_tris_d(0x00); 
00DA:  MOVLW  00
00DC:  MOVWF  F95
....................    set_tris_b(0x00); 
00DE:  MOVWF  F93
....................    set_tris_a(0x00);//sortie 
00E0:  MOVWF  F92
.................... //   set_tris_a(0xff);//entrée 
....................    set_tris_e(0x00);//sortie 
00E2:  MOVWF  F96
....................   
....................    setup_timer_1 (T1_INTERNAL|T1_DIV_BY_8); //init timer 
00E4:  MOVLW  B5
00E6:  MOVWF  FCD
....................   
....................    enable_interrupts(INT_TIMER1); 
00E8:  BSF    F9D.0
....................    enable_interrupts(global); 
00EA:  MOVLW  C0
00EC:  IORWF  FF2,F
....................    for(;;){delay_us(10);} 
00EE:  MOVLW  08
00F0:  MOVWF  00
00F2:  DECFSZ 00,F
00F4:  BRA    00F2
00F6:  BRA    00EE
....................   
....................   
....................    } 
.................... 
00F8:  SLEEP

Configuration Fuses:
   Word  1: 0200   HS NOIESO NOFCMEN RESERVED
   Word  2: 1E1F   BROWNOUT NOWDT BORV21 NOPUT WDT32768
   Word  3: 8300   CCP2C1 PBADEN NOLPT1OSC MCLR RESERVED
   Word  4: 0081   STVREN NODEBUG NOLVP NOXINST RESERVED
   Word  5: C00F   NOPROTECT NOCPD NOCPB
   Word  6: E00F   NOWRT NOWRTD NOWRTC NOWRTB
   Word  7: 400F   NOEBTR NOEBTRB
tophe59



Joined: 13 Oct 2005
Posts: 32
Location: France

View user's profile Send private message

PostPosted: Tue Oct 25, 2005 4:59 am     Reply with quote

i bugging

Last edited by tophe59 on Tue Oct 25, 2005 8:06 am; edited 1 time in total
tophe59



Joined: 13 Oct 2005
Posts: 32
Location: France

View user's profile Send private message

PostPosted: Tue Oct 25, 2005 5:00 am     Reply with quote

i bugging

Last edited by tophe59 on Tue Oct 25, 2005 8:07 am; edited 1 time in total
tophe59



Joined: 13 Oct 2005
Posts: 32
Location: France

View user's profile Send private message

PostPosted: Tue Oct 25, 2005 5:00 am     Reply with quote

i bugging

Last edited by tophe59 on Tue Oct 25, 2005 8:07 am; edited 1 time in total
tophe59



Joined: 13 Oct 2005
Posts: 32
Location: France

View user's profile Send private message

PostPosted: Tue Oct 25, 2005 5:01 am     Reply with quote

i bugging

Last edited by tophe59 on Tue Oct 25, 2005 8:08 am; edited 1 time in total
tophe59



Joined: 13 Oct 2005
Posts: 32
Location: France

View user's profile Send private message

PostPosted: Tue Oct 25, 2005 5:02 am     Reply with quote

i bugging

Last edited by tophe59 on Tue Oct 25, 2005 8:08 am; edited 1 time in total
tophe59



Joined: 13 Oct 2005
Posts: 32
Location: France

View user's profile Send private message

PostPosted: Tue Oct 25, 2005 5:36 am     Reply with quote

I have some problem's with my "reply" Laughing

If a moderator can clean this. Thank's
asmallri



Joined: 12 Aug 2004
Posts: 1679
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Tue Oct 25, 2005 6:14 am     Reply with quote

tophe59 wrote:
I have some problem's with my "reply" Laughing

If a moderator can clean this. Thank's


You can clean it yourself (provided you are logged in). When you visit a thread that you have already posted on you will note an X in the top bar of the message window. This will delete your post.
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Tue Oct 25, 2005 6:44 am     Reply with quote

tophe59 wrote:
I have some problem's with my "reply" Laughing

If a moderator can clean this. Thank's


Quite often when you post a thread that contains a large amount of text, you will get an error. The post however still works. If you go back and check after 30-60 seconds you will see it and then you won't keep posting. You can delete a post if is the last post in the thread. Otherwise, you can edit the post and remove all the text.
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Tue Oct 25, 2005 6:57 am     Reply with quote

If you are using the debugger, shouldn't you have
Code:
#device ICD=TRUE
in your code?

The debug pins are on port b. It seems to me that
Code:
set_tris_b(0x00); 
will make the debug pins outputs and cause the debugger to crash (stop) working. I would comment out this line and see what happens.
tophe59



Joined: 13 Oct 2005
Posts: 32
Location: France

View user's profile Send private message

PostPosted: Tue Oct 25, 2005 10:09 am     Reply with quote

Ok i'm just testing the code with a 16f877 and no problem.

I am lost Confused
tophe59



Joined: 13 Oct 2005
Posts: 32
Location: France

View user's profile Send private message

PostPosted: Wed Oct 26, 2005 2:09 am     Reply with quote

Now that work Shocked

I think the firmware of my ICD2 was in question. The fact to change 18F to 16F anf 18F again do now it work.

Thank's all for your help ! Wink
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
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