> data in of the second, etc... tie all the clock and load lines together, > and rotate all three bytes out on the pin. Something like this: > > mov COUNTER, #24 ;we're going to rotate 24 bits > LOOP > rl BYTE3 ;rotate byte 3. MSB goes into carry bit. > rl BYTE2 ;carry goes into LSB, MSB goes into carry > rl BYTE1 ;same idea > movb C,DATAOUTPIN ;move carry bit to the output pin > setb CLOCKPIN ;strobe the clock pin > clrb CLOCKPIN > djnz COUNTER,LOOP ;repeat for all 24 bits > setb LOADPIN ;strobe the load pin > clrb LOADPIN > > This is written in Parallax's version of the instruction set but shouldn't > be too hard to follow. the 'djnz' instruction is decrement and jump if not > zero, and like many of the mnemonics compiles into several opcodes. Rotating both bytes together like that is a common technique, and I've seen it used frequently, but it's almost always better to use a routine to shift out eight bits at a time (note: the seemingly-odd placement of the "rlf" is to ensure that there is at least one instruction between the writes to CLOCK and DATA. Without such a delay, capacitive loading on the line could cause the program to malfunction--especially at higher crystal speeds. ShiftW: movwf Byte1 ShiftOne: bsf Counter,3 ShiftLp: bcf DATA btfsc Byte1,7 bsf DATA rlf Byte1,f bsf CLOCK bcf CLOCK decfsz Counter goto ShiftLp return ShiftAll: clrf Counter call ShiftOne movf Byte2,w call ShiftW movf Byte3,w call ShiftW bsf LATCH bcf LATCH return