Virtual C.R.O.

Source Code


This document explains how to modify the Virtual C.R.O. source code to display your own waveforms and add new experiments. For other information, see the main documentation.


Compiling

To build the program, you need to compile the CRO.PAS file. The other .CRO files will be included and the VGA.OBJ file linked by means of {$I} and {$L} directives.

The code is written in Turbo Pascal 7. You will need a version that has the Uses Crt bug (Runtime error 200) fixed.


Pre-defined functions

Other than standard Pascal operators and library functions, you may also use the following functions defined in Maths.CRO:-

log10(x), exp10(x) and exp2(x)
log10 x, 10x and 2x
floor(x)
[x] - the greatest integer not greater than x
fdiv(a, b) and fmod(a, b)
div and mod for floating-point numbers
rad(x) and deg(x)
Degrees and radians inter-conversion
Sine(t, A, f, P)
Sinusoidal wave with amplitude A (V), frequency f (Hz) and phase angle P (radians)
Square(t, A, f, P)
Square wave
Triangle(t, A, f, P)
Triangular wave
Pulse(t, A, f, Wid, Pos)
Rectangular pulse with pulse-width Wid (s) and initial pulse position at Pos (s)

Modifying experiments

Modifying experiments is a straightforward process, as all the experiment definitions are in files neatly separated from the remaining code that provides the C.R.O. interface.

The Expt-Ini.CRO file describes the experiments, their parameters and the functions to be used for each input. The actual function definitions are in the Expt-Lib.CRO file.

The fastest way to specify the waveforms you want to display is to make use of experiment #0. As this experiment is already defined in Expt-Ini.CRO, you only need to modify the following functions in Expt-Lib.CRO:-


To define entirely new experiments, modify the files as follows:-

Expt-Ini.CRO

Expt-Lib.CRO


Save your work, recompile CRO.PAS and you're done!


Virtual C.R.O. v 2.0 © 2000-2002 Madhav Shanbhag