Making PBP code more modular


Closed Thread
Results 1 to 31 of 31

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    You're welcome forgie!

    The @ symbol in col 1 is more of a MicroCode Studio problem.

    If the @ is in any other column, MCS won't highlight it as an ASM statement. It still compiles just fine in both PM and MPASM no matter how far it's indented. But, it can sure be confusing.<br><br>
    DT

  2. #2
    forgie's Avatar
    forgie Guest


    Did you find this post helpful? Yes | No

    Default

    Thanks Darrel, you are correct - I use MCS and I didn't even try compiling with tabs before the @ symbols - but I just indented all my @ statements and of course it compiles and works fine.

    With the local variables - of course resources are limited, and the concept of local variables wouldn't be appropriate (or would they?) in a number of situations. What I'm thinking is this: you have different types of vars that you define as such:

    <code>
    SUB MY_SUB
    i VAR LOCAL BYTE
    temp VAR LOCAL WORD
    x VAR WORD
    .....
    RETURN
    END SUB
    </code>

    The 'LOCAL' VARs would be reallocated for each SUB. When programming, you would have to ensure that your LOCAL vars can lose their value whenever a GOSUB is used. Other variables defined locally will be have their own allocation. Given that the 18f452 has 1500 bytes of memory surely some other people would find this useful?

    Perhaps you could solve all memory problems by using memory addresses (pointers) as arguments for SUBS:

    <code>
    ..
    GOSUB MY_SUB(a, b, c)
    ..


    SUB MY_SUB(WORD x, WORD y, BYTE d)
    i VAR LOCAL BYTE
    temp VAR LOCAL WORD
    .....
    x = i + y
    ....
    RETURN
    END SUB
    </code>

    Then PBP would just have to make all those vars point to the same address. And perhaps spit out a type-check warning if you pass a byte where a word is expected or whatever.

    Would anyone else find this to make PBP a much more pleasurable and professional compiler?

    Please, please respond with criticism if you disagree with my comments, as that's the only way that I will see the reasons why it isn't a good idea....

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


    Did you find this post helpful? Yes | No

    Default

    OK, so the head scratching worked a little.

    As another example of why I feel that INCLUDE files and Macros's are two of the most usefull features of PicBasic Pro.

    Here's an example of an INCLUDE file that uses a single macro to generate some pretty neat BARgraphs. Just Include the file, and away you go.

    LCD BARgraphs
    http://www.picbasic.co.uk/forum/showthread.php?p=12475
    <br>
    Last edited by Darrel Taylor; - 9th September 2005 at 21:23.
    DT

  4. #4
    mytekcontrols's Avatar
    mytekcontrols Guest


    Did you find this post helpful? Yes | No

    Thumbs up I like it! I like it! Hey Mikey likes it!

    Hi Darrel,

    I haven't been on this board in a while (busy doing some contract work --- gotta make money). I see besides writing a great LCD routine you have been enhancing your posts as well (I especially liked the video presentation). And hey it all looked great under FireFox.

    Keep up the great work,
    Michael

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


    Did you find this post helpful? Yes | No

    Default

    Thanks Mikey,

    I think it took longer to figure out how to post it, than it did to write it in the first place. Thanks for noticing.
    And, thanks for the Firefox update. I always wonder if I'm getting that part right or not.

    I hope that contract work is PIC related.
    <br>
    DT

  6. #6
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Wink

    Nice and useful ... Despite it keeps users from undestanding LCD use and special characters ...

    New " pseudo-problem threads" in sight ...

    Thanks for that nice work , Darrel
    Last edited by Acetronics2; - 11th September 2005 at 08:40.
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  7. #7
    mytekcontrols's Avatar
    mytekcontrols Guest


    Did you find this post helpful? Yes | No

    Smile Whew!! Finally back to writing PBP code again

    Darrel,
    I hope that contract work is PIC related
    Yes it was, but unfortunately it wasn't done in PBP. Actually it is a ressurection of pic assembly code I wrote back in 1998, with some minor changes to adapt it to newer hardware.
    If you are interested, here is a link to what I was doing: www.mytekcontrols.com/specialproducts/
    What had originally started out as a contract proposal, changed into an actual product instead. This allowed me to retain the rights to sell it to anyone, and kept it more affordable for the buyer since they weren't paying for the full engineering time (it gets spread out over several unit sales --- hopefully).

    Now I am back to working on my main project (StampVue), which has an OS written in PBP. In fact this morning I just got an Auto Baud Detect PBP routine to work for it, which I'll be posting some sample code in an appropriate forum within the next couple of days.

    I'll need to do some catching up on your macro escapades. Which I can see from other posts, you've been busy as well.

    I hope all is well with you,

Similar Threads

  1. PBP Extensions, What are they?
    By PJALM in forum PBP Extensions
    Replies: 9
    Last Post: - 28th September 2021, 11:26
  2. PBP code to read R/C signal from receiver
    By malc-c in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 28th October 2009, 21:51
  3. Making Program Code Space your playground...
    By Melanie in forum Code Examples
    Replies: 15
    Last Post: - 19th July 2008, 08:26
  4. 4 Chanel Dmx512 ready assembly code to PBP ?
    By syscoder in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 21st March 2007, 23:55
  5. convert code "c" lcd graphic to pbp
    By nicolasronan in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 19th June 2006, 15:49

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