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 CCS Technical Support

Start-Up Code Help Needed

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



Joined: 26 May 2010
Posts: 3

View user's profile Send private message

Start-Up Code Help Needed
PostPosted: Wed May 26, 2010 1:01 pm     Reply with quote

Hello,

I am using the PCH Compiler with MPLAB IDE and I cannot figure out how to correctly include startup code for the MCU (PIC18F6527). Given that I am not using CCS’s IDE there does not appear to be a seamless way to do this.

I have a compiling (multi-C file) project in MPLAB that does not load yet due to the absence of the start-up code. If I try to follow Microchip’s instructions for the Project Wizard to add the start-up code file (either Object or Code Template, e.g. C:\Program Files\Microchip\MPASM Suite\Template\Code\18F6527TEMP.ASM) to my project it sticks the ASM file in the “Other Files” folder instead of the “Source Files” folder in the project. I presume this is because I’ve specified CCS as the Toolsuite, which is a C complier and doesn’t expect ASM source code.

I've searched this forum and was unable to find anything. I would think that the process for integrating start-up code would be one of the most common questions (and problems) people have. This is especially true for those of us who have not purchased the hi-end version of the compiler. Perhaps I've just missed a sticky post somewhere in this forum. If so then I'd appreciate a pointer to it! :O)

Can you please specify the steps I need to take to integrate Microchip’s ASM start-up code into a CCS Toolsuite enabled project? Of course, if CCS has an example of other working start-up code I can use that as well.

Best Regards,

ctmseattle
Ttelmah



Joined: 11 Mar 2010
Posts: 19505

View user's profile Send private message

PostPosted: Wed May 26, 2010 2:27 pm     Reply with quote

Most PICs don't need any startup code at all. What is needed, is automatically inserted by the compiler. The only stuff you need to add, is to initialise the particular peripherals, and for this, the examples are a reasonable source...

Best Wishes
ctmseattle



Joined: 26 May 2010
Posts: 3

View user's profile Send private message

PostPosted: Wed May 26, 2010 3:44 pm     Reply with quote

Well, I have code that compiles but there's nothing in program memory if I open the simulator trace window. Don't I need to specify a far jump to main somwhere to enter C context? I don't think that happens automatically.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed May 26, 2010 3:50 pm     Reply with quote

Start with a simple program that blinks an LED on Pin B0.
Code:

#include <18F6527.h>
#fuses INTRC_IO,NOWDT,PUT,BROWNOUT,NOLVP
#use delay(clock=4000000)

//======================================
void main(void)
{

while(1)
  {
   output_high(PIN_B0);
   delay_ms(500);
   output_low(PIN_B0);
   delay_ms(500);
  }
 
}
ctmseattle



Joined: 26 May 2010
Posts: 3

View user's profile Send private message

PostPosted: Wed May 26, 2010 9:34 pm     Reply with quote

Ok... I tried this sample project and it worked. I then went and re-created my project from scratch including only the main C file at first and that worked too. Added everything else and it's still working. My original project still doesn't work (no source changes) and I don't know why. Perhaps an order of operations glitch somewhere along the line.

Anyway, thank you for your help!

Best Regards,

ctmseattle
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