diff options
Diffstat (limited to '')
-rw-r--r-- | Lab3.X/numpad.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/Lab3.X/numpad.c b/Lab3.X/numpad.c index 8e486f4..455ef19 100644 --- a/Lab3.X/numpad.c +++ b/Lab3.X/numpad.c @@ -17,7 +17,8 @@ void padDelay(long n) { char readKeyPadRAW(void) {
int i;
char num;
- num = '\0';
+//0
+ num = (_RA0 << 3) | (_RA1 << 2) | (_RA2 << 1) | _RA3;
LATB |= (0b1111 << 12);
padDelay(5);
for (i = 0; i < 4; i++) {
@@ -35,7 +36,7 @@ char readKeyPadRAW(void) { case 0b1011:
return '2';
break;
- case 0b111:
+ case 0b0111:
return '1';
break;
} break;
@@ -50,7 +51,7 @@ char readKeyPadRAW(void) { case 0b1011:
return '5';
break;
- case 0b111:
+ case 0b0111:
return '4';
break;
} break;
@@ -65,7 +66,7 @@ char readKeyPadRAW(void) { case 0b1011:
return '8';
break;
- case 0b111:
+ case 0b0111:
return '7';
break;
} break;
@@ -80,7 +81,7 @@ char readKeyPadRAW(void) { case 0b1011:
return '0';
break;
- case 0b111:
+ case 0b0111:
return 'F';
break;
} break;
@@ -102,4 +103,4 @@ Outputs<8:5> = 0b1110; // Set Row 4 output Low delay(1us);
RowFour = Inputs<4:1>; // returns 0b1111 (no buttons pressed in row 4)
- */
\ No newline at end of file + */
|