PBPL 2.50 observations


Closed Thread
Results 1 to 8 of 8

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Long types are signed. Use SDEC instead of # to format for printing.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  2. #2


    Did you find this post helpful? Yes | No

    Default From the horse's mouth

    Charles Leo has replied to my email as follows.

    It is the "#" modifier in your commands that is giving you incorrect displayed results. The "#" modifier is only intended for use with variables less than 16-bit. This makes it impossible to display LONG decimal values with SEROUT, but you can use the "DEC" modifier with DEBUG, SEROUT2, and HSEROUT.

    Try these display lines:

    debug "Debug version ", DEC lw, ",", DEC lx, ",", DEC ly,_
    ",", DEC lz , $0D, $0A
    serout2 tx232, 84, [ "Serout2 version ", DEC lw, ",",_
    DEC lx, ",", DEC ly, ",", DEC lz, $0D, $0A ] hserout ["HSEROUT version ", DEC lw, ",", DEC lx, ",",_
    DEC ly, ",", DEC lz, $0D, $0A]

    I've noted your points for the next manual revision. I'm planning some samples that demonstrate applications for LONGs.

    Simply put, use LONGs when you need to store a negative value or a value larger than 65535.

    Charles Leo

  3. #3


    Did you find this post helpful? Yes | No

    Default DEC vs SDEC

    Looks to me like SEROUT2 or DEBUG with the SDEC modifier become the preferred serial output modes. They both allow modifiers like DEC and SDEC which plain SEROUT does not. They are also 'self contained' instructions and do not need any interrupt bit clearing like HSERIN/OUT requires.

    Division is still an issue and whether the minus sign is just a convenience for human readers or can actually be used within a PBP calculation is still untested.

    This code,

    LongTest:
    'Mult & Div
    lw = 1234
    lx = 4321
    ly = LX * lw
    lz = lx/lw

    debug $0D, $0A, "Multiply & Divide A, B, (A*B), (A/B)", $0D, $0A
    debug "Debug DEC ", dec lw, ",", dec lx, ", ", dec ly, ", ", dec lz , $0D, $0A
    serout2 tx232, 84, [ "Serout2 DEC ", dec lw, ",", dec lx, ",", dec ly, ",", dec lz, $0D, $0A ]
    debug "Debug SDEC ", sdec lw, ",", sdec lx, ", ", sdec ly, ", ", sdec lz , $0D, $0A
    serout2 tx232, 84, [ "Serout2 SDEC ", sdec lw, ",", sdec lx, ",", sdec ly, ",", sdec lz, $0D, $0A ]
    ' Serout tx232, 2, ["Serout version ", dec lw, ",", dec lx, ",", dec ly, ",", dec lz, $0D, $0A ]
    'Add & Subtr
    lw = 65534
    lx = 66000
    ly = lw + lx
    lz = lw - lx
    debug $0D, $0A, "Add & Subtract A, B, (A+B), (A-B)" , $0D, $0A
    debug "Debug DEC ", dec lw, ",", dec lx, ",", dec ly, ",", dec lz , $0D, $0A
    serout2 tx232, 84, [ "Serout2 DEC ", dec lw, ",", dec lx, ",", dec ly, ",", dec lz, $0D, $0A ]
    debug "Debug SDEC ", sdec lw, ",", sdec lx, ",", sdec ly, ",", sdec lz , $0D, $0A
    serout2 tx232, 84, [ "Serout2 SDEC ", sdec lw, ",", sdec lx, ",", sdec ly, ",", sdec lz, $0D, $0A ]
    ' Serout tx232, 2, ["Serout version ", dec lw, ",", dec lx, ",", dec ly, ",", dec lz, $0D, $0A ]
    Gives these results

    Multiply & Divide A, B, (A*B), (A/B)
    Debug DEC 1234,4321, 5332114, 3
    Serout2 DEC 1234,4321,5332114,3
    Debug SDEC 1234,4321, 5332114, 3
    Serout2 SDEC 1234,4321,5332114,3

    Add & Subtract A, B, (A+B), (A-B)
    Debug DEC 65534,66000,131534,4294966830
    Serout2 DEC 65534,66000,131534,4294966830
    Debug SDEC 65534,66000,131534,-466
    Serout2 SDEC 65534,66000,131534,-466

Similar Threads

  1. PBP and PBPL
    By keymuu in forum mel PIC BASIC Pro
    Replies: 45
    Last Post: - 30th January 2009, 18:58
  2. USB PBPL Compile errors
    By Rob in forum USB
    Replies: 11
    Last Post: - 7th April 2008, 09:18
  3. PBP 2.50 UPGRADE problems!!!!
    By earltyso in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 7th March 2008, 16:42
  4. IF..AND/OR..THEN and PBPL
    By duncan303 in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 25th January 2008, 17:45
  5. PBP 2.50 pbpw vs pbpl .exe
    By Archangel in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 21st September 2007, 16:28

Members who have read this thread : 0

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