Check within a 16 bytes window


Closed Thread
Results 1 to 6 of 6
  1. #1
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,802

    Default Check within a 16 bytes window

    Here is the problem.

    I have a counter that is 16 bits wide. Also another 16 bits counter.

    I need to check if the distance between them is no more that 16 bytes.

    The tricky part is where the one is near the roll over and the other has already rolled.

    For example one counter is at FFFC and the other is at 0003.

    Any ideas?
    Ioannis

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


    Did you find this post helpful? Yes | No

    Default Re: Check within a 16 bytes window

    Code:
    IF ABS(count1 - count2) > 16 THEN ...
    DT

  3. #3
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,802


    Did you find this post helpful? Yes | No

    Default Re: Check within a 16 bytes window

    Every time I get an answer by Darrel, I feel I have to hide somewhere... Embarassed.

    Thanks Darrel.
    Ioannis

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


    Did you find this post helpful? Yes | No

    Default Re: Check within a 16 bytes window

    Well, don't feel too bad, cause I'm not even sure that will work under all conditions.

    I should do some testing.
    DT

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


    Did you find this post helpful? Yes | No

    Default Re: Check within a 16 bytes window

    After some testing ... it does work.

    Now I want to hide.
    DT

  6. #6
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,802


    Did you find this post helpful? Yes | No

    Default Re: Check within a 16 bytes window

    I just did not think in terms of pure binary maths. So trying to find a way with 10 base mind was driving me away from the clear solution you gave.

    Thanks again.
    Ioannis

Similar Threads

  1. trying to do a scroll window
    By AvionicsMaster1 in forum Test Area
    Replies: 0
    Last Post: - 7th September 2011, 14:00
  2. Posts editing window is small
    By flotulopex in forum Forum Requests
    Replies: 7
    Last Post: - 14th April 2011, 10:20
  3. Variables not appearing in Watch Window MPLabv7.3
    By jd76duke in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 16th June 2006, 14:36
  4. Button Push within 3 second Window
    By Tissy in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 22nd December 2005, 10:06
  5. Time window
    By Franko in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 9th August 2005, 16:42

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