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

PIC24 #ORG

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



Joined: 17 Dec 2006
Posts: 4

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

PIC24 #ORG
PostPosted: Tue May 10, 2011 2:05 pm     Reply with quote

Hi,
I'm having trouble with the #ORG directive in the PCD rev 4.120 compiler. I need to locate a constant at 0xC00 and to have my main program start at 0x0C02. When I compile the code below, my interrupt routine is located at 0x0C02 and main is somewhere else.

I'm trying to use the 'mini-bully' bootloader to allow updating of my firmware and it requires that I place a constant at 0xC00 which represents the number of seconds to wait for a serial bootload attempt and that the code start location start at 0xC02.

Any guidance would be appreciated.

Code:

#include <24FJ64GA002.h>
#device ADC=10
#use delay(clock=8000000)       // 8 Mhz internal
#FUSES NOWDT                    //No Watch Dog Timer
#FUSES NOJTAG                   //JTAG disabled
#FUSES NOPROTECT                //Code not protected from reading
#FUSES NOWRT                    //Program memory not write protected
#FUSES NODEBUG                  //No Debug mode for ICD
#FUSES IOL1WAY                  //Allows only one reconfiguration of peripheral pins
#FUSES WINDIS                   //Watch Dog Timer in non-Window mode
#FUSES WPOSTS16                 //Watch Dog Timer PostScalar 1:32768
#FUSES NOCKSFSM                 //Clock Switching is disabled, fail Safe clock monitor is disabled
#build(stack = 512)             // This line required or all %f printf formats will cause a stack overflow crash
#define PGM_END      (getenv("PROGRAM_MEMORY")-1)
#define PGM_START    0x0C02
#org PGM_START, PGM_END  default
int had_timer1_interrupt = 0;

void main(void)
{
  int i;
  setup_timer1(TMR_INTERNAL|TMR_DIV_BY_64);   // 8Mhz/2/256 = 62500 tics per second
  enable_interrupts(INT_TIMER1);
  while(1)
  {
      if(had_timer1_interrupt)
      {
         output_toggle(PIN_A3);
         had_timer1_interrupt = 0;
      }
  }
         
}

#INT_TIMER1
void timer1_handler()
{
   had_timer1_interrupt=1;
}
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