boot loader problem

Coding and general discussion relating to the compiler

Moderators: David Barker, Jerry Messina

Post Reply
richardb
Posts: 310
Joined: Tue Oct 03, 2006 8:54 pm

boot loader problem

Post by richardb » Mon Feb 05, 2007 3:53 pm

I've been using the following program to test a problem i've been having with an lcd display.

it seems the following program only displays on the lcd if it's been programmed from an epic programmer, if i use the mcloader the board flashes but nothing is displayed on the lcd.

Device = 18F458
Clock = 20

// some LCD options...
#option LCD_DATA = PORTD.4
#option LCD_RS = PORTB.4
#option LCD_EN = PORTB.5

// import LCD library...
Include "LCD.bas"
Include "utils.bas"

// program start...
SetAllDigital
TRISA.4 = 0
DelayMS(1000)
Cls

WriteAt(1,1,"Hello World")
While TRUE
PORTA.4 = Not PORTA.4
DelayMS(1000)
Wend
End


Any ideas?

Richard
Hmmm..

Bruce
Posts: 16
Joined: Sun Oct 29, 2006 5:54 pm
Contact:

Post by Bruce » Mon Feb 05, 2007 4:15 pm

Does the loader firmware have LVP enabled?
Regards,

Bruce
http://www.rentron.com

User avatar
mister_e
Posts: 28
Joined: Fri Oct 06, 2006 2:02 pm
Location: Montréal, Canada
Contact:

Post by mister_e » Mon Feb 05, 2007 6:46 pm

It will not solve the problem, but i'd spotted a slight problem in the SetAllDigital command

Code: Select all

I103_F1_000014 ; L#MK SETALLDIGITAL
104_F5_000445 ; L#MK ADCON1 = $0F
        MOVLW 15
        MOVWF ADCON1,0
I105_F5_000446 ; L#MK CMCON = $07
        MOVLW 7
        MOVWF CMCON,0
CMCON setting is O.K, but ADCON1 should be 7.

Using ADCON1=$0F leaves AN3, AN2, AN0 to analog

So just modify your code to...

Code: Select all

        Device = 18F458
        Clock = 20
        
        // some LCD options...
        #option LCD_DATA = PORTD.4
        #option LCD_RS = PORTB.4
        #option LCD_EN = PORTB.5
        
        // import LCD library...
        Include "LCD.bas"
        Include "utils.bas"
        
        // program start...
        ADCON1=7
        CMCON=7
        TRISA.4 = 0
        DelayMS(1000)
        Cls
        
        WriteAt(1,1,"Test2...")
        While TRUE
            PORTA.4 = Not PORTA.4
            DelayMS(1000)
            Wend
        End 
I don't have any handy 18F458... so can't check, but it worked with a 18F452

So as Bruce said, double check that your LVP mode is disabled (wich is enabled by default), HS mode is selected and that you're using the 20MHz bootloader firmware.

richardb
Posts: 310
Joined: Tue Oct 03, 2006 8:54 pm

Post by richardb » Mon Feb 05, 2007 9:33 pm

I assumed the bootloader would disable LVP

ps it does flash the led.
Hmmm..

User avatar
mister_e
Posts: 28
Joined: Fri Oct 06, 2006 2:02 pm
Location: Montréal, Canada
Contact:

Post by mister_e » Mon Feb 05, 2007 11:13 pm

Maybe it flash the LED, but the PORTB.5 pin is configured as the PIC PGM pin. Hence, it disable this I/O and your LCD don't work.

It's actually just a little mistake in the default Bootloader firmware file. Just set LVP to OFF, then save it. Will be fixed forever.

richardb
Posts: 310
Joined: Tue Oct 03, 2006 8:54 pm

thanks it worked

Post by richardb » Tue Feb 06, 2007 8:10 am

yep that cured it.


the 248,258,448 and 458 all have the same problems in any osc speed inc the newest 40mhz ones.

Will these be updated with a compiler update?

thanks a lot for the help.
Hmmm..

Post Reply