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

Problem with using Microchip hid bootloader with CCS

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



Joined: 09 Mar 2013
Posts: 2

View user's profile Send private message

Problem with using Microchip hid bootloader with CCS
PostPosted: Sat Mar 09, 2013 5:28 pm     Reply with quote

hi.

I'm a noob trying to start learning a bit about pic's. I tried a few examples and they work fine but for more easy, fast try and learn, I installed the Microchip HID Bootloader. After that I can't get the code to work.
PIC entry in bootloader mode is ok, and I haven't problems uploading my user code, but it never works. The same code without bootloader works fine. After all day searching and reading I am going to ask for help. (Sorry if its evident the fault).

Here is the code. What am I doing wrong? thx
Code:

#include <18f4550.h>  //archivo de cabecera
#BUILD(reset=0x800,interrupt=0x808)
#ORG 0,0x07ff {}


#fuses HSPLL,MCLR,NOWDT,NOPROTECT,NOLVP,NODEBUG,USBDIV,PLL5,CPUDIV1,NOVREGEN,NOPBADEN // fuses  configurados
// el fuse que configuramos anteriormente
#use delay(clock=48000000)     // el clock que tendremos a la entrada del CPU

void main() {

// configurando registros
    disable_interrupts(global);   // desactivando interrupciones globales
    setup_adc_ports(NO_ANALOGS);  // desactivando puertos analogicos   
    set_tris_d(0x0);              // configurando los puertos como salidas

    output_d (0);               

while(1){
      output_d (0);       // saca un nivel bajo en el portb
      delay_ms(1000);     // pause  de 1 Seg
      output_d (255);    // saca un nivel alto en el portb
      delay_ms(1000);     // pause de 1 Seg
   }
}
knack



Joined: 09 Mar 2013
Posts: 2

View user's profile Send private message

PostPosted: Sun Mar 10, 2013 12:50 pm     Reply with quote

After another few hours of checking .... Mad

I got this code working:
Code:

#include <18f4550.h>  //archivo de cabecera
#fuses HSPLL,MCLR,NOWDT,NOPROTECT,NOLVP,NODEBUG,USBDIV,PLL5,CPUDIV1,NOVREGEN,NOPBADEN // fuses  configurados
// el fuse que configuramos anteriormente
#use delay(clock=48000000)     // el clock que tendremos a la entrada del CPU

//#BUILD(reset=0x1000,interrupt=0x1008)
//#ORG 0x000,0x07ff {}

#build(reset=0x1000,interrupt=0x1008)
#org 0x0000,0x0FFF {}
void loader(void) {}


void main() {

// configurando registros

    disable_interrupts(global);   // desactivando interrupciones globales
    setup_adc_ports(NO_ANALOGS);  // desactivando puertos analogicos   
    set_tris_d(0x0);              // configurando los puertos como salidas
   
// Programa de parpadeo

    output_d (0);                 // saca un nivel bajo de salida en los puertos

while(1){
      output_d (0);       // saca un nivel bajo en el portb
      delay_ms(3000);     // pause  de 1 Seg
      output_d (255);    // saca un nivel alto en el portb
      delay_ms(1000);     // pause de 1 Seg
   }
}

Adding in the first line of the hex file:
Code:
:020000040000FA

before upload with Microchip HID 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