Frequency to period adjustment in program loop calculation

Homework Statement

Adjust a program loop so frequency will change linearly with a keyboard increment or decrement.
The current calculation adjusts about 40 counts in the delay loop but when the frequency gets high the step is frequency is very large with each decrement in the loop.

A loop delay of 0 counts is 428 Hz eg as fast as the program will run
A loop delay of 10000 counts is 4.911 Hz
A loop delay of 49840 counts is 1 Hz

Homework Equations

1/Period = Frequency and 1/Frequency = Period

The Attempt at a Solution

tid# is the adjustment frequency controlled from keystrokes either increment or decrement in small steps eg + .02 or - .02
id& is the number of loops in the counter eg period

incdelay:
tid# = tid# + .02
id& = 1 / ((1 / tid#) * (1 / 2000))
RETURN

Its part of a 3 phase digital to analog converter driven off a printer port using QuickBASIC and win98 and below, using 3 4 bit 8421 ladder networks.
I made the prototype to drive 3 speakers 120 degrees apart. I intend to finsh the program so that you can record the frequencys and phase shifts for Rubens tube experments.

Homework Statement

Adjust a program loop so frequency will change linearly with a keyboard increment or decrement.
The current calculation adjusts about 40 counts in the delay loop but when the frequency gets high the step is frequency is very large with each decrement in the loop.

A loop delay of 0 counts is 428 Hz eg as fast as the program will run
A loop delay of 10000 counts is 4.911 Hz
A loop delay of 49840 counts is 1 Hz

Homework Equations

1/Period = Frequency and 1/Frequency = Period

The Attempt at a Solution

tid# is the adjustment frequency controlled from keystrokes either increment or decrement in small steps eg + .02 or - .02
id& is the number of loops in the counter eg period

incdelay:
tid# = tid# + .02
id& = 1 / ((1 / tid#) * (1 / 2000))
RETURN

Its part of a 3 phase digital to analog converter driven off a printer port using QuickBASIC and win98 and below, using 3 4 bit 8421 ladder networks.
I made the prototype to drive 3 speakers 120 degrees apart. I intend to finsh the program so that you can record the frequencys and phase shifts for Rubens tube experments.

incdelay:
tid# = tid# + .02
id& = 1 / ((1 / tid#) * (1 / 2000))
RETURN

Ok so Ive been working on it here is one solution
I ran a few points in the program then adjusted the loop when 265 was calculated to read 100 Hz then took the difference 256 - 200 = 56 so thats the offset...
id&=((1/Desired Frequency)/(1/Program Counts per Second)
256 = 81 Hz
2568 = 9.8 Hz
5136 = 4.9 Hz
25680 = 1 Hz
51359 = .5 Hz
so finally
id&=((1/Desired Frequency)/(1/Program Counts per Second))-program offset in counts