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

PIC 18F4525 ISSUE!

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



Joined: 13 Jan 2004
Posts: 29
Location: Green Bay, Wisconsin

View user's profile Send private message

PIC 18F4525 ISSUE!
PostPosted: Thu Jan 20, 2005 4:37 pm     Reply with quote

I have an existing application that I am porting from a 18F452 to 18F4525 and have a problem with enabling the RTCC interrupt. A simple program such as:

Code:


#include <18f4525.h>
#device *=16
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=20000000)
#use rs232(baud=19200,xmit=PIN_C6,rcv=PIN_C7,ERRORS,STREAM=COM1)
#zero_ram

#define RTCC_PRELOAD (256 - 256)

long timer_ticks;

#int_rtcc
void rtcc_isr(void)
{
   // Reload the RTCC, so it will keep overflowing every 13 ms.
   set_rtcc(RTCC_PRELOAD);
     
   timer_ticks++;
}

// MAIN PROGRAM
void main(void) {
 
   // Setup the RTCC.
   setup_counters(RTCC_INTERNAL, RTCC_DIV_256 | RTCC_8_BIT);
   set_rtcc(RTCC_PRELOAD);

   // Initiate Interrupts
   enable_interrupts(GLOBAL);
   printf("Enable RTCC Interrupt\r\n\n");
   enable_interrupts(INT_RTCC);   

   // Forever Loop
   while(TRUE) {
   
   printf("Timer Ticks:%Lu\r\n",timer_ticks);
     
   delay_ms(5);

   }
}



will make the processor reset. Has anybody used this new processor and can they veryify the RTCC functionality so I know if it is a chip or compiler issue.
Regards,
Matt
jchait



Joined: 06 Jun 2004
Posts: 3

View user's profile Send private message

PIC 18F4525 ISSUE!
PostPosted: Fri Jan 21, 2005 3:26 am     Reply with quote

Try taking out the zero_ram directive.
I got funny results when using that with the pic18f4585

good luck
mmprestine



Joined: 13 Jan 2004
Posts: 29
Location: Green Bay, Wisconsin

View user's profile Send private message

THANKS
PostPosted: Fri Jan 21, 2005 8:31 am     Reply with quote

Well it worked! If you are using this chip and experience strange things I would recommend removing the #Zero_ram directive if you are using it. I overlooked this for several hours. This is exactly why forums are great! Many eyes to review an issue in the matter of minutes.
Thanks,
Matt Very Happy
Tony
Guest







Re: THANKS
PostPosted: Fri Mar 04, 2005 2:14 am     Reply with quote

Hello,
excuse me but porting 18f452 to 18f4525, have you bought a new version of compiler?
For example, i have got a version 3.177 CCS and there's not the 18f4525.h.
Can you help me?
Thanks
Tony

mmprestine wrote:
Well it worked! If you are using this chip and experience strange things I would recommend removing the #Zero_ram directive if you are using it. I overlooked this for several hours. This is exactly why forums are great! Many eyes to review an issue in the matter of minutes.
Thanks,
Matt Very Happy
mmprestine



Joined: 13 Jan 2004
Posts: 29
Location: Green Bay, Wisconsin

View user's profile Send private message

Compiler Upgrade
PostPosted: Fri Mar 04, 2005 7:13 am     Reply with quote

Tony,
Review the compiler supported devices and you will see that you need to upgrade.
Matt
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