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?). Then, given the sequence of zeros and ones you would (manually, or via a program you write on the PC) generate ASM code for the body of the frequency generating loop on the PIC: You would like to just generate: BCF GPIO,0 for each zero, and BSF GPIO,0 for each one But this won't work because you only have a total of 1024 instructions available and it takes 1600 to generate a full cycle. However, you can take advantage of sequences of three or more consecutive zeros or ones like this: Save one instruction for a sequence of 3 zeros(ones) in a row: BCF(BSF) GPIO,0 goto $+1 Also, save one instruction for a sequence of 4 zeros(ones) in a row: BCF(BSF) GPIO,0 nop goto $+1 For N or more zeros(ones) in a row, where N >= 5 you can save N-2 instructions using: BCF(BSF) GPIO,0 call DelayN Where off to the side in another part of the source you have: Delay10: nop Delay9: nop Delay8: nop Delay7: nop Delay6: nop Delay5: retlw 0 You will, of course, have to have a general structure of: loop: BCF(BSF) GPIO,0 . . goto loop and will have to make sure the entire loop takes exactly 1600 instructions, including the final GOTO. Also, the final goto will have to occur at a time when you are sending several identical bits. Here is a puzzle/challenge: How can you reduce the program memory requirements by a factor of approximately 2? Bob Ammerman RAm Systems -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu