blob: da7bac84ce7733cc066daf7e93d57d65948316bf (
plain) (
blame)
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
|
/*
* activity6.c
*
* Created on: Sep 25, 2025
* Author: sowgro
*/
#include <stdio.h>
#include "systick.h"
// moved struct to systick.h
void activity6_run() {
systick_t *s = (systick_t *) 0xE000E010;
printf("%lu\r\n", s->CVR);
s->RVR = 8000000;
s->CSR |= 1; // Turn on systick timer
s->CSR |= 1<<2; // Use internal clock
int time = 0;
int count = 0;
for(;;) {
if (s->CSR & (1<<16)) {
count++;
if (count == 10) { // Count to 10 tenths then print next second
printf ("%d\r\n", time);
time++;
count = 0;
}
}
}
}
|