At 12:41 PM 8/24/2003 -0700, Bob Axtell wrote: >Actually, I had, Jinx. > >Don'tcha love Morse, though? Interesting how old technology can be used to >solve a new problem.. This is how I do it on the AVR. The output is a byte, with wide pulses for a "1" and narrow for zero. MSB left. You need a good scope to catch it though, it's rather fast. Port B pin 6 happens to be free on this processor, so: Pong: push TEMP ;Save the input push TEMP2 ;and I need another scratch reg cbi PORTB,6 ;Make sure we start at low ldi TEMP2,9 ;Loop counter Pong_Loop: dec TEMP2 ;One less to loop breq Pong_Done ;If zero, we're done rol TEMP ;Put LSB in carry sbi PORTB,6 ;Otherwise, set and clear brcs Pong_One ;If zero, nothing to output Pong_Zero: cbi PORTB,6 ;a narrow bit is a zero nop ;Keep the zeroes and ones the same total size nop ;so that the stream dosen't jitter with nop ;changing data rjmp Pong_Loop ;and do it again Pong_One: nop ;A wide bit is a one nop ;This expands the bit cbi PORTB,6 ; rjmp Pong_Loop ;and do it again Pong_Done: pop TEMP2 ;Restore pop TEMP ; and TEMP,TEMP ;restore zero flag ret -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu