> On Fri, 22 Mar 2002, Bob Ammerman wrote: > > > If you only need to generate the fixed frequency of 625Hz, you could easily > > do it with a 12C509A by using a single bit highly oversampled output. > > > > Use a 4MHz crystal to get 1,000,000 instructions per second. This > > corresponds to 1600 instructions for each cycle of the 625Hz output. > > > > You would compute the ideal oversampled output waveform as a long string of > > zeros and ones using a program on a PC. (Anybody have any pointers to how to > > do this part?). > > I discuss it briefly here. Maybe you didn't see the post the other day. > > http://www.dattalo.com/technical/theory/sqwave.html Yeah, I took a look at that, but didn't see how I got the 'best' pulse train. How about this idea: Do a simple delta encoding by treating the output as a simple 1=up, 0=down kind of thing and comparing the computed value of the integral to the correct value of the sign at each step to determine the next output bit. The maximum slope occurs at the zero crossings, so at those points we would expect to see a sequence of repeated ones or zeros. > > Here is a puzzle/challenge: > > > > How can you reduce the program memory requirements by a factor of > > approximately 2? My thought here is that the waveform is symetrical. So if we replace all the BCF GPIO,0 and BSF GPIO,0 instructions with XORWF GPIO,F and make sure that W always contains a one, then our loop can encode only half the waveform, as long as it contains an odd number of XORWF GPIO,F instructions. Bob Ammerman RAm Systems -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu