aboutsummaryrefslogtreecommitdiffstats
path: root/Lab3.X/lab3_main_c.c
diff options
context:
space:
mode:
authorRossTheRoss <msattr@gmail.com>2020-02-23 19:38:25 -0600
committerRossTheRoss <msattr@gmail.com>2020-02-23 19:38:25 -0600
commit98850dad7260f2dc33e5726222be4decdf098e18 (patch)
tree86e29b92b9225a358a484af3f460ce3c4abf6bad /Lab3.X/lab3_main_c.c
parentAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA (diff)
downloadee2361-98850dad7260f2dc33e5726222be4decdf098e18.tar
ee2361-98850dad7260f2dc33e5726222be4decdf098e18.tar.gz
ee2361-98850dad7260f2dc33e5726222be4decdf098e18.tar.bz2
ee2361-98850dad7260f2dc33e5726222be4decdf098e18.tar.lz
ee2361-98850dad7260f2dc33e5726222be4decdf098e18.tar.xz
ee2361-98850dad7260f2dc33e5726222be4decdf098e18.tar.zst
ee2361-98850dad7260f2dc33e5726222be4decdf098e18.zip
I hate this (Lab 3 partially working again)
Diffstat (limited to '')
-rw-r--r--Lab3.X/lab3_main_c.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/Lab3.X/lab3_main_c.c b/Lab3.X/lab3_main_c.c
index 1ead16d..406f657 100644
--- a/Lab3.X/lab3_main_c.c
+++ b/Lab3.X/lab3_main_c.c
@@ -17,6 +17,11 @@
// 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
@@ -27,11 +32,17 @@ void setup(void) {
int main(void) {
setup();
+ char right, left, temp;
while (1) {
- showChar7seg('1', LSB);
- delay(170);
- showChar7seg('0', MSB);
- delay(170);
+ temp = readKeyPadRAW();
+ if (temp != '\0') {
+ left = right;
+ right = temp;
+ }
+ showChar7seg(right, LSB);
+ delay(200);
+ showChar7seg(left, MSB);
+ delay(200);
}
}