Searching \ for '[PIC] Morse speed -- 11 instructions! -sorry: not' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/devices.htm?key=pic
Search entire site for: 'Morse speed -- 11 instructions! -sorry: not'.

Exact match. Not showing close matches.
PICList Thread
'[PIC] Morse speed -- 11 instructions! -sorry: not '
2007\03\19@180416 by Robert Ammerman

picon face
Sorry Steve, you forgot to include the "incf delay,f" at Delay_routine_1 in
your count.

And, as Harold noted, we need a clrc before the rlf

So, at this point the best we have is 13 instructions.

For amusement, here is another way to set up the argument to the delay
routine, this time with the assumption that it expects its argument in W,
and returns W == 0:

   rlf    bits,f
   skpnz
   ret

; next instruction is very sneaky. it depends on the
; fact that CARRY is the LSBIT of STATUS
   rlf    STATUS,W
   andlw 2        ; W is now 0 or 2

Unfortunately this doesn't save us any instructions

Bob Ammerman

==========================

Steve Smith's version:

    movwf bits
loop:
    rlf bits,f
    skpnz
    ret

; cy is 0 for a DIT, 1 for  a DAH, so...

   Skpnc ; carry is valid from the rotate
    Bsf delay_count,1 ; delay is 2 or 0
    bsf portb,1  ; turn on tone generator
    call delay_routine_1
    bcf portb,1  ; turn off tone generator
    call delay_routine_1
    bra loop

Delay_routine_1
    Incf delay,f        <--this is instruction 12
Delay....


2007\03\19@183327 by Steve Smith

flavicon
face
I see the error of my ways... Cant count....
Also the carry needs to be cleared not just tested or it will wrap around
into the bits reg on the second iteration, where in your original routine it
was used as the delay bit 0

Steve

{Original Message removed}

More... (looser matching)
- Last day of these posts
- In 2007 , 2008 only
- Today
- New search...