help optimising code


Closed Thread
Results 1 to 11 of 11

Hybrid View

  1. #1
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrenmac View Post
    this would be good if the tone was extremely presice. I have allowed for variances up to half way between tones. can this also be done with the above example?
    Probably not, 'cause that sounds like it involves 'fuzzy logic', the ability to change parameters in the middle of what you're doing, or something like that.
    Maybe an extra if/then in each chunk of tone code checking for the 'exactness' of the tone?

    You do understand the concept of the example above right?
    If the value is above 14925 it'll jump to t1...and you're done...
    if the value is 14925 or below, it'll skip the first one and try the second one...
    If the value is above 12987 (but below or equal to 14925 'cause it checked it during the first check), it'll jump to t2...and you're done....
    ...and so on and so on and so on...
    And you don't have to use the BRANCHL statement. Once you've got your index variable into B0, you can use the SELECT CASE statement to handle the individual blocks of code instead of a bunch of goto's.

  2. #2
    Join Date
    Mar 2004
    Posts
    74


    Did you find this post helpful? Yes | No

    Default

    thanks Skimask,
    I did'nt see the ">" symbol.
    Yes it does make sense and should work. I'll give it a go and let you know

  3. #3
    Join Date
    Mar 2004
    Posts
    74


    Did you find this post helpful? Yes | No

    Default

    Thanks Skimask
    I modified my code to use lookdown2 and works great. Not using branch but sending the lookdown2 index out serialy. My code droped from approx 1500 words with only 1/2 of the tones covered to less than 500 words for the entire tone set.

    Thanks again

Similar Threads

  1. Reading in Manchester code
    By brid0030 in forum Code Examples
    Replies: 0
    Last Post: - 10th March 2009, 21:55
  2. How much code space do PBP statements use.
    By Darrel Taylor in forum Code Examples
    Replies: 5
    Last Post: - 13th February 2009, 21:31
  3. Loop with two motor and 2 sensors
    By MrRoboto in forum mel PIC BASIC
    Replies: 4
    Last Post: - 8th December 2008, 23:40
  4. Making Program Code Space your playground...
    By Melanie in forum Code Examples
    Replies: 15
    Last Post: - 19th July 2008, 08:26
  5. Re-Writing IF-THEN-AND-ENDIF code?
    By jessey in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 18th August 2006, 17:23

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