88
99# FunctionGenerator
1010
11- Arduino library to generate (numeric) wave forms for a DAC
11+ Arduino library to generate (numeric) wave forms for a DAC.
1212
1313
1414## Description
@@ -31,28 +31,30 @@ Indication of what performance can be expected (based upon 0.2.1 version).
3131Note that the values need to be transported to a DAC or serial port too.
3232Numbers based on performance example, for one single signal.
3333
34+
3435| Processor | Clock | Waveform | usec/calls | max freq |
3536| :-------------| ---------:| :---------| -----------:| ---------:|
36- | Arduino UNO | 16 MHz | sawtooth | 62 | 60 Hz |
37- | Arduino UNO | 16 MHz | triangle | 74 | 50 Hz |
37+ | Arduino UNO | 16 MHz | sawtooth | 62 | 60 Hz |
38+ | Arduino UNO | 16 MHz | triangle | 74 | 50 Hz |
3839| Arduino UNO | 16 MHz | square | 53 | 1000 Hz |
39- | Arduino UNO | 16 MHz | sinus | 164 | 25 Hz |
40- | Arduino UNO | 16 MHz | stair | 81 | 50 Hz |
40+ | Arduino UNO | 16 MHz | sinus | 164 | 25 Hz |
41+ | Arduino UNO | 16 MHz | stair | 81 | 50 Hz |
4142| Arduino UNO | 16 MHz | random | 37 | 1000 Hz |
4243| | | | | |
4344| ESP32 | 240 MHz | sawtooth | 3.8 | 1000 Hz |
4445| ESP32 | 240 MHz | triangle | 3.9 | 1000 Hz |
4546| ESP32 | 240 MHz | square | 2.8 | 1000 Hz |
46- | ESP32 | 240 MHz | sinus | 13.6 | 250 Hz |
47- | ESP32 | 240 MHz | stair | 4.8 | 800 Hz |
47+ | ESP32 | 240 MHz | sinus | 13.6 | 250 Hz |
48+ | ESP32 | 240 MHz | stair | 4.8 | 800 Hz |
4849| ESP32 | 240 MHz | random | 1.3 | 1000 Hz |
4950
5051
5152- assumption minimal 250 samples per period to get a smooth signal.
5253 if a rougher signal is OK, higher frequencies are possible.
5354- ESP32 can do more calculations however 1000 Hz seems to be a nice
5455 upper limit for a software based function generator.
55- - if one wants to control multiple DAC's one need to divide the numbers.
56+ - if one wants to control multiple DAC's one need to divide the numbers
57+ and round down.
5658
5759
5860Note: hardware function generator https://github.com/RobTillaart/AD985X
@@ -71,7 +73,7 @@ All parameters can be set in the constructor but also later in configuration.
7173- ** void setPeriod(float period = 1.0)** set the period of the wave in seconds.
7274- ** float getPeriod()** returns the set period.
7375- ** void setFrequency(float frequency = 1.0)** set the frequency of the wave in Hertz (1/s).
74- - ** float getFrequency()** returns the set frequency.
76+ - ** float getFrequency()** returns the set frequency in Hertz .
7577- ** void setAmplitude(float amplitude = 1.0)** sets the amplitude of the wave. TODO point to point?
7678Setting the amplitude to 0 gives ?what?
7779- ** float getAmplitude()** returns the set amplitude.
@@ -92,7 +94,7 @@ t is time in seconds
9294- ** float sinus(float t)** sinus wave, has no duty cycle.
9395- ** float stair(float t, uint16_t steps = 8, uint8_t mode = 0)** mode = 0 ==> steps up, mode = 1 steps down.
9496- ** float random()** noise generation.
95- - ** float line()** constant voltage line
97+ - ** float line()** constant voltage line. Depends on the set YShift and amplitude.
9698- ** float zero()** constant zero.
9799
98100Line() and zero() are functions that can be used to drive a constant voltage from a DAC
@@ -112,6 +114,7 @@ See examples.
112114- square duty-cycle (will be slower!)
113115- triangle duty-cycle (makes sawtooth a special triangle)
114116- trapezium wave (would merge square and triangle and sawtooth)
117+ - Bezier curve?
115118
116119#### investigate
117120
0 commit comments