|
|
View previous topic :: View next topic |
Author |
Message |
knack
Joined: 09 Mar 2013 Posts: 2
|
Problem with using Microchip hid bootloader with CCS |
Posted: Sat Mar 09, 2013 5:28 pm |
|
|
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
|
|
Posted: Sun Mar 10, 2013 12:50 pm |
|
|
After another few hours of checking ....
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:
before upload with Microchip HID Bootloader. |
|
|
|
|
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
|