You are on page 1of 4

Pseudo-code for the DM_Display module (only new pseudo code for this

project is included)
Data private to the module: DM_Display0, DM_Display1, DM_Display2,
CurrentInitStep, BitReverseTable256,

Functions private to the module: sendCmd, sendRow

DM_TakeInitDisplayStep
Takes a priority number, returns True.

Local variables: rowIndex, i, ReturnVal set to false

CurrentInitStep is DM_StepStartShutdown
*No Changes*
End CurrentInitStep

CurrentInitStep is DM_StepFillBufferZeros
Set FullRow of DM_Display0, DM_Display1, DM_Display2 equal to 0
End CurrentInitStep

CurrentInitStep is DM_StepDisableCodeB
*No Changes*
End CurrentInitStep

CurrentInitStep is DM_StepEnableScanAll
*No Changes*
End CurrentInitStep

CurrentInitStep is DM_StepSetBrightness
*No Changes*
End CurrentInitStep

CurrentInitStep is DM_StepStartShutdown
*No Changes*
End CurrentInitStep

CurrentInitStep is DM_StepCopyBuffer2Display
*No Changes*
End CurrentInitStep

CurrentInitStep is DM_StepEndShutdown
*No Changes*
End CurrentInitStep
End of DM_TakeInitDisplayStep

DM_TakeDisplayUpdateStep
Takes nothing, returns ReturnVal

Local variables: WhichRow set to 0, ReturnVal set to false

Call sendRow with WhichRow DM_Display0 at index WhichRow, and


lastModule false
Call sendRow with WhichRow DM_Display1 at index WhichRow, and
lastModule false
Call sendRow with WhichRow DM_Display2 at index WhichRow, and
lastModule true

Index WhichRow by 1
If WhichRow is equal to eight, set ReturnVal to true

Return ReturnVal

End of DM_TakeDisplayUpdateStep

DM_ScrollDisplayBuffer

*Unused*

End of DM_ScrollDisplayBuffer

DM_AddChar2DisplayBuffer

*Unused*

End of DM_AddChar2DisplayBuffer

DM_ClearDisplayBuffer
Takes nothing, returns nothing

Local variables: rowIndex

For all rows


Set DM_Display0, DM_Display1, DM_Display2 at rowIndex equal to
0
EndFor
End of ClearDisplayBuffer

DM_PutDataIntoBufferRow

*Unused*

End of DM_PutDataIntoBufferRow

DM_DisplayArrayToBuffer
Takes DisplayArray, returns ReturnVal

Local variables: ReturnVal set to true

For rows 0 to 7
Index (7 - row) of DM_Display2 set equal to DisplayArray of row
EndFor

For rows 8 to 15
Index (15 - row) of DM_Display1 set equal to DisplayArray of
row
EndFor

For rows 16 to 23
Index 23 - row) of DM_Display0 set equal to DisplayArray of row
EndFor

Return ReturnVal

End of DM_DisplayArrayToBuffer

sendCmd
Takes Cmd2Send, returns nothing

Local variables: index, i

For index less than number of modules minus 2


Call SPIOperate_SPI1_Send16
EndFor

Call SPIOperate_SPI1_Send16Wait

Return ReturnVal
End of SendCmd

sendRow
Takes Cmd2Send, returns nothing

Local variables: index, i

For index less than number of modules minus 2


Call SPIOperate_SPI1_Send16 with RowNumber “or” RowData
While SPI1 Buffer is full
End While
EndFor

If LastModule is false
Call SPIOperate_SPI1_Send16 with RowNumber “or” RowData
Else
Call SPIOperate_SPI1_Send16Wait with RowNumber “or” RowData
EndIf

Call SPIOperate_SPI1_Send16Wait

Return ReturnVal

End of SendCmd

You might also like