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

How to use #ORG with function declearation?

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







How to use #ORG with function declearation?
PostPosted: Wed Jul 23, 2003 11:52 am     Reply with quote

Hi,

For example, if I want to place a function in 0x0800, 0x09FF, I do this:

#ORG 0x0800, 0x09FF
void foo() {
....
}
void bar() {
....
}

but if I want to declear this function on top, what should I do?

void foo(); --- don't work,
void bar();
Compiler will issue error that different difinition on foo

#ORG 0x0800, 0x09FF
void foo();
void bar(); --- don't work,
Compiler will issue error that different difinition on bar

What should I do? Please help, thank you!

Simon
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516290
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

Re: How to use #ORG with function declearation?
PostPosted: Wed Jul 23, 2003 11:59 am     Reply with quote

To use #org with function prototypes, you must declare the
prototype as #separate. Example:

#include "c:\Program Files\Picc\Devices\16F877A.H"
#fuses HS, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock = 8000000)
#use rs232(baud = 9600, xmit=PIN_C6, rcv = PIN_C7, ERRORS)

#separate
my_func();

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

my_func();

while(1);
}
//==========================================

#org 0x400, 0x500
my_func()
{
char i;
i = 5;
}


___________________________
This message was ported from CCS's old forum
Original Post ID: 144516291
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