From a388a4cede7b718889756ea08c1dd56109217076 Mon Sep 17 00:00:00 2001 From: RossTheRoss Date: Wed, 26 Feb 2020 08:26:09 -0600 Subject: e --- Lab3.X/lab3_main_c.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'Lab3.X/lab3_main_c.c') diff --git a/Lab3.X/lab3_main_c.c b/Lab3.X/lab3_main_c.c index 406f657..fa01c95 100644 --- a/Lab3.X/lab3_main_c.c +++ b/Lab3.X/lab3_main_c.c @@ -26,6 +26,11 @@ void delay(long n) { void setup(void) { CLKDIVbits.RCDIV = 0; //Set RCDIV=1:1 (default 2:1) 32MHz or FCY/2=16M AD1PCFG = 0x9fff; //sets all pins to digital I/O +// T1CON = 0; +// PR1 = 15999; +// TMR1 = 0; +// IFS0bits.T1IF = 0; +// T1CONbits.TON = 1; init7seg(); initKeyPad(); } @@ -33,16 +38,21 @@ void setup(void) { int main(void) { setup(); char right, left, temp; + unsigned long debounce = 0; while (1) { - temp = readKeyPadRAW(); + if (debounce % 300 == 0) + temp = readKeyPadRAW(); + else + temp = '\0'; if (temp != '\0') { left = right; right = temp; } - showChar7seg(right, LSB); + showChar7seg(right, MSB); delay(200); - showChar7seg(left, MSB); + showChar7seg(left, L4SB); delay(200); + debounce++; } } -- cgit v1.2.3