Sine wave output from Propeller
Philldapill
Posts: 1,283
I'm designing a low power inverter, but it needs to have a pure sinewave. I've managed to create a pretty good waveform from the propeller using a DAC network of resistors and a small capacitor to further smooth the output. I've run into a roadblock, however, due to the relatively slow speed of spin. I've attached a spin file that shows the program.
What I need to do, is run this in PASM. I can't get over 50Hz output from the propeller using spin. If I go over this frequency, the ouput becomes high until the clock loops back around. I'm not using any sort of internal lookup table on the propeller to get e reference of the sine function. Instead, I created a table in Excel with the sine falues pre-calculated, and just copied them into the spin file. Right now, I'm using a 7bit DAC, but would like to use 8 bit so that I can completely utilize the size of a "byte" variable. I've heard there is some kind of internal lookup for sine functions on the prop, and if possible, would like to use these values·- if it doesn't limit the ouput frequency much. I'm sure this is a pretty simple excercise. All the PASM code would be is to get the next sine value, ouput it directly to the pins as binary, wait a set amount of time, fetch the next value, output, and repeat. This is basically what I'm doing in spin, but with 360 values a cycle and 50 Hz, it starts getting to be a bandwidth hog.
Any suggestions(or PASM code examples) are very welcome.
What I need to do, is run this in PASM. I can't get over 50Hz output from the propeller using spin. If I go over this frequency, the ouput becomes high until the clock loops back around. I'm not using any sort of internal lookup table on the propeller to get e reference of the sine function. Instead, I created a table in Excel with the sine falues pre-calculated, and just copied them into the spin file. Right now, I'm using a 7bit DAC, but would like to use 8 bit so that I can completely utilize the size of a "byte" variable. I've heard there is some kind of internal lookup for sine functions on the prop, and if possible, would like to use these values·- if it doesn't limit the ouput frequency much. I'm sure this is a pretty simple excercise. All the PASM code would be is to get the next sine value, ouput it directly to the pins as binary, wait a set amount of time, fetch the next value, output, and repeat. This is basically what I'm doing in spin, but with 360 values a cycle and 50 Hz, it starts getting to be a bandwidth hog.
Any suggestions(or PASM code examples) are very welcome.
spin
10K
Comments
if you output pulse-width-modulated pulses according to the sine table values
and then low-pass-filter the output pulses below the pulse rate.
For extensive info on a related technique you might want to search for "Don Lancaster Magic Sinewaves".
Post Edited (VIRAND) : 3/31/2008 9:42:29 PM GMT
http://www.rayslogic.com/propeller/Programming/dac/dac.htm
that can do between 8 and 2000 Hz.