'this file sends commands to the serial port 'for testing the DDS5m module ' This example sweeps over a given input range CLS LOCATE 1, 1 ' ' open port for communications, disable hardware control lines. OPEN "com2:9600,n,8,1,cd0,cs0,ds0,op0,rs" FOR RANDOM AS #1 ' clock# = 0 INPUT "enter initial frequency (in MHz): ", freq1# INPUT "enter final frequency (in MHz): ", freq2# INPUT "enter number of steps: ", steps# stepsize# = (freq2# - freq1#) / steps# ' scale all the values based upon the clock frequency defclock# = 107.3741824# IF clock# = 0# THEN GOTO 10 scale# = defclock# / clock# freq1# = scale# * freq1# freq2# = scale# * freq2# stepsize# = scale# * stepsize# 10 PRINT #1, "e d" LINE INPUT #1, resp$ PRINT "Response ", resp$ f# = freq1# WHILE f# <= freq2# PRINT #1, "f "; IF f# < 10 THEN PRINT #1, USING "#.#########"; f# IF f# < 10 THEN PRINT , USING "#.#########"; f# IF f# >= 10 THEN PRINT #1, USING "##.#########"; f# IF f# >= 10 THEN PRINT , USING "##.#########"; f# LINE INPUT #1, resp$ PRINT "Response "; resp$ 'wait for 250 ms on each step t0 = TIMER WHILE TIMER - t0 < .25 WEND f# = f# + stepsize# WEND 'reset to enabled echo PRINT #1, "e e" PRINT "Done" STOP