Shift Register Module Pseudocode
Shift Register Module
initShiftRegister takes nothings, returns true
set up data direction lines
End of initShiftRegister
rightPin takes output of shift register, returns nothing
for each bit (16 times)
set data line to value of bit
pulse shift clock high
end loop
pulse register clock high
End of rightPin
readPin1 takes nothing, returns 16 bit input value
pulse latch high
for each bit (16 times)
shift data bit into return value
pulse shift clock high
end loop
return 16 bit value
End of readPin1
readPin2 takes nothing, returns 8 bit input value
pulse latch high
for each bit (8 times)
shift data bit into return value
pulse shift clock high
end loop
return 8 bit value
End of readPin2
initShiftRegister takes nothings, returns true
set up data direction lines
End of initShiftRegister
rightPin takes output of shift register, returns nothing
for each bit (16 times)
set data line to value of bit
pulse shift clock high
end loop
pulse register clock high
End of rightPin
readPin1 takes nothing, returns 16 bit input value
pulse latch high
for each bit (16 times)
shift data bit into return value
pulse shift clock high
end loop
return 16 bit value
End of readPin1
readPin2 takes nothing, returns 8 bit input value
pulse latch high
for each bit (8 times)
shift data bit into return value
pulse shift clock high
end loop
return 8 bit value
End of readPin2