-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExperiment1.c
More file actions
executable file
·70 lines (59 loc) · 2.43 KB
/
Copy pathExperiment1.c
File metadata and controls
executable file
·70 lines (59 loc) · 2.43 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/******************************************************************************
* Experiment1.C
******************************************************************************
* This program provides a start point to call assembly functions.
* The functions are defined in the source code as extern for easier editing.
* Instead, the programmer may wish to use a header file to define the functions.
* The examples are intended to show how assembly functions are defined and
* and called as well as how parameters are passed and values returned.
******************************************************************************/
/*****************************************************************************
* NAME: Mashroor Rashid
*****************************************************************************/
#include <AT91SAM7SE512.H> /* AT91SAM7SE512 definitions */
#include "AT91SAM7SE-EK.h" /* AT91SAM7SE-EK board definitions */
//#include "Exp1.h"
extern void POWERLED_INIT(void);
extern void USER_LEDS_INIT(void);
extern void SWITCH_INIT(void);
extern void EXT_LEDS_INIT(void);
extern void DELAY_1MS(unsigned int a);
extern void POWERLED_CONTROL(unsigned int a);
extern void LED1_CONTROL(unsigned int a);
extern void LED2_CONTROL(unsigned int a);
extern void COUNTER_FUNCTION(void);
extern void DISPLAY_FUNCTION(unsigned int a);
extern void POWER_LED_LOOP(void);
extern void MOD_INC_DEC_VALUE(void);
extern void MOD_COUNTER(void);
extern void SET_COUNTERS(void);
/*
* Main Program
*/
int main (void) {
// Initialization Area
SWITCH_INIT();
POWERLED_INIT();
USER_LEDS_INIT();
EXT_LEDS_INIT();
SET_COUNTERS();
for (;;) {
//Endless Loop
//POWER_LED_LOOP(); // Commented out for next section fo experiment
//COUNTER_FUNCTION();
MOD_INC_DEC_VALUE();
MOD_COUNTER();
}
}
/*
Lab Questions
-------------------------------------------------------------------------------
7) DIV = 0x05 MUL = 0x0019 MCK = 47.9232 MHz
Calculation: MCK=(18.432*(25+1))/(5*(1/2))
12) executionTime = 1/Freq
20.866ns = 1/47.9232
1ms = (4* delay_value)*29.866ns
Solve for delay_value: 1/(4*20.866e-6) = 11981.2
18) Execution Time at first time at breakpoint: .00481213 sec
Execution Time at second time at breakpoint: 1.00915015 sec
*/