aboutsummaryrefslogtreecommitdiffstats
path: root/Lab3.X
diff options
context:
space:
mode:
Diffstat (limited to 'Lab3.X')
-rw-r--r--Lab3.X/display.c99
-rw-r--r--Lab3.X/display.h2
-rw-r--r--Lab3.X/dist/default/production/memoryfile.xml4
-rw-r--r--Lab3.X/lab3_main.c (renamed from Lab3.X/lab3_main_MAYA_C.c)157
-rw-r--r--Lab3.X/lab3_main_c.BAK (renamed from Lab3.X/lab3_main_c.c)118
-rw-r--r--Lab3.X/nbproject/Makefile-default.mk8
-rw-r--r--Lab3.X/nbproject/Makefile-genesis.properties14
-rw-r--r--Lab3.X/nbproject/Makefile-local-default.mk26
-rw-r--r--Lab3.X/nbproject/configurations.xml10
-rw-r--r--Lab3.X/nbproject/private/configurations.xml4
-rw-r--r--Lab3.X/nbproject/private/private.xml8
-rw-r--r--Lab3.X/nbproject/project.xml2
-rw-r--r--Lab3.X/numpad.c45
-rw-r--r--Lab3.X/numpad.h1
14 files changed, 239 insertions, 259 deletions
diff --git a/Lab3.X/display.c b/Lab3.X/display.c
index d456b49..90690e5 100644
--- a/Lab3.X/display.c
+++ b/Lab3.X/display.c
@@ -11,60 +11,47 @@ void init7seg(void) {
LATB = 0x0000; //and all of port B to LOW
}
-void showChar7seg(char myChar, enum DIGIT myDigit) {
- LATB &= 0x00;
- switch (myChar) {
- case '0':
- LATB ^= (0b11 << 2);
- break;
- case '1':
- LATB ^= (0b10011111 << 2);
- break;
- case '2':
- LATB ^= (0b00100101 << 2);
- break;
- case '3':
- LATB ^= (0b1101 << 2);
- break;
- case '4':
- LATB ^= (0b10011001 << 2);
- break;
- case '5':
- LATB ^= (0b1001001 << 2);
- break;
- case '6':
- LATB ^= (0b1000001 << 2);
- break;
- case '7':
- LATB ^= (0b11111 << 2);
- break;
- case '8':
- LATB ^= (0b1 << 2);
- break;
- case '9':
- LATB ^= (0b1001 << 2);
- break;
- case 'A':
- LATB ^= (0b10001 << 2);
- break;
- case 'b':
- LATB ^= (0b11000001 << 2);
- break;
- case 'C':
- LATB ^= (0b01100011 << 2);
- break;
- case 'd':
- LATB ^= (0b10000101 << 2);
- break;
- case 'E':
- LATB ^= (0b01100001 << 2);
- break;
- case 'F':
- LATB ^= (0b01110001 << 2);
- break;
- default:
- LATB ^= (0b11111111 << 2);
- break;
- } //END OF SWITCH
- LATB |= myDigit;
+void showChar7seg(char myChar, int myDigit)
+{
+ //1,2,3,4,5,6,7,8,9,0,A,b,C,d,E, and F
+ LATB&=0xF000;
+ if (myDigit==1)
+ {
+ if (myChar=='1'){LATB|=0x067F;}
+ else if (myChar=='2'){LATB|=0x0497;}
+ else if (myChar=='3'){LATB|=0x0437;}
+ else if (myChar=='4'){LATB|=0x0667;}
+ else if (myChar=='5'){LATB|=0x0527;}
+ else if (myChar=='6'){LATB|=0x0507;}
+ else if (myChar=='7'){LATB|=0x047F;}
+ else if (myChar=='8'){LATB|=0x0407;}
+ else if (myChar=='9'){LATB|=0x0427;}
+ else if (myChar=='0'){LATB|=0x040F;}
+ else if (myChar=='A'){LATB|=0x0447;}
+ else if (myChar=='b'){LATB|=0x0707;}
+ else if (myChar=='C'){LATB|=0x058F;}
+ else if (myChar=='d'){LATB|=0x0617;}
+ else if (myChar=='E'){LATB|=0x0587;}
+ else if (myChar=='F'){LATB|=0x05C7;}
+ }
+ else if (myDigit==0)
+ {
+ if (myChar=='1'){LATB|=0x0A7F;}
+ else if (myChar=='2'){LATB|=0x0897;}
+ else if (myChar=='3'){LATB|=0x0837;}
+ else if (myChar=='4'){LATB|=0x0A67;}
+ else if (myChar=='5'){LATB|=0x0927;}
+ else if (myChar=='6'){LATB|=0x0907;}
+ else if (myChar=='7'){LATB|=0x087F;}
+ else if (myChar=='8'){LATB|=0x0807;}
+ else if (myChar=='9'){LATB|=0x0827;}
+ else if (myChar=='0'){LATB|=0x080F;}
+ else if (myChar=='A'){LATB|=0x0847;}
+ else if (myChar=='b'){LATB|=0x0B07;}
+ else if (myChar=='C'){LATB|=0x098F;}
+ else if (myChar=='d'){LATB|=0x0A17;}
+ else if (myChar=='E'){LATB|=0x0987;}
+ else if (myChar=='F'){LATB|=0x09C7;}
+ }
+ return;
} \ No newline at end of file
diff --git a/Lab3.X/display.h b/Lab3.X/display.h
index 893eea1..147536d 100644
--- a/Lab3.X/display.h
+++ b/Lab3.X/display.h
@@ -14,7 +14,7 @@ extern "C" {
LSB = (0b1 << 10)
};
void init7seg(void);
- void showChar7seg(char myChar, enum DIGIT myDigit);
+ void showChar7seg(char myChar, int myDigit);
void delay(long num);
#ifdef __cplusplus
diff --git a/Lab3.X/dist/default/production/memoryfile.xml b/Lab3.X/dist/default/production/memoryfile.xml
index 508df7f..316ead1 100644
--- a/Lab3.X/dist/default/production/memoryfile.xml
+++ b/Lab3.X/dist/default/production/memoryfile.xml
@@ -11,8 +11,8 @@
<memory name="program">
<units>bytes</units>
<length>65274</length>
- <used>2034</used>
- <free>63240</free>
+ <used>2481</used>
+ <free>62793</free>
</memory>
</executable>
</project>
diff --git a/Lab3.X/lab3_main_MAYA_C.c b/Lab3.X/lab3_main.c
index a943ae2..051b2c1 100644
--- a/Lab3.X/lab3_main_MAYA_C.c
+++ b/Lab3.X/lab3_main.c
@@ -1,96 +1,63 @@
-#include "xc.h"
-#include "numpad.h"
-#include "display.h"
-
-// CW1: FLASH CONFIGURATION WORD 1 (see PIC24 Family Reference Manual 24.1)
-#pragma config ICS = PGx1 // Comm Channel Select (Emulator EMUC1/EMUD1 pins are shared with PGC1/PGD1)
-#pragma config FWDTEN = OFF // Watchdog Timer Enable (Watchdog Timer is disabled)
-#pragma config GWRP = OFF // General Code Segment Write Protect (Writes to program memory are allowed)
-#pragma config GCP = OFF // General Code Segment Code Protect (Code protection is disabled)
-#pragma config JTAGEN = OFF // JTAG Port Enable (JTAG port is disabled)
-
-
-// CW2: FLASH CONFIGURATION WORD 2 (see PIC24 Family Reference Manual 24.1)
-#pragma config I2C1SEL = PRI // I2C1 Pin Location Select (Use default SCL1/SDA1 pins)
-#pragma config IOL1WAY = OFF // IOLOCK Protection (IOLOCK may be changed via unlocking seq)
-#pragma config OSCIOFNC = ON // Primary Oscillator I/O Function (CLKO/RC15 functions as I/O pin)
-#pragma config FCKSM = CSECME // Clock Switching and Monitor (Clock switching is enabled,
-// Fail-Safe Clock Monitor is enabled)
-#pragma config FNOSC = FRCPLL // Oscillator Select (Fast RC Oscillator with PLL module (FRCPLL))
-
-#define NOKEY 255
-
-void delay(long d) {
- for (d=d; d > 0; d--) {
- asm("nop");
- }
-}
-char cycle();
-
-
-//============================================================================//
-
-int main(void) {
- init7seg();
- initKeyPad();
- char key = 'N';
- char right, left;
- int debounce = 250;
- //RB<9:2> will drive the cathodes of the seven-segment display
- //RB<11:10> will drive the right and left anodes respectively
- //RA<3:0> will drive inputs of keypad
- //RB<15:12> will cycle to sense RA inputs
- while (1) {
- if (debounce == 0) {
- key = cycle();
- if (key != 'N') {
- left = right;
- right = key;
- }
- debounce = 250;
- }
-
- showChar7seg(right, MSB);
- delay(500);
- showChar7seg(left, LSB);
- delay(200);
-
- debounce--;
-// while (!IFS0bits.T1IF);
-// IFS0bits.T1IF = 0;
- }
-}
-
-char cycle() {
- int i = 0;
- char key = 'N';
- while (i < 4) {
- if (i == 0) {
- LATBbits.LATB12 = 0;
- LATBbits.LATB13 = 1;
- LATBbits.LATB14 = 1;
- LATBbits.LATB15 = 1;
- } else if (i == 1) {
- LATBbits.LATB12 = 1;
- LATBbits.LATB13 = 0;
- LATBbits.LATB14 = 1;
- LATBbits.LATB15 = 1;
- } else if (i == 2) {
- LATBbits.LATB12 = 1;
- LATBbits.LATB13 = 1;
- LATBbits.LATB14 = 0;
- LATBbits.LATB15 = 1;
- } else if (i == 3) {
- LATBbits.LATB12 = 1;
- LATBbits.LATB13 = 1;
- LATBbits.LATB14 = 1;
- LATBbits.LATB15 = 0;
- }
- key = readKeyPadRAW();
- if (key != 'N') {
- return key;
- }
- i++;
- }
- return key;
+#include "xc.h"
+#include "numpad.h"
+#include "display.h"
+
+// CW1: FLASH CONFIGURATION WORD 1 (see PIC24 Family Reference Manual 24.1)
+#pragma config ICS = PGx1 // Comm Channel Select (Emulator EMUC1/EMUD1 pins are shared with PGC1/PGD1)
+#pragma config FWDTEN = OFF // Watchdog Timer Enable (Watchdog Timer is disabled)
+#pragma config GWRP = OFF // General Code Segment Write Protect (Writes to program memory are allowed)
+#pragma config GCP = OFF // General Code Segment Code Protect (Code protection is disabled)
+#pragma config JTAGEN = OFF // JTAG Port Enable (JTAG port is disabled)
+
+
+// CW2: FLASH CONFIGURATION WORD 2 (see PIC24 Family Reference Manual 24.1)
+#pragma config I2C1SEL = PRI // I2C1 Pin Location Select (Use default SCL1/SDA1 pins)
+#pragma config IOL1WAY = OFF // IOLOCK Protection (IOLOCK may be changed via unlocking seq)
+#pragma config OSCIOFNC = ON // Primary Oscillator I/O Function (CLKO/RC15 functions as I/O pin)
+#pragma config FCKSM = CSECME // Clock Switching and Monitor (Clock switching is enabled,
+// Fail-Safe Clock Monitor is enabled)
+#pragma config FNOSC = FRCPLL // Oscillator Select (Fast RC Oscillator with PLL module (FRCPLL))
+
+#define NOKEY 255
+
+void delay(long d) {
+ for (d=d; d > 0; d--) {
+ asm("nop");
+ }
+}
+
+
+
+//============================================================================//
+
+int main(void) {
+ init7seg();
+ initKeyPad();
+ char key='N';
+ char right, left;
+ int debounce=250;
+ //RB<9:2> will drive the cathodes of the seven-segment display
+ //RB<11:10> will drive the right and left anodes respectively
+ //RA<3:0> will drive inputs of keypad
+ //RB<15:12> will cycle to sense RA inputs
+ while(1)
+ {
+ if (debounce==0)
+ {
+ key=cycle();
+ if (key!='N')
+ {
+ left=right;
+ right=key;
+ }
+ debounce=250;
+ }
+ showChar7seg(right,0);
+ delay(500);
+ showChar7seg(left,1);
+ delay(200);
+ debounce--;
+ while (!IFS0bits.T1IF) ;
+ IFS0bits.T1IF = 0;
+ }
} \ No newline at end of file
diff --git a/Lab3.X/lab3_main_c.c b/Lab3.X/lab3_main_c.BAK
index bf99269..513bd8f 100644
--- a/Lab3.X/lab3_main_c.c
+++ b/Lab3.X/lab3_main_c.BAK
@@ -1,59 +1,59 @@
-#include "xc.h"
-#include "display.h"
-#include "numpad.h"
-// CW1: FLASH CONFIGURATION WORD 1 (see PIC24 Family Reference Manual 24.1)
-#pragma config ICS = PGx1 // Comm Channel Select (Emulator EMUC1/EMUD1 pins are shared with PGC1/PGD1)
-#pragma config FWDTEN = OFF // Watchdog Timer Enable (Watchdog Timer is disabled)
-#pragma config GWRP = OFF // General Code Segment Write Protect (Writes to program memory are allowed)
-#pragma config GCP = OFF // General Code Segment Code Protect (Code protection is disabled)
-#pragma config JTAGEN = OFF // JTAG Port Enable (JTAG port is disabled)
-
-
-// CW2: FLASH CONFIGURATION WORD 2 (see PIC24 Family Reference Manual 24.1)
-#pragma config I2C1SEL = PRI // I2C1 Pin Location Select (Use default SCL1/SDA1 pins)
-#pragma config IOL1WAY = OFF // IOLOCK Protection (IOLOCK may be changed via unlocking seq)
-#pragma config OSCIOFNC = ON // Primary Oscillator I/O Function (CLKO/RC15 functions as I/O pin)
-#pragma config FCKSM = CSECME // Clock Switching and Monitor (Clock switching is enabled,
-// Fail-Safe Clock Monitor is enabled)
-#pragma config FNOSC = FRCPLL // Oscillator Select (Fast RC Oscillator with PLL module (FRCPLL))
-
-void delay(long n) {
- for (n = n; n > 0; n--) {
- asm("nop");
- }
-}
-
-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();
-}
-
-int main(void) {
- setup();
- char right, left, temp;
- unsigned long debounce = 0;
- while (1) {
- if (debounce % 300 == 0)
- temp = readKeyPadRAW();
- else
- temp = '\0';
- if (temp != '\0') {
- left = right;
- right = temp;
- }
- showChar7seg(right, MSB);
- delay(200);
- showChar7seg(left, LSB);
- delay(200);
- debounce++;
- }
-}
-
-
+#include "xc.h"
+#include "display.h"
+#include "numpad.h"
+// CW1: FLASH CONFIGURATION WORD 1 (see PIC24 Family Reference Manual 24.1)
+#pragma config ICS = PGx1 // Comm Channel Select (Emulator EMUC1/EMUD1 pins are shared with PGC1/PGD1)
+#pragma config FWDTEN = OFF // Watchdog Timer Enable (Watchdog Timer is disabled)
+#pragma config GWRP = OFF // General Code Segment Write Protect (Writes to program memory are allowed)
+#pragma config GCP = OFF // General Code Segment Code Protect (Code protection is disabled)
+#pragma config JTAGEN = OFF // JTAG Port Enable (JTAG port is disabled)
+
+
+// CW2: FLASH CONFIGURATION WORD 2 (see PIC24 Family Reference Manual 24.1)
+#pragma config I2C1SEL = PRI // I2C1 Pin Location Select (Use default SCL1/SDA1 pins)
+#pragma config IOL1WAY = OFF // IOLOCK Protection (IOLOCK may be changed via unlocking seq)
+#pragma config OSCIOFNC = ON // Primary Oscillator I/O Function (CLKO/RC15 functions as I/O pin)
+#pragma config FCKSM = CSECME // Clock Switching and Monitor (Clock switching is enabled,
+// Fail-Safe Clock Monitor is enabled)
+#pragma config FNOSC = FRCPLL // Oscillator Select (Fast RC Oscillator with PLL module (FRCPLL))
+
+void delay(long n) {
+ for (n = n; n > 0; n--) {
+ asm("nop");
+ }
+}
+
+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();
+}
+
+int main(void) {
+ setup();
+ char right, left, temp;
+ unsigned long debounce = 0;
+ while (1) {
+ if (debounce % 300 == 0)
+ temp = readKeyPadRAW();
+ else
+ temp = '\0';
+ if (temp != '\0') {
+ left = right;
+ right = temp;
+ }
+ showChar7seg(right, MSB);
+ delay(200);
+ showChar7seg(left, LSB);
+ delay(200);
+ debounce++;
+ }
+}
+
+
diff --git a/Lab3.X/nbproject/Makefile-default.mk b/Lab3.X/nbproject/Makefile-default.mk
index 7c32e70..5e07efe 100644
--- a/Lab3.X/nbproject/Makefile-default.mk
+++ b/Lab3.X/nbproject/Makefile-default.mk
@@ -99,21 +99,21 @@ ${OBJECTDIR}/display.o: display.c nbproject/Makefile-${CND_CONF}.mk
@${MKDIR} "${OBJECTDIR}"
@${RM} ${OBJECTDIR}/display.o.d
@${RM} ${OBJECTDIR}/display.o
- ${MP_CC} $(MP_EXTRA_CC_PRE) display.c -o ${OBJECTDIR}/display.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/display.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_SIMULATOR=1 -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16
+ ${MP_CC} $(MP_EXTRA_CC_PRE) display.c -o ${OBJECTDIR}/display.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/display.o.d" -g -D__DEBUG -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16
@${FIXDEPS} "${OBJECTDIR}/display.o.d" $(SILENT) -rsi ${MP_CC_DIR}../
${OBJECTDIR}/numpad.o: numpad.c nbproject/Makefile-${CND_CONF}.mk
@${MKDIR} "${OBJECTDIR}"
@${RM} ${OBJECTDIR}/numpad.o.d
@${RM} ${OBJECTDIR}/numpad.o
- ${MP_CC} $(MP_EXTRA_CC_PRE) numpad.c -o ${OBJECTDIR}/numpad.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/numpad.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_SIMULATOR=1 -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16
+ ${MP_CC} $(MP_EXTRA_CC_PRE) numpad.c -o ${OBJECTDIR}/numpad.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/numpad.o.d" -g -D__DEBUG -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16
@${FIXDEPS} "${OBJECTDIR}/numpad.o.d" $(SILENT) -rsi ${MP_CC_DIR}../
${OBJECTDIR}/lab3_main_MAYA_C.o: lab3_main_MAYA_C.c nbproject/Makefile-${CND_CONF}.mk
@${MKDIR} "${OBJECTDIR}"
@${RM} ${OBJECTDIR}/lab3_main_MAYA_C.o.d
@${RM} ${OBJECTDIR}/lab3_main_MAYA_C.o
- ${MP_CC} $(MP_EXTRA_CC_PRE) lab3_main_MAYA_C.c -o ${OBJECTDIR}/lab3_main_MAYA_C.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/lab3_main_MAYA_C.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_SIMULATOR=1 -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16
+ ${MP_CC} $(MP_EXTRA_CC_PRE) lab3_main_MAYA_C.c -o ${OBJECTDIR}/lab3_main_MAYA_C.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/lab3_main_MAYA_C.o.d" -g -D__DEBUG -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -msmart-io=1 -Wall -msfr-warn=off -mdfp=${DFP_DIR}/xc16
@${FIXDEPS} "${OBJECTDIR}/lab3_main_MAYA_C.o.d" $(SILENT) -rsi ${MP_CC_DIR}../
else
@@ -157,7 +157,7 @@ endif
ifeq ($(TYPE_IMAGE), DEBUG_RUN)
dist/${CND_CONF}/${IMAGE_TYPE}/Lab3.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX}: ${OBJECTFILES} nbproject/Makefile-${CND_CONF}.mk
@${MKDIR} dist/${CND_CONF}/${IMAGE_TYPE}
- ${MP_CC} $(MP_EXTRA_LD_PRE) -o dist/${CND_CONF}/${IMAGE_TYPE}/Lab3.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX} ${OBJECTFILES_QUOTED_IF_SPACED} -mcpu=$(MP_PROCESSOR_OPTION) -D__DEBUG=__DEBUG -D__MPLAB_DEBUGGER_SIMULATOR=1 -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -Wl,,,--defsym=__MPLAB_BUILD=1,--defsym=__MPLAB_DEBUG=1,--defsym=__DEBUG=1,-D__DEBUG=__DEBUG,--defsym=__MPLAB_DEBUGGER_SIMULATOR=1,$(MP_LINKER_FILE_OPTION),--stack=16,--check-sections,--data-init,--pack-data,--handles,--isr,--no-gc-sections,--fill-upper=0,--stackguard=16,--no-force-link,--smart-io,-Map="${DISTDIR}/${PROJECTNAME}.${IMAGE_TYPE}.map",--report-mem,--memorysummary,dist/${CND_CONF}/${IMAGE_TYPE}/memoryfile.xml$(MP_EXTRA_LD_POST) -mdfp=${DFP_DIR}/xc16
+ ${MP_CC} $(MP_EXTRA_LD_PRE) -o dist/${CND_CONF}/${IMAGE_TYPE}/Lab3.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX} ${OBJECTFILES_QUOTED_IF_SPACED} -mcpu=$(MP_PROCESSOR_OPTION) -D__DEBUG=__DEBUG -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -Wl,,,--defsym=__MPLAB_BUILD=1,--defsym=__MPLAB_DEBUG=1,--defsym=__DEBUG=1,-D__DEBUG=__DEBUG,,$(MP_LINKER_FILE_OPTION),--stack=16,--check-sections,--data-init,--pack-data,--handles,--isr,--no-gc-sections,--fill-upper=0,--stackguard=16,--no-force-link,--smart-io,-Map="${DISTDIR}/${PROJECTNAME}.${IMAGE_TYPE}.map",--report-mem,--memorysummary,dist/${CND_CONF}/${IMAGE_TYPE}/memoryfile.xml$(MP_EXTRA_LD_POST) -mdfp=${DFP_DIR}/xc16
else
dist/${CND_CONF}/${IMAGE_TYPE}/Lab3.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX}: ${OBJECTFILES} nbproject/Makefile-${CND_CONF}.mk
diff --git a/Lab3.X/nbproject/Makefile-genesis.properties b/Lab3.X/nbproject/Makefile-genesis.properties
index babf995..15e41fa 100644
--- a/Lab3.X/nbproject/Makefile-genesis.properties
+++ b/Lab3.X/nbproject/Makefile-genesis.properties
@@ -1,10 +1,10 @@
#
-#Fri Feb 28 11:09:32 CST 2020
-default.Pack.dfplocation=C\:\\Program Files (x86)\\Microchip\\MPLABX\\v5.30\\packs\\Microchip\\PIC24F-GA-GB_DFP\\1.1.74
-default.com-microchip-mplab-nbide-toolchainXC16-XC16LanguageToolchain.md5=3de759bc6af06f5ee7453ec146192402
-default.languagetoolchain.dir=C\:\\Program Files (x86)\\Microchip\\xc16\\v1.41\\bin
-configurations-xml=a484db181b70bf7bdb9ff81073d3f011
-com-microchip-mplab-nbide-embedded-makeproject-MakeProject.md5=7cd2eead2ea6964989cbf02efe721a76
-default.languagetoolchain.version=1.41
+#Tue Mar 03 07:32:39 CST 2020
+default.Pack.dfplocation=C\:\\Program Files (x86)\\Microchip\\MPLABX\\v5.35\\packs\\Microchip\\PIC24F-GA-GB_DFP\\1.2.101
+default.com-microchip-mplab-nbide-toolchainXC16-XC16LanguageToolchain.md5=859fc649e7017fd01769e2187e1537a7
+default.languagetoolchain.dir=C\:\\Program Files\\Microchip\\xc16\\v1.50\\bin
+configurations-xml=2b078e482191bd07283c6043c6ed5e8a
+com-microchip-mplab-nbide-embedded-makeproject-MakeProject.md5=5db0f4d6bbe0ec2a1f1096ccfb9d7ad3
+default.languagetoolchain.version=1.50
host.platform=windows
conf.ids=default
diff --git a/Lab3.X/nbproject/Makefile-local-default.mk b/Lab3.X/nbproject/Makefile-local-default.mk
index 214e7fa..c75d9df 100644
--- a/Lab3.X/nbproject/Makefile-local-default.mk
+++ b/Lab3.X/nbproject/Makefile-local-default.mk
@@ -15,24 +15,24 @@
# $ makeMP_CC="/opt/microchip/mplabc30/v3.30c/bin/pic30-gcc" ...
#
SHELL=cmd.exe
-PATH_TO_IDE_BIN=C:/Program Files (x86)/Microchip/MPLABX/v5.30/mplab_platform/platform/../mplab_ide/modules/../../bin/
+PATH_TO_IDE_BIN=C:/Program Files (x86)/Microchip/MPLABX/v5.35/mplab_platform/platform/../mplab_ide/modules/../../bin/
# Adding MPLAB X bin directory to path.
-PATH:=C:/Program Files (x86)/Microchip/MPLABX/v5.30/mplab_platform/platform/../mplab_ide/modules/../../bin/:$(PATH)
+PATH:=C:/Program Files (x86)/Microchip/MPLABX/v5.35/mplab_platform/platform/../mplab_ide/modules/../../bin/:$(PATH)
# Path to java used to run MPLAB X when this makefile was created
-MP_JAVA_PATH="C:\Program Files (x86)\Microchip\MPLABX\v5.30\sys\java\jre1.8.0_181/bin/"
+MP_JAVA_PATH="C:\Program Files (x86)\Microchip\MPLABX\v5.35\sys\java\jre1.8.0_181/bin/"
OS_CURRENT="$(shell uname -s)"
-MP_CC="C:\Program Files (x86)\Microchip\xc16\v1.41\bin\xc16-gcc.exe"
+MP_CC="C:\Program Files\Microchip\xc16\v1.50\bin\xc16-gcc.exe"
# MP_CPPC is not defined
# MP_BC is not defined
-MP_AS="C:\Program Files (x86)\Microchip\xc16\v1.41\bin\xc16-as.exe"
-MP_LD="C:\Program Files (x86)\Microchip\xc16\v1.41\bin\xc16-ld.exe"
-MP_AR="C:\Program Files (x86)\Microchip\xc16\v1.41\bin\xc16-ar.exe"
-DEP_GEN=${MP_JAVA_PATH}java -jar "C:/Program Files (x86)/Microchip/MPLABX/v5.30/mplab_platform/platform/../mplab_ide/modules/../../bin/extractobjectdependencies.jar"
-MP_CC_DIR="C:\Program Files (x86)\Microchip\xc16\v1.41\bin"
+MP_AS="C:\Program Files\Microchip\xc16\v1.50\bin\xc16-as.exe"
+MP_LD="C:\Program Files\Microchip\xc16\v1.50\bin\xc16-ld.exe"
+MP_AR="C:\Program Files\Microchip\xc16\v1.50\bin\xc16-ar.exe"
+DEP_GEN=${MP_JAVA_PATH}java -jar "C:/Program Files (x86)/Microchip/MPLABX/v5.35/mplab_platform/platform/../mplab_ide/modules/../../bin/extractobjectdependencies.jar"
+MP_CC_DIR="C:\Program Files\Microchip\xc16\v1.50\bin"
# MP_CPPC_DIR is not defined
# MP_BC_DIR is not defined
-MP_AS_DIR="C:\Program Files (x86)\Microchip\xc16\v1.41\bin"
-MP_LD_DIR="C:\Program Files (x86)\Microchip\xc16\v1.41\bin"
-MP_AR_DIR="C:\Program Files (x86)\Microchip\xc16\v1.41\bin"
+MP_AS_DIR="C:\Program Files\Microchip\xc16\v1.50\bin"
+MP_LD_DIR="C:\Program Files\Microchip\xc16\v1.50\bin"
+MP_AR_DIR="C:\Program Files\Microchip\xc16\v1.50\bin"
# MP_BC_DIR is not defined
-DFP_DIR="C:/Program Files (x86)/Microchip/MPLABX/v5.30/packs/Microchip/PIC24F-GA-GB_DFP/1.1.74"
+DFP_DIR="C:/Program Files (x86)/Microchip/MPLABX/v5.35/packs/Microchip/PIC24F-GA-GB_DFP/1.2.101"
diff --git a/Lab3.X/nbproject/configurations.xml b/Lab3.X/nbproject/configurations.xml
index fa82250..8048554 100644
--- a/Lab3.X/nbproject/configurations.xml
+++ b/Lab3.X/nbproject/configurations.xml
@@ -14,7 +14,6 @@
<logicalFolder name="SourceFiles"
displayName="Source Files"
projectFiles="true">
- <itemPath>lab3_main_c.c</itemPath>
<itemPath>display.c</itemPath>
<itemPath>numpad.c</itemPath>
<itemPath>lab3_main_MAYA_C.c</itemPath>
@@ -36,13 +35,13 @@
<targetDevice>PIC24FJ64GA002</targetDevice>
<targetHeader></targetHeader>
<targetPluginBoard></targetPluginBoard>
- <platformTool>Simulator</platformTool>
+ <platformTool>noID</platformTool>
<languageToolchain>XC16</languageToolchain>
- <languageToolchainVersion>1.41</languageToolchainVersion>
+ <languageToolchainVersion>1.50</languageToolchainVersion>
<platform>3</platform>
</toolsSet>
<packs>
- <pack name="PIC24F-GA-GB_DFP" vendor="Microchip" version="1.1.74"/>
+ <pack name="PIC24F-GA-GB_DFP" vendor="Microchip" version="1.2.101"/>
</packs>
<compileType>
<linkerTool>
@@ -187,6 +186,7 @@
<property key="legacy-libc" value="true"/>
<property key="mpreserve-all" value="false"/>
<property key="oXC16glb-macros" value=""/>
+ <property key="omit-pack-options" value="1"/>
<property key="output-file-format" value="elf"/>
<property key="preserve-all" value="false"/>
<property key="preserve-file" value=""/>
@@ -647,8 +647,6 @@
value=""/>
<property key="warningmessagebreakoptions.warningmessages" value="holdstate"/>
</Simulator>
- <item path="lab3_main_c.c" ex="true" overriding="false">
- </item>
</conf>
</confs>
</configurationDescriptor>
diff --git a/Lab3.X/nbproject/private/configurations.xml b/Lab3.X/nbproject/private/configurations.xml
index 74e2a26..0e3b9d3 100644
--- a/Lab3.X/nbproject/private/configurations.xml
+++ b/Lab3.X/nbproject/private/configurations.xml
@@ -4,8 +4,8 @@
<defaultConf>0</defaultConf>
<confs>
<conf name="default" type="2">
- <platformToolSN></platformToolSN>
- <languageToolchainDir>C:\Program Files (x86)\Microchip\xc16\v1.41\bin</languageToolchainDir>
+ <platformToolSN>noToolString</platformToolSN>
+ <languageToolchainDir>C:\Program Files\Microchip\xc16\v1.50\bin</languageToolchainDir>
<mdbdebugger version="1">
<placeholder1>place holder 1</placeholder1>
<placeholder2>place holder 2</placeholder2>
diff --git a/Lab3.X/nbproject/private/private.xml b/Lab3.X/nbproject/private/private.xml
index d82f0d3..284eeec 100644
--- a/Lab3.X/nbproject/private/private.xml
+++ b/Lab3.X/nbproject/private/private.xml
@@ -2,12 +2,6 @@
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
- <group>
- <file>file:/C:/Users/MSatt/MPLABXProjects/EE2361Projects/Lab3.X/numpad.h</file>
- <file>file:/C:/Users/MSatt/MPLABXProjects/EE2361Projects/Lab3.X/lab3_main_c.c</file>
- <file>file:/C:/Users/MSatt/MPLABXProjects/EE2361Projects/Lab3.X/display.c</file>
- <file>file:/C:/Users/MSatt/MPLABXProjects/EE2361Projects/Lab3.X/numpad.c</file>
- <file>file:/C:/Users/MSatt/MPLABXProjects/EE2361Projects/Lab3.X/display.h</file>
- </group>
+ <group/>
</open-files>
</project-private>
diff --git a/Lab3.X/nbproject/project.xml b/Lab3.X/nbproject/project.xml
index 8f58032..2bc22c2 100644
--- a/Lab3.X/nbproject/project.xml
+++ b/Lab3.X/nbproject/project.xml
@@ -4,7 +4,7 @@
<configuration>
<data xmlns="http://www.netbeans.org/ns/make-project/1">
<name>Lab3</name>
- <creation-uuid>87ceaaaa-2d11-4659-ab7c-7b12fe00629e</creation-uuid>
+ <creation-uuid>f5ffe4b4-9434-45bc-b3dd-3537d7df4a93</creation-uuid>
<make-project-type>0</make-project-type>
<c-extensions>c</c-extensions>
<cpp-extensions/>
diff --git a/Lab3.X/numpad.c b/Lab3.X/numpad.c
index 5d9f0ce..825d476 100644
--- a/Lab3.X/numpad.c
+++ b/Lab3.X/numpad.c
@@ -1,5 +1,5 @@
#include "xc.h"
-
+#include "numpad.h"
void initKeyPad(void) {
AD1PCFG = 0x9fff; //sets all pins to digital I/O
TRISA = 0b0000000000011111; //set port A to inputs,
@@ -10,11 +10,11 @@ void initKeyPad(void) {
CNPU1bits.CN3PUE = 1; //RA1
CNPU2bits.CN30PUE = 1; //RA2
CNPU2bits.CN29PUE = 1; //RA3
-// T1CON = 0;
-// PR1 = 15999;
-// TMR1 = 0;
-// IFS0bits.T1IF = 0;
-// T1CONbits.TON = 1;
+ T1CON = 0;
+ PR1 = 15999;
+ TMR1 = 0;
+ IFS0bits.T1IF = 0;
+ T1CONbits.TON = 1;
}
void padDelay(long n) {
@@ -24,6 +24,39 @@ void padDelay(long n) {
}
// 1 2 3 4 5 6 7 8
// RA0 RA1 RA2 RA3 RB15 RB14 RB13 RB12
+char cycle() {
+ int i = 0;
+ char key = 'N';
+ while (i < 4) {
+ if (i == 0) {
+ LATBbits.LATB12 = 0;
+ LATBbits.LATB13 = 1;
+ LATBbits.LATB14 = 1;
+ LATBbits.LATB15 = 1;
+ } else if (i == 1) {
+ LATBbits.LATB12 = 1;
+ LATBbits.LATB13 = 0;
+ LATBbits.LATB14 = 1;
+ LATBbits.LATB15 = 1;
+ } else if (i == 2) {
+ LATBbits.LATB12 = 1;
+ LATBbits.LATB13 = 1;
+ LATBbits.LATB14 = 0;
+ LATBbits.LATB15 = 1;
+ } else if (i == 3) {
+ LATBbits.LATB12 = 1;
+ LATBbits.LATB13 = 1;
+ LATBbits.LATB14 = 1;
+ LATBbits.LATB15 = 0;
+ }
+ key = readKeyPadRAW();
+ if (key != 'N') {
+ return key;
+ }
+ i++;
+ }
+ return key;
+}
char readKeyPadRAW(void) {
if ((PORTAbits.RA0 || LATBbits.LATB12) == 0) {
diff --git a/Lab3.X/numpad.h b/Lab3.X/numpad.h
index 057ee69..fe3f724 100644
--- a/Lab3.X/numpad.h
+++ b/Lab3.X/numpad.h
@@ -10,6 +10,7 @@ extern "C" {
// Insert declarations
void initKeyPad(void);
char readKeyPadRAW(void);
+ char cycle();
#ifdef __cplusplus
}