'Trying to make "SHIFTIN" code'
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
movlw 0x08 ; set for 8 bits
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
Thanks in advance
On Thu, 5 Mar 1998 20:42:22 -0600, you wrote:
a slightly smaller version...
movlw 1 ; end of byte marker
goto $+1 ; 2-cycle NOP (if needed)
bcf clk ; clear clk as soon as data has been read
; to allow maximum time for clk fall
skpc ; loop until marker bit falls out end of byte
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 / netcomuk.co.uk _/ L_/ wwl
_/ W_/ Hardware & Software design / PCB Design / Consultancy _/ W_/
/_W_/ Industrial / Computer Peripherals / Hazardous Area /_W_/
Mike Harrison wrote:
and an even slightly smaller version
goto $+1 ;probably mot necessary
More... (looser matching)
- Last day of these posts
- In 1998
, 1999 only
- New search...