-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.c
More file actions
47 lines (38 loc) · 1.32 KB
/
main.c
File metadata and controls
47 lines (38 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*
* File: main.c
* Author: Ahad Ali, Mushtaba Al Yasseen, and Parbir Lehal
* Created on October 12, 2021, 3:26 PM
*/
//Include the compiler structures
#include "xc.h" // Include the necessary package to run the MPLAB Simulator
#include "IOs.h"
#include "TimeDelay.h"
#include "config.h"
#include "UART2.h"
/*
* Main
* Inputs: Nothing
* Return: Nothing
*
*/
int main(void) {
// Clock output on REFO/RB15 - Testing purposes only
TRISBbits.TRISB15 = 0; // Set RB15 as output for REFO
REFOCONbits.ROEN = 0; // Ref oscillator is enabled
//REFOCONbits.ROEN = 1; //in earlier video
REFOCONbits.ROSSLP = 0; // REf oscillator is disabled in sleep
REFOCONbits.ROSEL = 0; // Output base clk showing clock switching
REFOCONbits.RODIV = 0b1111;
REFOCONbits.ROEN = 1; // Ref oscillator is enabled
// Initialize IOs for low-power wake-up
AD1PCFG = 0xFFFF; // Turn all analog pins as digital
IOinit(); // enables IO and CN interrupsts on Push buttons
ADCinit();
//IOinit(); //Calls function in IOs.c to intilize input/output pins
NewClk(8);
while (1) {
// IOcheck(); // Calls function in IOs.c to check IO and turn on coressponding LED
DispADC(); // Displays ADCBUF0 - from lecture
}
return 0;
}