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

#ZERO_RAM side effects?

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








#ZERO_RAM side effects?
PostPosted: Thu Dec 03, 2009 2:44 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Dec 03, 2009 2:59 pm     Reply with quote

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








PostPosted: Thu Dec 03, 2009 10:03 pm     Reply with quote

4.101
Ttelmah
Guest







PostPosted: Fri Dec 04, 2009 3:26 am     Reply with quote

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
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