|
|
View previous topic :: View next topic |
Author |
Message |
Guest
|
#ZERO_RAM side effects? |
Posted: Thu Dec 03, 2009 2:44 pm |
|
|
Hi:
I'm using the #ZERO_RAM directive, and I am wondering if there are any side effects. In the code below, if I use it, my serial ISR does not work. Without the #ZERO-RAM directive, it does
-Jeff
---
Code: | #include <18F67J50.h>
#fuses HS,NOWDT,NOPROTECT
#use delay(clock=20000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7)
/** local definitions **/
char buffer[81]; // Where the serial data is stuffed
char buffer_pos=0;
/** default settings **/
//#ZERO_RAM commented out it works
void main(void)
{
enable_interrupts(INT_RDA);
enable_interrupts(GLOBAL);
while (TRUE)
{
// Service things here
}
}
#int_RDA
void get_buffer(void) // get the message from the GPS module
{
output_toggle(PIN_E2);
if(kbhit()) // check if uart filled
{
buffer[buffer_pos]=getc(); // get info
buffer_pos++;
if(buffer[buffer_pos-1]==10) // Linefeed as end of record
{
// if(log_flag) log_buffer(buffer_pos-1);
//!! Put in a flag to see if read_buffer updated anything
//SentenceID = read_buffer(); // Sentence ID tells us what sentence was read
buffer_pos=0;
}
}
}
|
|
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Dec 03, 2009 2:59 pm |
|
|
What's your compiler version ? CCS has this note on their versions page:
Quote: |
4.014 A problem using ZERO_RAM and ICD=TRUE together on some PIC18 parts is fixed |
|
|
|
Guest
|
|
Posted: Thu Dec 03, 2009 10:03 pm |
|
|
4.101 |
|
|
Ttelmah Guest
|
|
Posted: Fri Dec 04, 2009 3:26 am |
|
|
Add 'ERRORS' to your RS232 directive.
One possibility, is that ZERO_RAM, takes significant time during bootup. Without 'ERRORS', the UART will hang, if more than a couple of characters are received, and not handled. If you were running at a much higher baud rate, I'd say this was 'likely', but at 9600bps, each character takes a mSec, and though in computer terms clearing all the RAM memory takes a lot of cycles, I can't see it taking even remotely near this sort of time....
However the ERRORS directive, ought to _always_ be present when using the hardware RS232, unless you are providing similar code yourself, so it is worth trying.
Best Wishes |
|
|
|
|
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
|