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

16f877 #Org problem

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



Joined: 29 Apr 2009
Posts: 3

View user's profile Send private message

16f877 #Org problem
PostPosted: Wed Apr 29, 2009 1:14 pm     Reply with quote

Hi, I know there are alot of threads about this problem, but I can't seem to get it right anyway. I have a pic16f877 with a little test-program I found here. The board and pic i'm currently using have Shane Tolmies bootloader on it so when i use the code-line:
Code:
#org 0x1F00, 0x1FFF void loader16F877(void) {} //for the 8k 16F876/7



The compiler version i'm using is CCS 4.86.0.0 with Mplab v8.30 so when i compile i get the usual errors:
Code:
--- Info 300 "mottagare.c" Line 7(17,23): More info:   Segment at 00000-007FF (0000 used)
--- Info 300 "mottagare.c" Line 7(17,23): More info:   Attempted to create: 01F00-01FFF  for #org
*** Error 126 "mottagare.c" Line 7(17,23): Invalid ORG range


The test-code i'm using is following:
mottagare.c
Code:

#include <16F877.H>
#fuses HS,NOWDT,NOPROTECT,BROWNOUT,PUT,NOLVP
#use delay(clock=4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)
#org 0x1F00, 0x1FFF void loader16F877(void) {} //for the 8k 16F876/7
 
//============================
#include <flex_lcd.c>

void main()
{
char c;

lcd_init();

while(1)
  {
   c = getc();     
   lcd_putc(c);   
  }

}


and the flex_lcd.c is the LCD 16x2 driver from this forum.

Any help would be very appreciated!

/Minky
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Apr 29, 2009 1:22 pm     Reply with quote

You're probably using the demo compiler.
http://www.ccsinfo.com/ccsfreedemo.php
The CCS demo only uses the first 2K of the 16F877's ROM space.
The ROM address space only goes from 0x0000 to 0x07FF in the demo.

However, since the compiler won't use that area, you can just delete
that #org line. You can use the bootloader, but your CCS application
programs can only use the first 2K of ROM space.
Minky



Joined: 29 Apr 2009
Posts: 3

View user's profile Send private message

PostPosted: Wed Apr 29, 2009 3:49 pm     Reply with quote

Thanks for the answer! Smile Yeah I use the demo, so basically I can't compile the code and use the Shane bootloader without buying the full version of the compiler?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Apr 29, 2009 4:12 pm     Reply with quote

I think that bootloader will work with the CCS demo. It's just that your
application program is limited to 2K ROM words (-256 for the bootloader).
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