Low Frequency Function Generator

Due to the unavailability of very low frequency function generators and the problems experiencing with them to generate a wave form starting with a particular trigger input has prompted me to design this function generator.

The system consists of a personal computer and the printer port is used.

Advantages:

The system consists of a personal computer, printer port interface and a 10 bit Digital to Analog convertor.

The software was written on the fly and runs under DOS.  The printer port interface is not necessary but it makes the system more versatile.  The 10 Bit Digital to Analog convertor has two outputs.  The one output is a direct output which provides signals from +5V to -5V.  The other output has a potentiometer in which allows the amplitude to be adjusted.

A trigger from the external device can be used to trigger the system to allow the wave forms to be synchronized.

To allow for step and transfer functions to be determined the generator can provide a square wave and a sine wave.

The square wave amplitudes can be adjusted from software and therefore the direct output is used when using square waves.  To ensure that the sine wave has a very low distortion the adjustable output must be used and the level adjusted accordingly.

The trigger input is a TTL signal level and the system can trigger on the high or low transition.

Circuit diagram of the 10 Bit DAC:

10 Bit DAC

The pin numbers on the digital input side are for connection to the printer port interface.  If the system will be assembled without the printer port interface then the pin numbers must change to be the same as those on the printer port.

Printer port Interface:

The printer port interface was a student project at the observatory and have been used on several occasions to quickly interface something.

Trigger input:
The trigger input is a TTL level signal connected to bit 0 (lsb) of the printer port interface.  Depending on the program running the system can trigger on a positive or negative edge signal.

Adjusting the convertor.

Software:
Several pieces of code were written to implement the generator.  The code is in C and Borland C++ compiler were used.  No special routines and functions are used so the code should be transportable.

The timing of the system relies on a software routine and the values must be determined empirically for each computer.  More about this when the different pieces of code are discussed.

Programs:

 (If your viewer opens the file then simply 'save as' )

Program Operation:

FR_SIN.CPP & FR_SIN.EXE

The generator will output a sine wave starting at 0V.  The period of the signal must be entered. The minimum period is 1 second.  This will continue until a key is pressed.  To ensure minimum distortion of the sine wave the full amplitude is used during the signal generation.  The user can adjust the signal level using the adjustable output.

FR_SQR.CPP & FR_SQR.EXE

The generator will output a square wave according to the voltages requested.  The user must enter the max. and min. voltages for the wave form and the period in seconds.   This will continue until a key is pressed.  When using square waves it is advisable to use the normal output since the level of the wave can be adjusted in the program.

MONO.CPP & MONO.EXE

The generator will output a single pulse starting at the trigger signal.  The user must specify the min. and max. voltages for the wave form as well as the duration.  The user also specify at which level the generator will trigger.  When the program starts it will wait for the opposite level before triggering and then start on the requested level.  E.g.. the user wants the pulse to appear when the trigger goes high.  When the program starts the trigger level is also high, this will not cause a trigger to take place.  The generator will wait until the trigger level is low and then set itself to trigger on the next high level.  If the requested trigger is a high and the level is low when the program starts the system will trigger on the first high transition of the trigger input.  The opposite for low level triggering is also true.  This is to ensure that the user has sufficient time to connect and start the program.
 
The programs at the moment are compiled to use LPT2 as the printer port.  If another port is required the change the line towards the bottom of the code (PORT = LPT#) to the required port and recompile.

For more information or queries contact me

Pieter Fourie
e-mail  pah@saao.ac.za
web page http://maia.saao.ac.za/~pah