Help with CCS and Tiny or Screemer Bootloader's

Support for Bloader and Screamer

Moderator: phalanx

Help with CCS and Tiny or Screemer Bootloader's

Postby forrequi » Tue Mar 20, 2007 6:25 am

Good day. ':D'
Can anyone help me with the C code that have to be used to implement a 16F877A bootloading capable C code? I found that the code look's like:

//For 18F2550
#build(reset=0x1, interrupt=0x8)
#ORG 0x0F00,0x0FFF {}


// For 16F88
#build(reset=0x1, interrupt=0x5)
#ORG 0x0F00,0x0FFF {}


The code for 16F877A look like the code above, or no?

// For 16F877A
#build(reset=0x1, interrupt=0x4)
#ORG 0x0F00,0x0FFF {}



Thank's
forrequi
 
Posts: 8
Joined: Tue Mar 06, 2007 9:07 am
Location: Brazil

CCS C and Bloader / Screamer boot loader

Postby Wufkodabi » Tue May 15, 2007 4:23 am

Hi forrequi!

I am using the following code:

Code: Select all
#include <16F877A.h>

#fuses NOWDT, XT, PUT, NOPROTECT, NODEBUG, NOBROWNOUT, NOLVP, NOCPD, NOWRT, NOWRT

//
//  next two statements are to set the program offset for BLOADER to work
#org 0x1F00, 0x1FFF{}                    // for the 16f877
#build(reset=0x4)

void main() {...


Works for me with Bloader v1.4 and Screamer v1.6. My PIC was programmed with the Bloader-877A-4MHz.hex bloader. My CCS C version is PCWH v4.013.

Here is a blink-a-led for you to test:
Code: Select all
#include <16F877A.h>

#fuses NOWDT, XT, PUT, NOPROTECT, NODEBUG, NOBROWNOUT, NOLVP, NOCPD, NOWRT, NOWRT

//
//  next two statements are to set the program offset for BLOADER to work
#org 0x1F00, 0x1FFF{}                    // for the 16f877
#build(reset=0x4)

#use delay (clock=4000000)

void main(void) {

   while(1) {
      Output_high(PIN_B0);
      delay_ms(1000);
      Output_low(PIN_B0);
      delay_ms(1000);
   }
}



Hope this works. I am a beginner with PICs myself, and it is not easy to get started. I must say Bloader/Screamer does make it easier. Good luck!

d.
Wufkodabi
 
Posts: 6
Joined: Tue May 15, 2007 4:12 am

Postby Wufkodabi » Wed Jun 06, 2007 9:19 am

Code: Select all
//  next two statements are to set the program offset for BLOADER to work
#org 0x1F00, 0x1FFF{}                    // for the 16f877
#build(reset=0x4)


I just noticed that, while they worked for my previous programs, these statements give an "invalid org range" error when you use them with interrupts:

"Attempted to create: 00004-00032 for ISR
Invalid ORG range"

I am trying to get a program that uses timer0 to compile, while keeping support for the Bloader boot loader.

I suspect that the interrupt vector somehow gets screwed up. I tried the following as well:
Code: Select all
#build(reset=0x4,interrupt=0x4)
#ORG 0x0F00,0x0FFF {}

Same error. I don't have a firm grasp of the memory organistion of the 16F877A, nor of the ORG and build commands, so I am a bit stuck. Anyone can offer some help?

This is my test code. It is mostly copied right of the web, and is supposed to be working. Ofcourse I added the ORG and build commands to support my boot loader.

Code: Select all
#include <16F877A.h>

#fuses NOWDT, XT, PUT, NOPROTECT, NODEBUG, NOBROWNOUT, NOLVP, NOCPD, NOWRT

//  next two statements are to set the program offset for BLOADER to work (from CCS website)
//  next two statements are to set the program offset for BLOADER to work
#build(reset=0x4,interrupt=0x4)
#ORG 0x0F00,0x0FFF {}

#use delay(clock=4000000)                                                       //set clock base for delay_ms and delay_µs functions
#use rs232(baud=19200, xmit=PIN_C6, rcv=PIN_C7)                                 //set hardware UART speed and pins

// define more sensible names for pin functions
#define LED1   PIN_A1
#define LED2   PIN_A2

#define HIGH_START 255
byte seconds, high_count;

#INT_RTCC
void clock_isr() {
   if(--high_count==0) {
      printf("+");
//      output_high(LED1);
//      delay_us(5);
//      output_low(LED1);
      high_count=HIGH_START;
   }
}

void main() {
   high_count=HIGH_START;
   set_rtcc(0);
   setup_counters(RTCC_INTERNAL, RTCC_DIV_128);
   enable_interrupts(INT_RTCC);
   enable_interrupts(GLOBAL);

   while(TRUE) {
      printf(" -%2X", high_count);
      delay_ms(10);
   }

}
Wufkodabi
 
Posts: 6
Joined: Tue May 15, 2007 4:12 am

Re: Help with CCS and Tiny or Screemer Bootloader's

Postby Skolnik » Thu Apr 22, 2010 5:01 am

Try this:

#build(reset=0x4,interrupt=0x8 )
#ORG 0x0f00,0x0fff {}
Skolnik
 
Posts: 2
Joined: Thu Apr 22, 2010 4:40 am


Return to Boot Loading

Who is online

Users browsing this forum: No registered users and 1 guest