For MSBFIRST, just change the order of the 'WREG.bit' tests
Code:
; SHOUT
; shift out 8 bits of data, MSB to LSB
; data clocked on rising edge of SHCLK
; WREG = data to send
SHOUT:
SHDAT = 0
if WREG.7 then
SHDAT = 1
endif
SHCLK = 1
SHCLK = 0
SHDAT = 0
if WREG.6 then
SHDAT = 1
endif
SHCLK = 1
SHCLK = 0
SHDAT = 0
if WREG.5 then
SHDAT = 1
endif
SHCLK = 1
SHCLK = 0
SHDAT = 0
if WREG.4 then
SHDAT = 1
endif
SHCLK = 1
SHCLK = 0
SHDAT = 0
if WREG.3 then
SHDAT = 1
endif
SHCLK = 1
SHCLK = 0
SHDAT = 0
if WREG.2 then
SHDAT = 1
endif
SHCLK = 1
SHCLK = 0
SHDAT = 0
if WREG.1 then
SHDAT = 1
endif
SHCLK = 1
SHCLK = 0
SHDAT = 0
if WREG.0 then
SHDAT = 1
endif
SHCLK = 1
SHCLK = 0
return
Bookmarks