Tenho uma placa PSCOEVAL1. Tenho feito meus treinamentos sobre este maravilhoso chip. Atualmente estou estudanto os contadores e tenho o seguinte programa:
#include <m8c.h> // part specific constants and macros
#include "PSoCAPI.h" // PSoC API definitions for all User Modules
#include "stdlib.h"
char buff[10];
void main()
{
M8C_EnableGInt;
Counter8_1_Start();
LCD_1_Start();
LCD_1_Init();
M8C_EnableIntMask(INT_MSK0, INT_MSK0_GPIO);
LCD_1_PrCString("QuadPhase Test");
while(1)
{
BYTE valor;
valor=Counter8_1_bReadCounter();
itoa(buff,valor,10); // convert int to strig
LCD_1_Position(1,0);
LCD_1_PrString(buff);
}
}
Para decrementar o counter e aparecer o resultado no LCD eu pressiono um switch, mas está muito sensível. Ao ativá-lo ele decrementa várias unidades de uma vez só. Como faço para resolver o problema para decrementar apenas uma unidade de cada vez que for pressionado, alguém tem um exemplo?