Microchip HID Boorloader for 18f4550- delays not working

General discussion on mikroC.
Post Reply
Author
Message
Tamilblaze
Posts: 3
Joined: 23 Jan 2012 15:02

Microchip HID Boorloader for 18f4550- delays not working

#1 Post by Tamilblaze » 23 Jan 2012 18:58

Hi all,

I have successfully burned the HID bootloader, and the pic 18f4550is getting detected. I burn a simple application that blinks a LED at PORTD.F3 (i.,e port RD3).

The programming is also successful via the bootloader ( i use the latest 2.9 series bootloader where the "magic line" :020000040000FA is not required)

The led is blinking but no matter what delay i set the LED keeps blinking at a constant rate. If i burn the code using a standard JDM programmer (without bootloader code all goes well.

I have not overwritten the bootloader section. my code starts at 0x1030. i thought may be the bootloader code tampers with the timer, oscillator and interrupt registered so i manually coded them to mimic their reset states (i refered the 18f4550 data sheets on resetstate of every register) still no luck. How much ever i give delay uisng Delay_ms() function, i get a constant blink rate. Pls suggest any ideas.

My whole project is stuck because of this. Need your help! kindly let me know in case you need more details

my code:
#pragma orgall 0x1030
void main()
{
UCON=0x00;
STKPTR=0x00;
INTCON=0x00;
INTCON2=0xFF;
INTCON3=0xC0;
TMR0H=0x00;
T0CON=0x00;
OSCCON=0x40;
T1CON=0x00;
TMR2=0x00;
T2CON=0x00;
ADCON0=0x00;
ADCON1 = 0x0F;
ADCON2=0x00;
CCP1CON=0x00;
CCP2CON=0x00;
T3CON=0x00;
IPR2=0xFF;
PIR2=0x00;
PIE2=0x00;
IPR1=0xFF;
PIR1=0x00;
PIE1=0x00;
OSCTUNE=0x00;
TRISD=0x00;
for(;;)
{
PORTD.F3=1;
Delay_ms(5000);
PORTD.F3=0;
Delay_ms(5000);
}
}

User avatar
janko.kaljevic
Posts: 3565
Joined: 16 Jun 2011 13:48

Re: Microchip HID Boorloader for 18f4550- delays not working

#2 Post by janko.kaljevic » 24 Jan 2012 10:44

Hello,

I have checked your code and tested it with our USB HID bootloader and Delay function is working fine.

From this point I can not tell what could cause this.

Best regards.

Tamilblaze
Posts: 3
Joined: 23 Jan 2012 15:02

Re: Microchip HID Boorloader for 18f4550- delays not working

#3 Post by Tamilblaze » 25 Jan 2012 18:13

Janko,

you are awesome. Thanks for sending me the hex files to boot load the PIC.

I really love MikroC for its superiority and flexibility.

The LED is blinking properly now. No need of all those initialization.

:D

you made me happy. Have a great day!

Post Reply

Return to “mikroC General”