SIN test generator based on the FV-1
Posted: Mon Apr 30, 2012 3:05 am
Developing code for the Fv-1 requires audio signals for testing the functionality of the designed code. Obviously exact audio test generators can be used but also this Fv-1 device, to generate particular frequencies or even pulse, can be used for that purpose. Here is a generic solution based on an extra FV-1 device to generate the required audio test signals. In my particular case the unit's output was first calibrated against a 1 volt squarewave calibration signal from my oscilloscope to enable a complete calibrated setup of my development environment. The presented code is kept generic and can be extended to what's required. As an example, the BCD frequency steps are combined in one project file so each selector position is a different frequency hence testing can be done without extra effort.
Most of the code is obtained through this forum, it's therefore shared with thanks!
Piet
Most of the code is obtained through this forum, it's therefore shared with thanks!
Code: Select all
;********************************** SIN TEST OSCILLATOR ****************************************
;
; Sine wave (pulse) generator generator based on an example at the Spin semiconductor site
; Constants are calibrated through tuner comparisons
; Version 2.0: basic with no switching between functions
; PMV
;
;*************************************************************************************************
equ freq reg0
equ s reg1
equ c reg2
equ p0fil reg3
equ begin reg4
;
; -------set of frequencies factors not exact calibrated, sufficiant for testing------------
;
; -----Set functionality is to measure EQ frequency curves-----
;
;equ test 0.026 ; 16Khz
;equ test 0.1494 ; 4Khz
;equ test 0.2744 ; 1Khz
equ test 0.3478 ; 440hz ; 'A'
;equ test 0.399 ; 250hz
;equ test 0.5223 ; 63 hz
;
; -----Set to check the BCD switch functionality (doubling frequency per step)-----
;
;equ test 0.50 ; 80 Hz
;equ test 0.445 ; 160 Hz
;equ test 0.378 ; 320 Hz
;equ test 0.316 ; 640 Hz
;equ test 0.2521 ; 1280 Hz
;equ test 0.1895 ; 2570 Hz
;equ test 0.12695 ; 5140 Hz
;equ test 0.0652 ; 10280 Hz
;
skp run,start
wldr RMP0,800,4096
clr
;
SOF 0,0.5 ;setup LFO with amplitude of 0.5
wrax s,0 ;c is initialized to zero on startup
;
start:
;
sof 1,-test
exp 1,0
rdfx p0fil,0.01 ;average with filter
wrax p0fil,1
wrax freq,0
;
; -----a ramp used to create a small pulse to measure equipment -----
;
cho rdal,RMP0
sof 1,-0.25
absa
sof -2.0,0.01
sof -2.0,0
sof -2.0,0
sof -2.0,0
sof -2.0,0
sof -2.0,0
sof -2.0,0
sof -2.0,0
sof -2.0,0
sof -2.0,0
sof -2.0,0
sof -2.0,0
sof -2.0,0
sof -2.0,0 ;possible toooo much
sof -2.0,0 ;
sof -2.0,0 ;
sof -2.0,0 ;
sof 0.5,0.5
;
sof 1.8,0
wrax begin,0 ;created a block pulse to control output
;
;----- start generating wave-----
;
rdax c,1 ;oversample the oscillator to reach 20KHz easily.
mulx freq
rdax s,1
wrax s,-1
mulx freq
rdax c,1
wrax c,0
;
rdax c,1
mulx freq
rdax s,1
wrax s,-1
mulx freq
rdax c,1
wrax c,0
;
rdax c,1
mulx freq
rdax s,1
wrax s,-1
mulx freq
rdax c,1
wrax c,0
;
rdax c,1
mulx freq
rdax s,1
wrax s,-1
mulx freq
rdax c,1
wrax c,1.99
;
sof 0.041,0 ; calibrated to generate 1 volt p/p input on my design
;
mulx begin ; here the pulse is controlled, comment out for continuous tone
;
wrax dacl,1
wrax dacr,0 ;write both outputs
;/eof/