Pseudo-code for Shift Register module ********************************************************************************************** SR_Init //Takes no input, returns nothing Set Pin PBO - PB2 to Digital Output Set Pin PB0 (Data Line) and PB2 (SCLK Line) to LO Set Pin PB1 (RCLK Line) to HI End SR_Init SR_GetCurrentRegister //Takes no input, returns the current register state Get Current State of Shift Register Pins End SR_GetCurrentRegister SR_Write // Takes in a new value, returns nothing. // Writes the new value to the shift register Lower the Register Clock Pin Shift out the data while Pulsing the Serial Clock Isolate the MSB of NewValue, put it into the LSB Position and output to port Raise SCLK Line Lower SCLK Line Finish looping through bits in NewValue End SR_Write LightLED //Takes two chars, WhichOne: which LED to turn on (L,M,R,A,0) and //WhichColor: color to turn it to (R,G,B,W,0) and completes the action //First it turns off all LEDs and then turns on the specfic LED based on WhichOne and WhichColor inputs //Returns nothing If WhichOne is equal to L and WhichColor is equal R Write 0xff to Shift Register Set Bit 0 to LO Raise the Register Clock to Latch the new data Endif If WhichOne is equal to L and WhichColor is equal G Write 0xff to Shift Register Set Bit 1 to LO Raise the Register Clock to Latch the new data Endif If WhichOne is equal to L and WhichColor is equal B Write 0xff to Shift Register Set Bit 2 to LO Raise the Register Clock to Latch the new data Endif If WhichOne is equal to L and WhichColor is equal W Write 0xff to Shift Register Set Bit 0, 1 and 2 to LO Raise the Register Clock to Latch the new data Endif If WhichOne is equal to M and WhichColor is equal R Write 0xff to Shift Register Set Bit 3 to LO Raise the Register Clock to Latch the new data Endif If WhichOne is equal to M and WhichColor is equal G Write 0xff to Shift Register Set Bit 4 to LO Raise the Register Clock to Latch the new data Endif If WhichOne is equal to M and WhichColor is equal B Write 0xff to Shift Register Set Bit 5 to LO Raise the Register Clock to Latch the new data Endif If WhichOne is equal to M and WhichColor is equal W Write 0xff to Shift Register Set Bit 3, 4 and 5 to LO Raise the Register Clock to Latch the new data Endif If WhichOne is equal to R and WhichColor is equal R Write 0xff to Shift Register Set Bit 6 to LO Raise the Register Clock to Latch the new data Endif If WhichOne is equal to R and WhichColor is equal G Write 0xff to Shift Register Set Bit 7 to LO Raise the Register Clock to Latch the new data Endif If WhichOne is equal to R and WhichColor is equal B Write 0xff to Shift Register Set Bit 8 to LO Raise the Register Clock to Latch the new data Endif If WhichOne is equal to R and WhichColor is equal W Write 0xff to Shift Register Set Bit 6, 7 and 8 to LO Raise the Register Clock to Latch the new data Endif If WhichOne is equal to A and WhichColor is equal R Write 0xff to Shift Register Set Bit 0, 3 and 6 to LO Raise the Register Clock to Latch the new data Endif If WhichOne is equal to A and WhichColor is equal G Write 0xff to Shift Register Set Bit 1, 4 and 7 to LO Raise the Register Clock to Latch the new data Endif If WhichOne is equal to A and WhichColor is equal B Write 0xff to Shift Register Set Bit 0, 2 and 5 to LO Raise the Register Clock to Latch the new data Endif If WhichOne is equal to 0 and WhichColor is equal 0 Write 0xff to Shift Register Write 0xff to Shift Register Raise the Register Clock to Latch the new data Endif End LightLED