Any one have a routine equivilant to the BS2's Shiftout?
|Mike DeMetz <technologist.com> wrote: miked
> 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 - ix.netcom.comfastfwd
=== Fast Forward Engineering - Vista, California
More... (looser matching)
- Last day of these posts
- In 1998
, 1999 only
- New search...