Simplest state machine, Figure 24−12. simplest psm state diagram – Texas Instruments MSP430x4xx User Manual

Page 484

Advertising
background image

Scan IF Operation

24-24

Scan IF

Simplest State Machine

Figure 24−12 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 24−12. 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

Advertising