Can I define the device and configuration word in the pbp source file?


Closed Thread
Results 1 to 11 of 11

Hybrid View

  1. #1
    Join Date
    May 2009
    Posts
    7

    Default Can I define the device and configuration word in the pbp source file?

    Can I define the device and configuration word in the pbp source file?

    I'm looking for a simple way to get the device and configuration
    word defined in the PBPv2.42a .bas source file.
    Something like this:

    device pic16F877A, HS_osc, wdt_off, lvp_off, protect_off

    that would propagate through PBPW, PM to create a hex file
    that I can import into mpasm and program with a picstart+.

    I prototype with a PIC16F877a, with a bootloader, but would like to be able
    to target a different device/configuration word for the final
    version.

    I have tools cobbled together over the years.
    I have a batch file that calls pbpw/PM with the device on the command
    line. I have to edit the 16f877a.inc file for the configuration word.
    For the bootloader, I even had to edit the configuration word out of the
    hex file, 'cause the early bootloader wrapped the address space and
    trashed the start of the program.
    This works for one processor type and configuration, but is
    getting cumbersome and error prone with multiple processor types.

    From another thread I've tried variations of
    @ DEVICE WDT_OFF
    This fixes the wdt.
    @ DEVICE Pic16f877a
    creates an error message if you compile with the wrong processor in
    the command line, but I want it to be THE processor definition so I don't
    need a separate batch file for each combination.
    How do I define the processor in the file?

    Is there an easy way to define the device and configuration
    word in the basic source file? I'm not afraid to hack on the PBP
    files.

    Only thing I can think to try is to create new defines? Maybe then modify
    the default pbpproc.inc and PBPPROC.BAS with some ifdefs to sort out which include files
    to use...assuming pbp will let me do that?

    But there oughta be an easier way???

    Thanks, mike

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: Can I define the device and configuration word in the pbp source file?

    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    May 2009
    Posts
    7


    Did you find this post helpful? Yes | No

    Default Re: Can I define the device AND configuration word in the pbp source file?

    Thanks, That link is where I found the original info.
    I even went to the trouble to include an excerpt in my original question
    and state why it did not seem to fix all my problems.

    That's HALF the solution to the two questions.

    Quoting that link...again...in more detail...
    @ DEVICE PIC16F628,XT_OSC

    The PIC type is optional, if it is included and you accidentally compile for a chip other than that specified (a 16F628 in this example), the compiler will report an error as a reminder you're potentially doing something wrong.

    End Quote.

    You'll notice that the PIC type does NOT appear to set the PIC type for the compiler.
    It seems to only illicit an error if the compiler command line PIC type differs.
    That's consistent with my attempts to use it. If I remove the PIC type from
    the compiler command line, it defaults to 16F84 and I get the wrong includes
    no matter what I put on the DEVICE line inside the .bas file.

    I want to ACTUALLY set the PIC type INSIDE the .bas file INSTEAD of on the command line.
    The PIC type would then NOT be included on the command line, but taken from the .bas file.
    ALL the required parameters would be encapsulated inside the .bas file.
    I'd need only one batch file to compile all my programs and I wouldn't have to guess
    which parameters to use next year when I try to edit the program.

    How do I do that?

  4. #4
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: Can I define the device and configuration word in the pbp source file?

    I want to ACTUALLY set the PIC type INSIDE the .bas file
    I do not think there is a way to do that. You would still need to tell the batch file where to look for the code. I make a batch file for each project and keep it in the project's directory.
    Dave
    Always wear safety glasses while programming.

  5. #5
    Join Date
    May 2009
    Posts
    7


    Did you find this post helpful? Yes | No

    Default Re: Can I define the device and configuration word in the pbp source file?

    Well, seems like that's what everyone would want to do.
    Command line parameters should OVERRIDE what you put in the source file.

    Let's look at a workaround. IF I put a new DEFINE in the .bas file, it seems to get
    get passed through. If I edit the default .inc and .bas file to include a different
    processor's .inc and .bas files, and don't specify the processor on the command
    line, it seems to work.

    I should be able to edit the pbproc.bas and pbproc.inc files to include files conditioned
    by the new DEFINE. If I call all that without specifying a processor on the
    command line, I get a bunch of redefinition errors. My lack of understanding how preprocessor directives and ifdef's work seems the problem. Or maybe the
    DEFINES haven't been defined by the time I get to the .inc and .bas files.

    Ideas?

    Only other thing I think I know how to do is to parse the source file to pull out the
    processor type in my new DEFINE and use that to fill in the proc type in the
    pbpw command line.
    Shouldn't be hard, just ugly.

    I have more fun playing with the tools than the actual program.

  6. #6
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: Can I define the device and configuration word in the pbp source file?

    You might find this interesting. It is all I use in a windows environment for the past year or so.
    http://www.picbasic.co.uk/forum/cont...75-FineLineIDE

    When on a linux box I do a batch file and write the code in gedit. I use to use emacs a lot, you might be able to do what you want with that tool.
    Dave
    Always wear safety glasses while programming.

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