Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
projects:generator [2015/03/17 10:37] – [Commands] darron | projects:generator [2017/03/07 05:57] (current) – [Schematic] darron | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ==== dsPIC tone generator ==== | + | ==== dsPIC/ |
<wrap right> | <wrap right> | ||
{{: | {{: | ||
</ | </ | ||
- | This is a project for the dsPIC33FJ128GP802 acting as a tone generator connected to a [[: | + | This is a project for the dsPIC33FJ128GP802 |
Four separate tones may be generated simultaneously from five different waves and each tone can be any audible frequency. | Four separate tones may be generated simultaneously from five different waves and each tone can be any audible frequency. | ||
Line 10: | Line 10: | ||
A tone may also be triggered and it has a standard four stage envelope (ADSR). | A tone may also be triggered and it has a standard four stage envelope (ADSR). | ||
- | This project is still under development and certain aspects may change | + | This project is under development and certain aspects may change |
=== Waves === | === Waves === | ||
- | These are standard wave types supported for generating tones. | + | There are standard wave types supported for generating tones. |
{{: | {{: | ||
Line 24: | Line 25: | ||
{{: | {{: | ||
- | === Install | + | === Schematic |
- | First install | + | This is the bare minimum layout required for this project using the dsPIC with integrated audio DAC. We use a [[:boards:rpi|RPi]] for communication and ICSP. |
- | Now build the dsPIC application. | + | {{: |
+ | |||
+ | For PIC32 an external audio DAC is required. Only the CS4334K and PT8211 are supported | ||
+ | at present and are selected at compile time. Connection to either device is as follows. | ||
+ | |||
+ | <columns 50% 50% -> | ||
< | < | ||
- | hg clone http://hg.kewl.org/pub/ | + | CS4334K WITH Vcc = 5V. |
- | cd generator | + | |
- | make | + | PIC32MX150 |
+ | ---------- | ||
+ | PIN 15 RPB6 PIN 4 MCLK 128X OVERSAMPLING CLOCK | ||
+ | PIN 16 RPB7 PIN 3 LRCK SAMPLE RATE LEFT/RIGHT CLOCK | ||
+ | PIN 17 RPB8 PIN 1 SDATA | ||
+ | PIN 18 RPB9 PIN 2 DEM/ | ||
+ | PIN 25 SCK1 UNUSED | ||
</ | </ | ||
- | This is the bare minimum layout required for this project. We will use a [[: | + | </ |
- | {{:projects:generator:generator.png?200}} | + | <columns 50% 50% -> |
+ | |||
+ | < | ||
+ | PT8211 WITH Vdd = 5V. | ||
+ | |||
+ | PIC32MX150 | ||
+ | ---------- | ||
+ | PIN 15 RPB6 UNUSED | ||
+ | PIN 16 RPB7 PIN 2 WS SAMPLE RATE LEFT/RIGHT CLOCK | ||
+ | PIN 17 RPB8 PIN 3 SDATA | ||
+ | PIN 18 RPB9 UNUSED | ||
+ | PIN 25 SCK1 PIN 1 BCK | ||
+ | </ | ||
+ | |||
+ | </ | ||
+ | |||
+ | The CS4334K is a far superior device, but the PT8211 is incredibly cheap (15p each). | ||
+ | |||
+ | === Firmware === | ||
+ | |||
+ | For dSPIC First install a working [[:tools:xc16|XC16]] compiler, for PIC32, install [[:tools: | ||
+ | |||
+ | Now build the dsPIC/PIC32 applications. | ||
+ | < | ||
+ | hg clone http:// | ||
+ | cd generator/ | ||
+ | make | ||
+ | </ | ||
[[: | [[: | ||
+ | |||
+ | Eg. | ||
< | < | ||
- | p24 lvp program | + | p24 lvp program |
</ | </ | ||
Line 66: | Line 107: | ||
| / | The accumulator low word is transferred to the voice volume word | | | / | The accumulator low word is transferred to the voice volume word | | ||
| % | The accumulator low word is transferred to the voice square wave duty word | | | % | The accumulator low word is transferred to the voice square wave duty word | | ||
- | | @ | The accumulated | + | | @ | The accumulater low word is transferred to the voice ADSR envelope |
| ! | Trigger the voice ADSR envelope | | ! | Trigger the voice ADSR envelope | ||
| > | The accumulator low nibble is transferred to the voice selection byte | | | > | The accumulator low nibble is transferred to the voice selection byte | | ||
Line 79: | Line 120: | ||
</ | </ | ||
- | Using `bc' | + | Using GNU bc from the shell we can calculate |
< | < | ||
- | printf ".%04x=\n" `echo " | + | printf "%08X=\n" `echo " |
- | .171b0b4= | + | 0171B0B4= |
</ | </ | ||
=== Examples === | === Examples === | ||
Line 103: | Line 144: | ||
=== Resources === | === Resources === | ||
[[http:// | [[http:// | ||
+ |