View previous topic :: View next topic |
Author |
Message |
mmprestine
Joined: 13 Jan 2004 Posts: 29 Location: Green Bay, Wisconsin
|
PIC 18F4525 ISSUE! |
Posted: Thu Jan 20, 2005 4:37 pm |
|
|
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
|
PIC 18F4525 ISSUE! |
Posted: Fri Jan 21, 2005 3:26 am |
|
|
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
|
THANKS |
Posted: Fri Jan 21, 2005 8:31 am |
|
|
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 |
|
|
Tony Guest
|
Re: THANKS |
Posted: Fri Mar 04, 2005 2:14 am |
|
|
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 |
|
|
|
mmprestine
Joined: 13 Jan 2004 Posts: 29 Location: Green Bay, Wisconsin
|
Compiler Upgrade |
Posted: Fri Mar 04, 2005 7:13 am |
|
|
Tony,
Review the compiler supported devices and you will see that you need to upgrade.
Matt |
|
|
|