Searching \ for 'Trying to make "SHIFTIN" code' 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: 'Trying to make "SHIFTIN" code'.

Truncated match.
PICList Thread
'Trying to make "SHIFTIN" code'
1998\03\05@214318 by Iliana & James Holbrook

I'm pretty new to this so bear with me.
Here is a snippet of code that I have come up with to
immulate the "SHIFTIN" function of the Basic Stamp 2
A professional opinion would be appreciated
Routine follows:

       movlw   0x08            ; set for 8 bits
       movwf   count
       clrf    Byte_in         ; set to all 0's
IN      bsf     clk             ; set clock pin high
       nop                     ; may not need these
       nop                     ; don't want to over speed
       btfsc   Data_pin        ; Is bit 1 or 0 ?
       setc                    ; set carry if it is 1
       rlf     Byte_in         ; MSB first, data in
       bcf     clk             ; clock low
       decfsz  count           ; done 8 bits ?
       goto    IN              ; no

It looks to me like it will work but I don't have the expertise.
Of course the best would be just to burn it and test it. The
problem is that I have so much more to test that I would like
some code that works to cut down on my fumble fingered
debugging !
       Thanks in advance

1998\03\06@085831 by wwl

picon face
On Thu, 5 Mar 1998 20:42:22 -0600, you wrote:

{Quote hidden}

a slightly smaller version...

 movlw 1               ; end of byte marker
 movwf byte_in
bsf clk
goto $+1  ; 2-cycle NOP (if needed)
btfsc data_pin
bcf clk         ; clear clk as soon as data has been read
                     ; to allow maximum time for clk fall
rlf byte_in
skpc          ; loop until marker bit falls out end of byte
goto loop

if you can arrange for data_in to be bit 0 or 7 of a port, you can
read it into carry using rrf port,w or rlf port,w respectively.

    ____                                                           ____
  _/ L_/  Mike Harrison / White Wing Logic /  _/ L_/
_/ W_/  Hardware & Software design / PCB Design / Consultancy  _/ W_/
/_W_/  Industrial / Computer Peripherals / Hazardous Area      /_W_/

1998\03\06@135046 by sdattalo

Mike Harrison wrote:
{Quote hidden}

and an even slightly smaller version

   movlw  1
   movwf  byte_in
   bsf    clk
   goto   $+1        ;probably mot necessary
   rlf    byte_in,F
   btfsc  data_pin
    bsf   byte_in,0
   bcf    clk
    goto  loop


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