You are on page 1of 2

ShiftRegisterWrite

SR_InitForProject
Takes no inputs, returns nothing

Enable peripheral clock for Port A


Wait till peripheral is ready
Enable peripheral clock for Port B
Wait till peripheral is ready
Enable peripheral clock for Port C
Wait till peripheral is ready
Enable peripheral clock for Port D
Wait till peripheral is ready
Enable peripheral clock for Port E
Wait till peripheral is ready
Enable peripheral clock for Port F
Wait till peripheral is ready
Set pins A2, A3, A4, A5, A6, B0, B1, B2, B3, C6, C7, D0, D1, D2,
D3, D6, D7, E2, E3, F0, F3, F4 as digital
Set pins A2, A3, A4, B0, B1, B2, B3, E2, E3, F0, F3 as outputs
Set data and shift register clock lines low and storage register
clock lines low

End of SR_InitForProject

SR_Write
Takes NewValue as a parameter, returns nothing

Set storage register clock low


Isolate MSB, put it on pin, pulse shift register clock, shift
NewValue to the left by 1, and repeat 7 times
Pulse storage register clock

End of SR_Write
SR_Write4
Takes NewValue as a parameter, returns nothing

Set storage register clock low


Isolate MSB, put it on pin, pulse shift register clock, shift
NewValue to the left by 1, and repeat 3 times
Pulse storage register clock

End of SR_Write4

SR_Write16
Takes NewValue as a parameter, returns nothing

Set storage register clock low


Isolate MSB, put it on pin, pulse shift register clock, shift
NewValue to the left by 1, and repeat 15 times
Pulse storage register clock

End of SR_Write16

End of ShiftRegisterWrite

You might also like