Skip to content

Instantly share code, notes, and snippets.

@michaellin
Created December 1, 2015 04:34
Show Gist options
  • Save michaellin/63a1ba29021a169d5604 to your computer and use it in GitHub Desktop.
Save michaellin/63a1ba29021a169d5604 to your computer and use it in GitHub Desktop.
/***Module for writing to shift register connected to the LCD monitor***/
initialize module leve variables
define ALL_BITS offset variable as 0xff<<2
/**************************************************************
Function: SR_Init_LCD
Takes: nothing
Returns: nothing
Purpose: initializes the Tiva pins that are used to control the shift register
/*************************************************************/
SR_Init_LCD
Initialize port F
Initialize bit 0
Initialize bit 1
Initialize bit 2
Set Data Line Low
Set Shift Clock Low
Set Register Clock High
end
/**************************************************************
Function: SR_Write_LCD
Takes: 8 bit integer
Returns: nothing
Purpose: writes input 8 bit integer to the 8 outputs (Q0-Q7) of the shift register
/*************************************************************/
SR_Write_LCD
pass input param to static variable ShiftRegisterImage
Set STCP low
Shift data onto serial data line while pulsing shift clock
loop 8 times
if LSB of input param is high
set bit 0 high
else
set bit 0 low
endif
Set SHCP hi
Set SHCP low
Shift NewValue right 1 bit
Set STCP hi
end
/**************************************************************
Function: SR_GetCurrentRegister_LCD
Takes: nothing
Returns: 8 bit integer
Purpose: allows other modules to check the last integer that was written to the shift register
/*************************************************************/
SR_GetCurrentRegister_LCD
return variable ShiftRegisterImage
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment