AN2573 Freescale Semiconductor / Motorola, AN2573 Datasheet - Page 28

no-image

AN2573

Manufacturer Part Number
AN2573
Description
LINkits LIN Evaluation Boards
Manufacturer
Freescale Semiconductor / Motorola
Datasheet
AN2573/D
*
*
*
*
*
******************************************************************************/
void Read_button (void)
{
unsigned char key;
}
/******************************************************************************
28
key = PTA & 0x10;
if (key == key_last)
{
}
else
{
}
if (keycount == debounce)
{
}
else if (keycount < modecount)
{
}
if (keycount == modecount)
{
}
keycount = 0;
key_last = key;
if (key == 0)
{
}
keycount ++;
keycount ++;
if (key == 0)
{
}
else
{
}
if (mode)
{
}
else
{
}
mode = 1;
mode = 0;
and to decide if the same state has been present long
enough (3 seconds) for a mode change. In each mode the
appropriate increment (data or ID) takes place.
If the switch status changes the counter is reset.
ID++;
if (ID == 4) ID = 0;
data++;
if (data == 16) data = 1;
Freescale Semiconductor, Inc.
For More Information On This Product,
LINkits LIN Evaluation Boards
Go to: www.freescale.com
/* read button on A4
/* same as last time ?
/* yes, (debounce + 2)th ? */
/* yes, key pressed ?
/* yes, ID mode ?
/* yes, increment ID
/* wrap round from 3 to 0
/* no, normal mode
/* increment data
/* wrapping from 15 to 1
/* prevents re-entry
/* prevents wraparound
/* time for modechange ?
/* yes, key pressed ?
/* yes, change to ID mode
/* no, not pressed
/* so back to normal mode
/* no, different, so reset */
/* count and save status
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*
*
*
*
*
MOTOROLA

Related parts for AN2573