18F4550.BAL, PBPL, and USB


Closed Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    644

    Default 18F4550.BAL, PBPL, and USB

    Hi all,

    There are two versions of the file 18F4550.BAL. One is for USB use and the other one is for PBPL use. The two files are shown in the next thread (thank you DT).

    http://www.picbasic.co.uk/forum/show...8949#post68949

    I'm working in a project that combines PBPL and USB. The problem that I have is that if I use the 18F4550.BAL PBPL version then I get the following errors

    Code:
    ERROR: Macro USBINIT? not found in macro file.
    ERROR: Macro USBSERVICE? not found in macro file.
    ERROR: Macro USBIN?CBBL not found in macro file.
    ERROR: Macro USBOUT?CBBL not found in macro file.
    But, if I use the USB file version then I get errors like

    Code:
    ERROR: Unable to fit variable Var_Name
    where Var_Name is a LONG variable. I worked out a "fix" for this problem by modifying the 18F4550.BAL file the following way

    BANKA $0000, $005F
    BANK0 $0060, $00FF
    BANK1 $0100, $01FF
    BANK2 $0200, $02FF
    BANK3 $0300, $03FF
    BANK4 $0400, $04FF
    BANK5 $0500, $05FF
    BANK6 $0600, $06FF
    BANK7 $0700, $07FF
    EEPROM $F00000, $F000FF
    'LIBRARY "PBPPI18L"
    LIBRARY "PBPUS18L"

    include "PIC18EXT.BAS"

    PORTL VAR PORTB
    PORTH VAR PORTC
    TRISL VAR TRISB
    TRISH VAR TRISC

    include "PBPPI18L.RAM"
    So far, my setup is been working fine. However, the PIC uses BANK 4, 5, 6, and 7 for the USB module, so by me enabling these BANKS I suspect I'm doing something horribly wrong. The USB interface is been working fine like I said before, but this might be pure luck.

    Is there a better fix for this PBPL and USB problem? If I only disable BANKS 4 and 5, would that be a better fix? Why is the "EEPROM $F00000, $F000FF" line disabled in the original files?

    Thank you all for your help.

    Robert
    "No one is completely worthless. They can always serve as a bad example."

    Anonymous

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959

    Default

    Hi Robert,

    The original USB files (prior to 2.60), reserved all of the USB memory for USB.
    But it's not very often that anyone would ever use all of it, so in PBP 2.60 the useage was reduced to only 1 BANK.

    For 18F4550's, it's BANK4.

    In your file for PBP 2.50prior, you must at least comment out the BANK4 line.
    Or PBP variables will be assigned to the same locations as USB buffers.

    But uncommenting the others will free up quite a bit of RAM space.

    hth,
    DT

  3. #3
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    644

    Default

    Thank you Darrel,

    I will comment out the BANK 4 line like you said and will get back with the results. From the attached figure I can see that there is still space in BANK 4 for USB data transfer like you said, unless Ping-Pong Buffers on all EPs is used. I have a very vague idea of what this Ping-Pong issue means, but do you know if EasyHID uses this Ping-Pong Buffers on all EPs?

    Also, do you know why the "EEPROM $F00000, $F000FF" line is commented out in the original 18F4550.BAL files?

    Robert

    Name:  USB-Buffer.JPG
Views: 1436
Size:  97.8 KB
    "No one is completely worthless. They can always serve as a bad example."

    Anonymous

  4. #4
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959

    Default

    Nope, PBP doesn't use Ping-Pong buffers.
    So EasyHID doesn't either.

    I think the commented EEPROM line is a carry over from earlier versions, and is handled in the compiler now for 18F's.
    All the other 18F .bas/.bal files have the EEPROM commented.
    The newer chips don't even have an EEPROM line in their files.
    DT

  5. #5
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    644

    Default

    Darrel,

    Thank you. I commented out the BANK 4 line and it compiled without any errors. Everything seems to be working fine. Again, thank you for your help.

    Robert
    "No one is completely worthless. They can always serve as a bad example."

    Anonymous

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts