View previous topic :: View next topic |
Author |
Message |
Minky
Joined: 29 Apr 2009 Posts: 3
|
16f877 #Org problem |
Posted: Wed Apr 29, 2009 1:14 pm |
|
|
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
|
|
Posted: Wed Apr 29, 2009 1:22 pm |
|
|
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
|
|
Posted: Wed Apr 29, 2009 3:49 pm |
|
|
Thanks for the answer! 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
|
|
Posted: Wed Apr 29, 2009 4:12 pm |
|
|
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). |
|
|
|