Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/traviskaufman/sac-converter-algorithm
Algorithm that mimics the behavior of a Successive Approximation Analog-to-Digital Converter by finding an integer value using the same technique, even improving on it a little
https://github.com/traviskaufman/sac-converter-algorithm
Last synced: 7 days ago
JSON representation
Algorithm that mimics the behavior of a Successive Approximation Analog-to-Digital Converter by finding an integer value using the same technique, even improving on it a little
- Host: GitHub
- URL: https://github.com/traviskaufman/sac-converter-algorithm
- Owner: traviskaufman
- Created: 2012-02-29T07:59:27.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2012-02-29T08:01:50.000Z (almost 13 years ago)
- Last Synced: 2025-01-08T15:53:57.742Z (16 days ago)
- Language: C
- Homepage:
- Size: 93.8 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README
Awesome Lists containing this project
README
******************************************
* Successive Approximation ADC Algorithm *
* Author: Travis Kaufman *
* Version: 1.0.1 *
******************************************UPDATE NOTE: When I tested my original programs output, I saw that the running time was approximately O(n), where n = word length. However, I was able to get this to run more efficiently than I thought, by checking if the word length was excessive and if so resizing it, therefore not avoiding wasting processor time on unecessary operations. Although this isn't exactly how a SAC works, I would rather have efficiency over real-world roadblocks. Furthermore, in terms of n = number being tested, it is WAY more efficient than a brute-force algorithm. Probably why it's used in ADCs ;)
Today I reviewed Successive Approximation Digital to Analog Conversion, and I decided it would be cool to try and implement the Successive approximation algorithm in C, since 1) C is really awesome, and 2) I am literally the biggest nerd on the planet. Therefore, here's my attempt at it. The algorithm is as follows:
1) Flip the MSB of the potential output word
2) If the output word's value is larger than the reference voltage, flip the MSB back and repeat 1) with the next-most significant bit
3) If the output word's value is smaller than the reference voltage, flip the next-most significant bit and compare it with the reference voltage again, repeating steps 2) and 3) as necessary
4) If the output word equals the reference voltage, return it.Obviously for the sake of my own sanity V1.0.* will use integers, but maybe someday in the future it'll be cool to twiddle some floating-point numbers and see if I can fenagle it to get it working.