You are on page 1of 2

PACService

PublicFunctions:InitSSI,InterruptPACResponse,GetFirstByte,GetSecondByte,
GetThirdByte,GetFourthByte,GetFifthByte

InitSSI
EnabletheclocktotheGPIOport
EnabletheclocktoSSImodule

WaitfortheGPIOporttobeready
ProgramtheGPIOtousethealternatefunctionsontheSSIpinsA2,A3,A4,A5
SetmuxpositioninGPIOPCTLtoselecttheSSIuseofthepinswrite2to
A2,A3,A4,A5
ProgramtheportlinesfordigitalI/O

ProgramtherequireddatadirectionsontheportlinesforCOMMANDGENERATOR
IfusingSPImode3,programthepullupontheclockline
WaitfortheSSI0tobeready
MakesurethattheSSIisdisabledbeforeprogrammingmodebits
Selectmastermode(MS)&TXRISindicatingEndofTransmit(EOT)
ConfiguretheSSIclocksourcetothesystemclock
Configuretheclockprescaler
Configureclockrate(SCR),phase&polarity(SPH,SPO)
Datasize(DSS)is8bits
ModeFRF
EnableNVIC
Globallyenableinterrupts
EndInitSSI

InterruptPACResponse
Read5bytesfromthedataregister
PostNEW_COMMANDeventtoMasterSM
Disableinterrupt
EndInterruptPACResponse

GetFirstByte
ReturnFirstByte
EndGetFirstByte

GetFirstByte
ReturnFirstByte
EndGetFirstByte

GetSecondByte
ReturnSecondByte
EndGetSecondByte

GetThirdByte
ReturnThirdByte
EndGetThirdByte

GetFourthByte
ReturnFourthByte
EndGetFourthByte

GetFifthByte
ReturnFifthByte

EndGetFifthByte

EndPACService

You might also like