#include "project.
h"
int counter = 0;
int main(void)
{
CyGlobalIntEnable; /* Enable global interrupts. */
LCD_Char_Start();
LCD_Char_Enable();
LCD_Char_ClearDisplay();
for(;;)
{
if(SW_Read() == 1)
{
CyDelay(500);
counter++;
}
if(counter == 1)
{
LCD_Char_Position(0u, 3u);
LCD_Char_PrintString("TEAM 5");
}
else if (counter == 2)
{
counter = 0;
LCD_Char_ClearDisplay();
}
}
}
/* [] END OF FILE */
CONCLUSION
The button of an electronic device usually works as an electrical switch, that is to
say inside it has two contacts, when one is pressed, the inverse function of the one
that is currently being performed will be activated, if it is an NA device (normally
open) will be closed, if it is an NC device (normally closed) it will be opened.
Push buttons or switches, there are tons of them in your home. A switch is a simple
device with two positions, ON and AP (On and Off).
That we can highlight in the procedure that is followed to perform the code that
prevents rebounds. If we look closely at the behavior of the program,
it was necessary to implement a “cydelay” to avoid that rebound that the
mechanical switch present in these cases when touching the plates this was the
delay that was put to the program was so that the program can avoid rebounding
this makes it through reading of the state the “deley“ gives the program time to
know exactly the status of the button