Texas Instruments MSP430x4xx Computer Hardware User Manual


 
Scan IF Operation
24-24 Scan IF
Simplest State Machine
Figure 2412 shows the simplest state machine that can be realized with the
PSM. The following code shows the corresponding state table and the PSM
initialization.
Figure 2412. Simplest PSM State Diagram
S1=1 & S2=0
S1=0 & S2=0
S1=1 & S2=1
S1=0 & S2=0
S1=0 & S2=1
S1=1 & S2=1
S1=1 & S2=0
S1=1 & S2=1
S1=0 & S2=1
S1=0 & S2=0
State 00
00000000
State 10
00000000
State 11
00000010
State 01
00000000
S1=0 & S2=0
S1=0 & S2=1
S1=1 & S2=0
S1=1 & S2=1
S1=1 & S2=0
S1=0 & S2=1
; Simplest State Machine Example
SIMPLEST_PSM db 000h ; State 00 (State Table Index 0)
db 000h ; State 01 (State Table Index 1)
db 000h ; State 10 (State Table Index: 2)
db 002h ; State 11 (State Table Index: 3)
PSM_INIT
MOV #SIMPLEST_PSM,&SIFPSMV ; Init PSM vector
MOV #SIFS20,&SIFCTL3 ; S1/S2 source
MOV #SIFCNT1ENP+SIFCNT1ENM,&SIFCTL4
; Q7 and Q6 disabled for next state calc.
; Increment and decrement of SIFCNT1 enabled