N-Bit_MATH


Closed Thread
Results 1 to 39 of 39

Thread: N-Bit_MATH

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    Whew, had me worried there for a minute.

    In order for the Include file to create the correct size working variables ...
    The PRECISION constant needs to be BEFORE the include file.

    Code:
    PRECISION CON 8 SYSTEM  	' 8 bytes = 64-bit
    INCLUDE "N-Bit_Math.pbp"	' Include Alexander Avtanski's Multibyte Arithmetic 
    				' Assembly Library Wrapped for PBP by Darryl Taylor
    				' Version:1.3 Beta (1/7/2010)
    It was creating Working vars of only 1 byte, instead of 8 bytes.
    After moving the constant, I got all the correct results with your program.

    HTH,
    DT

  2. #2
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,133


    Did you find this post helpful? Yes | No

    Default

    Hmm, Darrel, don't you ever sleep?

    Ioannis

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Ioannis View Post
    Hmm, Darrel, don't you ever sleep?
    Yeah, but it's hard to get the drool out of the keyboard ...
    Not to mention deleting several hours worth of J's where my nose pressed, so I try to avoid it.
    <br>
    DT

  4. #4
    Join Date
    Jan 2010
    Location
    PHILADELPHIA, PA - USA
    Posts
    34


    Did you find this post helpful? Yes | No

    Default

    Thanks Darrel

    Ouch....My head is sore from banging it on the workbench.

    I'll try this out tonight and let you know.

    I knew it must be something simple I was missing.

    Wozzy
    Wozzy-2010

  5. #5
    Join Date
    Jan 2010
    Location
    PHILADELPHIA, PA - USA
    Posts
    34


    Did you find this post helpful? Yes | No

    Default

    Darrel,

    Thanks again,

    The N-Bit Troubleshooter program is working well now with the change you suggested.

    It's seems pretty obvious now that I am aware of it.

    So now I'll try to integrate it into my current program which is a two gate optical timer and speed calculator.

    My next challenge is figuring out how to make use the 64-bit output

    I'll post details when it's cleaned up and N-Bit math is integrated.

    Wozzy-2010
    Wozzy-2010

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


    Did you find this post helpful? Yes | No

    Default

    Great news!

    Quote Originally Posted by WOZZY-2010 View Post
    So now I'll try to integrate it into my current program which is a two gate optical timer and speed calculator.
    OOOOO, a math problem .... can I play?

    How far apart?
    Snail races? Or, rocket powered unicycle?
    <br>
    DT

  7. #7
    Join Date
    Jan 2010
    Location
    PHILADELPHIA, PA - USA
    Posts
    34


    Did you find this post helpful? Yes | No

    Default High Resolution Timer with N-BITS Precision.

    Darrel,

    Well, Me being Me I want it to do EVERYTHING, so the distance between the gates will be an input variable.
    My light source is a beam-split 650nm (red) solid state laser that's way more powerful than it needs to be (but also a lot more fun!)
    My Optical sensors are Osram SFH 5840 PhotoTransistors with built-in Schmitt Trigger.
    The outputs are combined into a single pulse using an LS74F00 configured as an S-R Latch. (this allows me to use the same code and input pin with either one or two sensors)

    The timer code is based on DT_INSTANT_INTERRUPTS running on a PIC18F4680 @ 20 MHz

    This is all working very well as a high resolution timer, though I am still working on some corrections for software and hardware delays.

    I may consider redoing the timer portion of the software using the N-Bit Variable Math, as I'm currently limited to about 1.5 Minutes.

    I needed the N-Bit Math to get the resolution I want when converting from Time to Speed, as I end up dividing two large numbers.

    My immediate goals are...
    How fast are Pinewood Derby Cars?
    How fast is my dog? (Very Fast!)
    How fast am I? (Very Slow)
    How fast can I back-slap someone? (approx. 29.97235 MPH)-DONE!
    What is the muzzle velocity of my air rifle with different pellets?
    How fast does that Jerk down the street drive past my house while kids are outside playing?
    ...

    I only have time to work on this late at night.
    I'll work on cleaning the code up a little before I lay it out for all to see.

    So far this has been a really fun and educational project.
    My youngest daughter (11yo) is learning with me, she seems very interested in what I'm doing. So I try and explain it to her as I go.

    Again thanks to you and the others on the Forum that are so willing to share your knowledge to help others learn.
    Wozzy-2010

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