Searching \ for 'Shiftout' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page:
Search entire site for: 'Shiftout'.

Truncated match.
PICList Thread
1998\01\26@085759 by miked

Any one have a routine equivilant to the BS2's Shiftout?

1998\01\26@194951 by Andrew Warren

Mike DeMetz <> wrote:

> Any one have a routine equivilant to the BS2's Shiftout?


This question was asked just a few weeks ago; here's a copy of my

------- Forwarded Message Follows ------

The straightforward assembly-language translation of this PBASIC

   Shiftout DataP,Clock,msbfirst,[counter] ' Send the bits.
   pulsout Latch,1                         ' Transfer to outputs.


       MOVLW   8           ;Setup to shift 8 bits.
       MOVWF   COUNT       ;


       BCF     DataP       ;Assume the next bit is a 0; pull the
                           ;DataP pin low.

       RLF     counter     ;Shift the next bit into the carry.
       SKPNC               ;If it really is a 0, skip ahead.
       BSF     DataP       ;Otherwise, pull the DataP pin high.

       BSF     Clock       ;Pulse the Clock line (the NOP may not be
       NOP                 ;necessary; check your device's timing
       BCF     Clock       ;requirements).

       DECFSZ  COUNT       ;Have we shifted all 8 bits out?
       GOTO    LOOP        ;if not, loop back and sjift another.

       BSF     Latch       ;Otherwise, pulse the Latch line.  Again,
       NOP                 ;the NOP may be unnecessary.
       BCF     Latch       ;

With the NOPs in place, this routine takes 84 clock cycles to shift a
byte out... So if your clock frequency is 4 MHz, it'll take 84
microseconds.  At 8 MHz, of course, it would take half as long.

------- End of Forwarded Message ------


=== Andrew Warren -
=== Fast Forward Engineering - Vista, California

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