Skip to content

Commit d93ebe5

Browse files
committed
Complete readme
1 parent f633f91 commit d93ebe5

File tree

4 files changed

+120
-2
lines changed

4 files changed

+120
-2
lines changed

README.md

Lines changed: 120 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,124 @@
1313

1414

1515
## Introduction
16-
Generating arbitrary values from a small range of input values is easy with LUTs (look up tables). The reverse operation, condensing a large set of values into a small range, is typically either computation intensive (linear search through all values) or memory intensive (requires a LUT with 1000s of entries).
16+
Generating arbitrary values from a small range of input values is easy with look up tables (LUTs). The reverse operation, condensing a large set of values into a small range, is typically either computation intensive (linear search through all values) or memory intensive (requires a LUT with 1000s of entries).
17+
18+
**avr-quantizer** converts arbitrary values into a compact range (0..n) efficently with neither drawback. The value ranges assigned to each output ("binning") is fully user defined and semi-automatically generated by the included excel file. Possible applications include identifying resistor values (E-series) or assigning the nearest octave in audio processing.
19+
20+
<br>
21+
22+
## Key Features
23+
24+
- **flexible:** easy custom LUTs with the included excel file
25+
- **accurate:** less than ±0.4% quantisation error
26+
- **lightweight:** function typ. <100 bytes; LUT typ. <50 bytes
27+
- **efficient:** <120 cycles per call (test loop avarage)
28+
29+
<br>
30+
31+
## Limitations
32+
33+
- The algorithm accesses the flash memory directly and thus it can't be used on "reduced core" AVRs such as the attiny4/5/9/10/20
34+
35+
<br>
36+
37+
## Getting Started
38+
This section is written especially for everyone who is **not familiar** with the used tools. If you run into problems, please [ask for clarification](#get-help).<br>
39+
40+
### Step 0: Software
41+
- [**Atmel Studio 7.0**][tool-atmel-studio-7-0] (Build 1931) [free]<br>
42+
The installer contains all tools you need to open, edit, compile, simulate and flash this code. If you favor another development tool, feel free to use it instead. (But please understand that I can not provide any support).
43+
44+
### Step 1: Download avr-tinyuart
45+
- Clone this repository or hit [Download][git-download] and extract the .zip file.
46+
47+
### Step 2: Browse the project
48+
- **Open the project in Atmel Studio:**<br>
49+
Either double click `quantizer.atsln` or open Atmel Studio and select "File -> Open -> Project/Solution..."
50+
51+
### Step 3: Run the demo
52+
- **Select your MCU & Programming tool:**<br>
53+
Press `F5`to run the demo code in the simulator. Pause the simulation and mouse over the variables to see the results
54+
55+
### Step 4: Generate a custom LUT
56+
- **Edit the included Excel file:**
57+
Edit the orange fields with the values you need (do not leave any row empty) and copy the *grey* cell labeled "generated LUT" and paste it into your code. Don't forget to remove the leading and trailling `"`.
58+
59+
<br>
60+
61+
## Under the Hood
62+
63+
Typically LUTs are direct mapped, for each input value a specific output value is stored. A quantisation assigns multiple values one output value, which would require a lot of memory that is filled with redundant information. This implementation instead stores the threshold values at which the output value changes.
64+
65+
Depending on the size of the input value (2/4 byte) and the range of output values, the resulting LUT can be quite large still. Finding the correct value would require a search across all values and multiple 2/4 byte comparisons, which are rather slow on a AVR8 MCU. Because this level of accuracy is rarely required, this algorithm only compares the 8 most significant bits, ignoring the leading zeros. If the input value is larger than 8bit, it is shifted right until it can be compared. To represent numbers >8bit correctly, a header row is added to the LUT, which contains the LUT offset for each amount of shifts required.
66+
67+
<br>
68+
69+
## Support
70+
71+
### Get Help
72+
73+
**Something doesn't work as expected?** No worries! Just open up a new issue in the [GitHub issue tracker][git-issues]. Please provide all information to reproduce your problem. If you don't have a GitHub account (and can't be bothered to create one,) you can [contact](#contact) me directly.
74+
75+
<br>
76+
77+
### Contribute
78+
79+
**Spotted an error?** [Open an issue][git-issues] or submit a pull request.
80+
81+
There is no CONTRIBUTING.md yet, sorry. Contributions will inherit the [license](#license) of this project. If you have any questions, just ask.
82+
83+
<br>
84+
85+
## About
86+
### Status
87+
**This project is currently classified as** <a href="https://github.com/nqtronix/git-template/blob/master/badges.md#project-status"><img src="https://img.shields.io/badge/status-maintained-green.svg" alt="status: maintained"></a><br>
88+
_The developers intend to keep the code in working condition by updating dependencies, fixing bugs and solving issues._
89+
90+
As my testing needs increase I will likely add the functionality I need.
91+
92+
<br>
93+
94+
### Changelog
95+
This project uses [**Semantic Versioning 2.0.0**][semver.org]. During initial development (0.x.x versions) any _major_ increase is substituted with a _minor_ increase (0.1.0->0.2.0 instead of 0.1.0->1.0.0).
96+
97+
The message of each commit contains detailed information about the changes made. The list below is a summary about all significant improvements.
98+
99+
- **0.1.0** <br>
100+
- initial release
101+
102+
<br>
103+
104+
### Contact
105+
106+
If you haven't done so already, please check out [Get Help](#get-help) for the fastest possible help on your issue. Alternatively you can find my public email address on my [profile][git-profile].
107+
108+
<br>
109+
110+
## Credits and References
111+
112+
### Projects Used
113+
- [**git-template**][git-repo-git-template] - _A simple and clean git repository template._<br>
114+
115+
<br>
116+
117+
118+
## License
119+
This project is proudly licensed under the [MIT license][git-license].
120+
121+
The MIT license was chosen to give you the freedom to use this project in any way you want, while protecting all contributors from legal claims. Good code works, great code works for everyone. If this code has become a part of one of your projects, a link back to us would be highly appreciated. Thanks!
122+
123+
<!-- Links -->
124+
125+
[git-readme]:README.md
126+
[git-license]:LICENSE.md
127+
[git-profile]:https://github.com/nqtronix
128+
[git-issues]:https://github.com/nqtronix/unittrace/issues
129+
[git-download]:https://github.com/nqtronix/unittrace/archive/master.zip
130+
131+
[git-repo-git-template]:https://github.com/nqtronix/git-template
132+
133+
[semver.org]:semver.org
134+
135+
[tool-atmel-studio-7-0]:https://www.microchip.com/mplab/avr-support/atmel-studio-7
17136

18-
**avr-quantizer** converts arbitrary values into a compact range (0..n) efficently with neither drawback. The value ranges assigned to each output ("binning") is fully user defined and semi-automatically generated by the included excel file. Possible applications include identifying resistor values (E-series) or assigning the nearest octave in audio processing.

lut_generator_E12_10R10M.xlsx

1 Byte
Binary file not shown.

lut_generator_E12_1K1M.xlsx

1 Byte
Binary file not shown.

lut_generator_E12_1K47K.xlsx

-1 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)