Picbasic Pro divide problem


Closed Thread
Results 1 to 8 of 8

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default Re: Picbasic Pro divide problem

    Yes, R2 is one of PBP's internal "System Registers" and if not used immediately the value would be changed.

    Floating point is overrated, and not normally required.
    Decimal places can usually be dealt with using integer math.

    If fctr is a variable and the value is *1000 (2266 = 2.266), then you can just multiply the pulses by the same amount and use DIV32.

    Code:
        circ = puls * 1000
        circ = DIV32 fctr
    This one takes longer to execute and uses more code space than the previous example.
    DT

  2. #2
    Join Date
    Nov 2011
    Posts
    18


    Did you find this post helpful? Yes | No

    Default Re: Picbasic Pro divide problem

    Hi Darrel , thanks again. I used your DIV32 remainder tip to do the rounding to 1mm.
    I still have enough flash for my refinements
    circ = puls * 1000
    circ = (DIV32 fctr)
    @ MOVE?WW R2, _Remainder ; Get remainder of Div32
    if remainder*10/fctr>4 then circ=circ+1

    Hebe

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


    Did you find this post helpful? Yes | No

    Default Re: Picbasic Pro divide problem

    Great!

    Nice addition Hebe.
    DT

  4. #4
    Join Date
    Mar 2011
    Location
    Grapevine Texas
    Posts
    10


    Did you find this post helpful? Yes | No

    Default Re: Picbasic Pro divide problem

    Darrel, you are a very cleaver guy!

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