Searching \ for 'Shiftout' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: techref.massmind.org/techref/index.htm?key=shiftout
Search entire site for: 'Shiftout'.

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

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

1998\01\26@194951 by Andrew Warren

face
flavicon
face
Mike DeMetz <spam_OUTmikedTakeThisOuTspamtechnologist.com> wrote:

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

Mike:

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

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

The straightforward assembly-language translation of this PBASIC
fragment:

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

is:

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

   LOOP:

       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 ------

-Andy

=== Andrew Warren - .....fastfwdKILLspamspam@spam@ix.netcom.com
=== Fast Forward Engineering - Vista, California
=== http://www.geocities.com/SiliconValley/2499

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