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


Closed Thread
Results 1 to 11 of 11
  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.

  7. #7
    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,
    FinelineIDE looks like a terrific program.
    Unfortunately, it doesn't work for me.
    Can't figure out how to get it to produce the .LST file.
    Can't figure out how to use a Picstart+ programmer.
    But the killer is that it doesn't like my touchpad mouse.
    The mouse vertical scroll feature gets locked on and scrolls
    all over the place.
    Fineline default horizontal scroll cuts off the first 9 columns.
    Can fix it with the horizontal scroll bar, but it pops back to cutting
    off 9 after a vertical scroll.
    If I actually use the mouse horizontal scroll, all it likes to pop to the
    middle so nothing shows.
    I can indent a couple of times so the program is visible most of the time,
    but it still shifts horizontally against my will. To be fair, this is an
    ancient touchpad with a win2k driver running on win7...but it seems to work
    on everything else.

    Can't use it for general programming, but it might come in handy
    debugging those cases where I have nested IF statements with
    the endifs in the wrong places.

    I bit the bullet and used the DEFINE syntax to put Pictype in the .bas file.
    Wrote a program to parse it out, construct a pbpw command line
    then post-process the hex file to remove the configuration word for the
    bootloader. One click and I got hex exactly like I want it from whatever
    source file I use.

    Thanks, mike

  8. #8
    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?

    To bad about FineLine. It really is a nice program.

    Just curious, what are you using to write your PBP code with and what did you use to write the parser/command line to create the hex?
    Dave
    Always wear safety glasses while programming.

  9. #9
    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?

    I use windows notepad to write picbasic code. My programs are simple, typically
    fit on two pages. I do all the heavy lifting with Hotpaw Basic on a Palm.
    The pic just interfaces hardware and sends raw data via RS232 or SIR or bluetooth/SPP
    to the Palm. It's usually interrupt driven, so I've found simulators pretty much useless.

    I used quickbasic to write the parser/control code for PBPW until I ran into a situation
    where I absolutely had to use a long filename. After a LONG search, I finally switched
    to FREEBasic and the companion fbide. It's very short on debugging help, but it
    has a lot of nice string functions. The dialect is annoyingly different from QB,
    but documentation is good. Been working out well for writing small "scripts".

    I don't recall exactly why I didn't use VisualBasic6, but think it had to do with wanting
    a single .exe file I could transport to another machine without a lot of drama.

    I'd like to expand my user interfaces from Palm to WinCE. Best free basic-like compiler
    I've found is Aristar Dialect. Works, but I'd like more control over the serial
    port hardware. Any ideas in that area?

    Thanks, mike

  10. #10
    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?

    No, I do not have any ideas other than the serial module in python. But it seems like you are pretty setup with good system so why change?

    Brings back some memories... Palm, to bad they went away.
    Dave
    Always wear safety glasses while programming.

  11. #11
    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?

    At least two problems with Palm. The file system, or lack thereof.
    Real pita to log more than 4K of data.
    And they're going away.
    Serial connectors are way too fragile for general use, and they're
    going away too. I have way more bluetooth and wifi WinCE PDA's
    than Palms.

    I'm seriously hampered by my cheapness, I won't pay for software,
    and lack of programming skill. The free tools have low capability, they're old
    so won't support newer features and
    typically won't create an executable file.
    I can cobble together a VB6 program because it hides all the details, but I can't handle "C".
    My "C" capability peaks out at a very small subset of K&R.
    With this newfangled stuff, you have to know how to create an overloaded,
    subclassed, instance of a WM_Paint..or is it WM-PaInT or wm_Paint or ...GRRRR!...
    Darned Hungarians!!!.... know which include files to include
    and make a deal with the devil just
    to get "Hello World" to compile. I'm too stoopid for that. Starting with
    a working example of "Hello World" in C++, I couldn't even get it changed to
    "goodbye cruel world". I know it's somewhere in that mass of includes, defines, resource
    files and string tables and on and on and on. Why can't I just type, 'print "hello word"'
    and be done with it?
    Seems like all the cheap or free stuff is C-like.

    Anyway, it's a hobby. I just need to find a FREE basic-like compiler for a WinCe PDA.

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