AN1356 STMicroelectronics, AN1356 Datasheet - Page 38

no-image

AN1356

Manufacturer Part Number
AN1356
Description
PSDSOFT EXPRESS AND PSD4235G2 DESIGN GUIDE
Manufacturer
STMicroelectronics
Datasheet
AN1356 - APPLICATION NOTE
WSIPSD PROPERTY ’DataBus_OMC D[3:0]:init_count[3:0]’;
DCOUNT = [down_count3..down_count0];
INIT = [init_count3..init_count0];// 4-bit initial count from MCU
STINPUTS = [strobed_in_7..strobed_in_0];
STATE_MACHINE = [state_bit_1..state_bit_0];
// End user preserved declarations (not affected by iterations of DA usage)
===================
Now type in the following equations for the down-counter and the state-machine:
// Begin user preserved equations (not affected by iterations of DA usage)
===================
//**** 4-bit down counter. accepts initial value from mcu, auto reloads ****
term_count = (DCOUNT.fb == 0);
zero = term_count;
//**** simple state machine, looks for predefined sequence
//
state_diagram STATE_MACHINE;
state 0:
38/49
when (term_count) then DCOUNT := INIT;
sequence_ok = 0;
if ((begin == 1) & (sys_ready == 1)) then 1 else 0;
// 2 bits for 4-state state machine. Clocked by
// common PSD clock input (clkin).
// 8 inputs that are stobed (sampled) on the way into
// the PSD (debounced). These inputs are clocked on the
// opposite edge of the state machine clock (!clkin) so
// they are stable for each state machine transition.
// This statement forces the alignment of
// init_count bits [3..0] to the MCU data bus bit positions [3..0].
of values appearing on the 8 strobed inputs *****
// automatically reload counter with initial
// value after a count of zero is reached
// Assign terminal count to PSD output pin
// indicate sequence not found yet
// stay in this state if ’begin’
// true when count reaches zero
// 4-bit down counter

Related parts for AN1356