From 9416d720e118e4b5508ad17d64af0c9b69ff3a2f Mon Sep 17 00:00:00 2001 From: Matt Strapp Date: Fri, 28 Feb 2020 11:20:34 -0600 Subject: Redo numpad --- Lab3.X/display.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'Lab3.X/display.c') diff --git a/Lab3.X/display.c b/Lab3.X/display.c index 5ad9c4f..d456b49 100644 --- a/Lab3.X/display.c +++ b/Lab3.X/display.c @@ -2,9 +2,13 @@ #include "display.h" //Functions used for Display -void init7seg(void) { - TRISB = 0b0000000000000011; //and port B to outputs - LATB = 0x0000; //and all of port B to LOW +void init7seg(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 + TRISA = 0b0000000000011111; //set port A to inputs, + TRISB = 0b0000000000000011; //and port B to outputs + LATA = 0x0000; //Set all of port A to LOW + LATB = 0x0000; //and all of port B to LOW } void showChar7seg(char myChar, enum DIGIT myDigit) { @@ -61,6 +65,6 @@ void showChar7seg(char myChar, enum DIGIT myDigit) { default: LATB ^= (0b11111111 << 2); break; - } //END OF SWITCH + } //END OF SWITCH LATB |= myDigit; } \ No newline at end of file -- cgit v1.2.3