help optimising code


Closed Thread
Results 1 to 11 of 11

Hybrid View

  1. #1
    Join Date
    Mar 2004
    Posts
    74


    Did you find this post helpful? Yes | No

    Default

    No the tones are not eveny spaced. Here are the required tones and associated value of the w1 variable.

    CTCSS W1

    1 67 14925
    2 71.9 13908
    3 77 12987
    4 82.5 12121
    5 88.5 11299
    6 94.8 10549
    7 100 10000
    8 103.5 9662
    9 107.2 9328
    10 110.9 9017
    11 114.8 8711
    12 118.8 8418
    13 123 8130
    14 127.3 7855
    15 131.8 7587
    16 136.5 7326
    17 141.3 7077
    18 146.2 6840
    19 151.4 6605
    20 156.7 6382
    21 162.2 6165
    22 167.9 5956
    23 173.8 5754
    24 179.9 5559
    25 186.2 5371
    26 192.8 5187
    27 203.5 4914
    28 210.7 4746
    29 218.1 4585
    30 225.7 4431
    31 233.6 4281
    32 241.8 4136
    33 250.3 3995

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    lookdown2 w0,>[14925,12987,12121,11299,10549,10000,9662,9328,9017 ,8711,8418,8130,7855,7587,7326,7077,6840,6605,6382 ,6165,5956,5754,5559,5371,5187,4914,4746,4585,4431 ,4281,4136,3995],b0

    branchl b0 , [ t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16, t17, t18, t19, t20, t21, t22, t23, t24, t25, t26, t27, t28, t29, t30, t31, t32, t33 ]

    t1: do whatever with tone 1
    t2: do whatever with tone 2
    and so on and so on...

    I'll let you know right now, this bit of code will still eat up a bunch of code space...

  3. #3
    Join Date
    Mar 2004
    Posts
    74


    Did you find this post helpful? Yes | No

    Default

    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?

  4. #4
    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.

  5. #5
    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

  6. #6
    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