Microchip Technology DM183037 Data Sheet

Page of 10
TB3094
DS90003094A-page 4
 2013 Microchip Technology Inc.
//MiApp_WriteData(DeltaAccel[1]);
// y (no sign change on y-axis data) for
same movement as "dance leader"
FIGURE 5:
SIDE VIEW OF MULTIPLE 
DANCE BATONS WITH X, Y, 
Z AXES INDICATED
START OF GAME PLAY
For start of Game Play, the dance leader will press the
touch-sensitive button. This will establish the dance
leader and the game starts one second later. The next
button press will terminate the game and allow
selection of a new dance leader.
ACCELEROMETER SAMPLING
The accelerometer samples data at 100 Hz, and each
sample from the dance leader is transmitted wirelessly
to the other units in radio range. Receiving a packet
which contains motion data will force the receiving unit
into Follower mode. Units in Follower mode cannot
request being dance leader.
SCORE CALCULATION
Score is calculated by determining how well dance
follower actions mirror that of the dance leader. The
currently measured accelerations are compared
against a circular history log of the dance leader. When
events are closely correlated, the score will increase. If
the dance leader is not moving, there will be no events
registered, and the score will not increase. High scores
are obtained through close correlation of dynamic
movements.
 shows an example of how score is increased.
For measurements below the EVENT_THRESHOLD,
there is no comparison made. If measurements are
above the EVENT_THRESHOLD (in magnitude), then
the measured delta in acceleration will be compared
with the value in the circular event buffer. If the two
values fall within a delta of each other, then the score
will be increased, proportionally to how close the event
lies in the event buffer to the current time.
FIGURE 6:
EXAMPLE OF HOW SCORE 
IS RELEASED
 shows actual ΔX acceleration data taken from
the game. During periods of no movement, the value
will lie close to zero. When the development board is
moved along the X-axis, variations in ΔX are produced.
If current time = 80, data in the log prior to this will be
compared with current measurements. To compare
against prior events in the log, a countdown register is
used. Once the countdown register falls below a certain
value, the comparison stops. The countdown register is
bit-shifted to produce the resultant increase in score.
This causes movements that are closely correlated in
time to result in larger increases in score. More intricate
(and CPU intensive) methods are available for
movement correlation, but this method works fairly well
and leaves processor bandwidth for servicing wireless
messages and taking care of other game-related tasks.