I have written a routine that measures frequency on an input and then looks at an upper and lower limit for that tone to come up with a standard used frequency. I have 33 of these frequencies and at the moment I am using if then statements but there are a lot of them. I have broken the tone set in half , then in half again etc so that I can find the tone in a minimal time. This uses a large amount of code and thought there must be an eiser way to do this. Any help would be appreciated. Below is a code snippet
tonehigher26:
IF w1 < 4508 Then tonehigher30 ' tone is between > 225.7
IF w1 > 4507 Then tone26to29 ' tone is between 192,8 and 218.1
GoTo loop
tone18to25:
IF w1 < 6060 Then tone22to25 'tone Is between 167.9 and 186.2
IF w1 > 6059 Then tone18to21 'tone is between 146.2 and 162.2
GoTo loop
tone26to29:
IF w1 < 4830 Then tone28to29
IF w1 > 4829 Then tone26to27
GoTo loop
tone22to25:
IF w1 < 5657 Then tone24to25
IF w1 > 5656 Then tone22to23
GoTo loop
tone18to21:
IF w1 < 6494 Then tone20to21
IF w1 > 6493 Then tone18to19
GoTo loop
tone28to29:
IF w1 < 4666 Then tone=29
IF w1 > 4665 Then tone=28
Bookmarks