William Marsh
/
DACandticker_sample_with_debug
Lab3 example program 2 with debug code
DAC Ticker
- Sample code for part 2 of lab 3 using the DAC, called from a Ticker.
- Note that to use AnalogOut from the Ticker (an ISR), we create a version without locking.
- This version has extra code for debugging
sineTable.h@4:42b85520dca6, 2020-02-06 (annotated)
- Committer:
- WilliamMarshQMUL
- Date:
- Thu Feb 06 22:42:30 2020 +0000
- Revision:
- 4:42b85520dca6
- Parent:
- 0:5307f49cd305
Change to sleep_for
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
WilliamMarshQMUL | 0:5307f49cd305 | 1 | // Look up table for a sine wave as 16 bits |
WilliamMarshQMUL | 0:5307f49cd305 | 2 | // Note that it is possible to construct the full period from |
WilliamMarshQMUL | 0:5307f49cd305 | 3 | // the first quarter, but the code is more complex |
WilliamMarshQMUL | 0:5307f49cd305 | 4 | // |
WilliamMarshQMUL | 0:5307f49cd305 | 5 | // These number were calcuated using a spreadsheet |
WilliamMarshQMUL | 0:5307f49cd305 | 6 | const uint16_t sine[] = { |
WilliamMarshQMUL | 0:5307f49cd305 | 7 | 32768, 35980, 39161, 42280, 45308, 48215, 50973, 53556, |
WilliamMarshQMUL | 0:5307f49cd305 | 8 | 55938, 58098, 60014, 61667, 63042, 64125, 64906, 65378, |
WilliamMarshQMUL | 0:5307f49cd305 | 9 | 65535, 65378, 64906, 64125, 63042, 61667, 60014, 58098, |
WilliamMarshQMUL | 0:5307f49cd305 | 10 | 55938, 53556, 50973, 48215, 45308, 42280, 39161, 35980, |
WilliamMarshQMUL | 0:5307f49cd305 | 11 | 32768, 29556, 26375, 23256, 20228, 17321, 14563, 11980, |
WilliamMarshQMUL | 0:5307f49cd305 | 12 | 9598, 7438, 5522, 3869, 2494, 1411, 630, 158, |
WilliamMarshQMUL | 0:5307f49cd305 | 13 | 0, 158, 630, 1411, 2494, 3869, 5522, 7438, |
WilliamMarshQMUL | 0:5307f49cd305 | 14 | 9598, 11980, 14563, 17321, 20228, 23256, 26375, 29556 |
WilliamMarshQMUL | 0:5307f49cd305 | 15 | } ; |