PDA

View Full Version : How can I turn off USB support in 18F4550



BrianT
- 6th September 2007, 03:25
I have a simple BLINK program that uses 92 words in a 16F877A, 146 bytes in an 18F4620 and a HUGE 2104 bytes in the 18F4550. A quick look at the .LST file shows a lot of routines for the USB port are loaded by default.

I don't need the USB port in my current project but I do need the code space. How can I prevent the USB support being loaded by default? Sadly I am stuck with the 18F4550 for this job.

The BLINK code follows.

' Example program to blink an LED connected to PORTB.5

' define osc 4
define loader_used 1

LED var portb.5

loop: High led
Pause 100
Low led
Pause 100
High led
Pause 100
Low led
Pause 100
High led
Pause 100
Low led
Pause 2000
Goto loop
End


' A PIC 16F877A using PBP 2.47 and PM assembler uses 92 words
' A PIC 16F877A using PBP 2.47 and MPASM uses 89 words.
' A PIC 18F4680 with PBP 2.47 & MPASM uses 146 bytes.
' A PIC 18F4550 using PBP 2.47 and MPASM uses 2104 bytes because it loads
' the USB libraries - need to kill that.

BrianT
- 6th September 2007, 03:56
I can now compile BLINK to 146 bytes.

The problem is simple. I copied the USB demo program from USBDemo http://www.picbasic.co.uk/forum/showthread.php?t=5418
and all its files to c:\testcode last week. This has a number of files xxxx.BAS, .INC, .ASM and yyyy.MAC.

I then wrote the simple BLINK program and placed it in the same c:\testcode directory. It seems PBP uses its BAS, RAM, INC, etc files from c:\testcode first rather than from c:\pbp.

By deleting all files from c:\testcode except BLINK.PBP, the program now uses only 146 bytes.

What a relief.