Skip to content

Defining a Custom Waveform

Chris Esposito edited this page Feb 16, 2020 · 1 revision

Introduction

Labrador's waveform generators are fully programmable and drive an 8-bit, 1MSPS DAC with a 512-byte buffer.
This means that it's possible to define any custom wave shape you like!

To do so, you'll need to create a .tlw file.
There are some sample files located under the waveforms directory beside the Labrador executable (on Windows, this would be C:\Program Files\EspoTek\EspoTek Labrador\waveforms).

.tlw Files

Opening a sample .tlw file in a text editor, you will find that each file consists of three lines.

The first line defines the number of samples in the waveform. This number can range from 1 to 512.

The second line defines the "binary downsampling" parameter. For most custom waveforms, you'll want to set this to 1. Setting it above 1 allows the Labrador software to reduce the sample count in order to extend the frequency. As this is an advanced topic, it's explained at the bottom.

The third line contains a list of each of the samples, separated by tabs. Each sample should be in the range 0 to 255, where 0 represents minimum voltage, and 255 represents maximum.

For example, here is Triangle.tlw:

128
4
0	4	8	12	16	20	24	28	32	36	40	45	49	53	57	61	65	69	73	77	81	85	89	93	97	101	105	109	113	117	121	125	130	134	138	142	146	150	154	158	162	166	170	174	178	182	186	190	194	198	202	206	210	215	219	223	227	231	235	239	243	247	251	255	255	251	247	243	239	235	231	227	223	219	215	210	206	202	198	194	190	186	182	178	174	170	166	162	158	154	150	146	142	138	134	130	125	121	117	113	109	105	101	97	93	89	85	81	77	73	69	65	61	57	53	49	45	40	36	32	28	24	20	16	12	8	4	0

_list.wfl

Once you have defined your custom waveform in a .tlw file, the last step is to add your waveform's name to _list.wfl. This file is also located in the waveforms directory, alongside the sample .tlw files. To add your custom waveform to _list.wfl, simply add a line to the file consisting of the name of your .tlw file. Note that the order in which the waveforms are defined in _list.wfl is the order in which they will appear in the Labrador Software's UI.

A Note on Binary Downsampling

As the DAC is only capable of outputting 1MSPS, the maximum frequency that your waveform can be produced is limited by the sample count. For example, the maximum frequency a waveform with 500 samples can be generated at is 2kHz (2kHz * 500 samples = 1MSPS).

To get around this limitation, the in-built waveforms define use a "binary downsampling" parameter greater than 1. A binary downsampling parameter of 2 means that the software can discard every second sample in order to increase the frequency above the maximum (in our example above, it would allow the software to automatically scale the waveform to 250 samples in order to allow a maximum frequency of 4kHz. However, it would use the full 500 samples if the frequency was set to 2kHz or below).

Increasing this value to 3 would allow the software to discard more samples - in the case of our example, it would allow the software to extend the range to 8kHz by discarding all but 125 samples.

Long story short, increasing this value by 1 allows the software to halve the sample count and double the frequency.