On Friday, March 16, 2007 6:06 PM [GMT-3=CET], Harold Hallikainen wrote: > > On Friday, March 16, 2007 3:11 PM [GMT-3=CET], > > wouter van ooijen wrote: > > > > > > The start bit idea is clever! It allows a character to have > > > > up to 7 dits > > > > or dahs. You still have to count the bits as they go out (or > > > > are thrown > > > > out), though since an all dit character would go to zero as > > > > soon as you > > > > throw out the start bit. > > > > > > Wouldn't a stop bit be easier? Shift, if result in register is 0 you are > > > done, else you transmit what is in the carry and shift again. > > > > > > Wouter van Ooijen > > > > Nice Wouter! > > It might be necessary to clean up the carry flag before shifting, isn't > > it? > > Also is better to use "1" for dots than for dashes. Doing so, you can send > > the error sign. > > > > bsf STATUS,RP0 > > movlw B'11111111' ; Error sign > > movwf BytesRx > > > > mCODE > > BCF STATUS,C ;do not shift "ones" now > > movlw 0 > > RLF BytesRx,F > > XORWF BytesRx,W > > BTFSC STATUS,Z > > GOTO end_of_char > > btfsc STATUS,C > > goto DASH > > DOT ; any output routine e.g. > > bsf PORTB,7 > > ;(delay intra-elem + 1 element) > > bcf PORTB,7; > > GOTO mCODE > > DASH NOP > > bsf PORTB,7 > > ;(delay intra-elem + 3 element) > > bcf PORTB,7; > > GOTO mCODE > > end_of_char > > ;(end of char delay inter-char-elem + 3 element ???) > > > > > > Dennis. > > > > > I don't think you need to clear the carry first. Also, you can test for > zero by moving a byte of ram to itself. Your code becomes... > > > movlw B'11111111' ; Error sign > call SendMorseChar > > SendMorseChar > cblock > MorseChar > endc > movwf MorseChar ; Save character for shifting > SendMorseCharA > RLF MorseChar,f ; shift msb into carry > movf MorseChar,f ; test to see if we're done > bz SendMorseCharZ ; We're done, get out > skpc ; skip if dit > call DoDah ; go send dah - PRESERVE CARRY! > skpnc > call DoDit ; go send dit > call InterCharDelay > goto SendMorseCharA ; go send next bit, if any > SendMorseCharZ > return ; we're outta here! > > > > Harold > Harold, I don't see it. If C is not clear, a "one" is pushed right-to-left into the register, or the previous logical state. So SendMorseCharZ label is never reached.... The only way to get "zeroed" MorseChar, is by rotating zeros!... I'm correct? Regards, Dennis. Ps: Now it is a PIC issue. It's OK James? more chances to wake up Scott, Andrew and company :) -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist