| 
	
	|  |  |  
	
		| View previous topic :: View next topic |  
		| Author | Message |  
		| Simon Guest
 
 
 
 
 
 
 
			
			
			
			
			
			
			
			
			
 
 | 
			
				| How to use #ORG with function declearation? |  
				|  Posted: Wed Jul 23, 2003 11:52 am |   |  
				| 
 |  
				| 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
 
 
 
			    
 
 | 
			
				| Re: How to use #ORG with function declearation? |  
				|  Posted: Wed Jul 23, 2003 11:59 am |   |  
				| 
 |  
				| 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
 |  |  
		|  |  
		|  |  
  
	| 
 
 | 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
 
 |