PDA

View Full Version : PIC 18F4550, firmware



kutsi
- 2nd May 2007, 18:36
Hi,

I recently started to use PICBASIC PRO, and trying to write a code which will simply light a led. While using bootloader I recognized that I need to allocate some free space for firmware. How can I do this in PICBASIC? In CCS C, it is possible to write such a code like this.

#build (reset=0x800)
#build (interrupt=0x808)
#org 0x0000, 0x07ff
void bootloader () {

#asm
nop
#endasm
}

skimask
- 2nd May 2007, 18:43
Hi,
I recently started to use PICBASIC PRO, and trying to write a code which will simply light a led. While using bootloader I recognized that I need to allocate some free space for firmware. How can I do this in PICBASIC? In CCS C, it is possible to write such a code like this.
#build (reset=0x800)
#build (interrupt=0x808)
#org 0x0000, 0x07ff
void bootloader () {
#asm
nop
#endasm
}

Which bootloader are you using?
Which PIC are you using?
Which version of PBP are you using?
Why would you need to allocate free space for firmware while using a bootloader?
How complicated is this 'shine an led' program of yours?

kutsi
- 2nd May 2007, 19:28
I guess, firmware needs first 2kb of the memory.Therefore the first 800h bits must be allocated...

PIC18F4550
PICDEM FS USB DEMO TOOL VERSION 1.00

skimask
- 2nd May 2007, 19:30
I guess, firmware needs first 2kb of the memory.Therefore the first 800h bits must be allocated...

PIC18F4550
PICDEM FS USB DEMO TOOL VERSION 1.00

As long as your bootloader is supported by PBP, then you shouldn't have to worry about anything.
What about the rest of the questions?

kutsi
- 2nd May 2007, 19:56
Define ONINT_USED 1

LED var PORTL.0 ' Alias PORTB.0 to LED

loop: High LED ' Turn on LED connected to PORTL.0
Pause 500 ' Delay for .5 seconds

Low LED ' Turn off LED connected to PORTL.0
Pause 500 ' Delay for .5 seconds

Goto loop
End
This is a simple example from the guide.
Do I need to define anythin further? osc 20mhz?

PBP 2.46

skimask
- 2nd May 2007, 20:00
Define ONINT_USED 1
LED var PORTL.0 ' Alias PORTB.0 to LED
loop: High LED ' Turn on LED connected to PORTL.0
Pause 500 ' Delay for .5 seconds
Low LED ' Turn off LED connected to PORTL.0
Pause 500 ' Delay for .5 seconds
Goto loop
End
This is a simple example from the guide.
Do I need to define anythin further? osc 20mhz?

PBP 2.46

Which page is 'Define ONINT_USED 1' on in the guide?

And since when does a PIC18F4550 have a PortL?

kutsi
- 2nd May 2007, 20:08
PORTL.0 is a user defined variable for PORTB.0
PAGE 6

skimask
- 2nd May 2007, 20:13
PORTL.0 is a user defined variable for PORTB.0
PAGE 6

It is? That's a good trick! How about this...
PortL encompasses pins 0 - 7 (PortB for a 40 pin PIC), and PortH encompasses pins 8-15 (PortC for 40 pin PIC).
At least they do according to pg.26 and 27 (section 4.11).

Now then, how about the rest of the questions...again...

kutsi
- 2nd May 2007, 20:19
PBP 2.46
mplab ICD 2 as programmer
mplab IDE 7.5

anything missing?

skimask
- 2nd May 2007, 20:29
PBP 2.46
mplab ICD 2 as programmer
mplab IDE 7.5

anything missing?

Yep...see post #6...
What does 'Define ONINT_USED 1' mean?

kutsi
- 2nd May 2007, 20:38
I don't know exactly what it means. Actually this is a sample code from PBP. The name is Blink.bas

skimask
- 2nd May 2007, 20:39
I don't know exactly what it means. Actually this is a sample code from PBP. The name is Blink.bas

And it probably says it was written for an older version of PBP.
If you do a search here for ONINT_USED, you'll see why that isn't going to work for you...

kutsi
- 2nd May 2007, 21:06
thanks a lot, it works...

skimask
- 2nd May 2007, 21:11
thanks a lot, it works...

Good deal... :)
That's probably my one time this month I'll be of any use to anybody. The rest of this month, I'm just going to sit in a pile of my own drool... :D