-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtimer_10s.fs
63 lines (48 loc) · 1.49 KB
/
timer_10s.fs
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
\ this example starts a isr every 10s with timer2
$40000000 constant TIM2
TIM2 $0 + constant TIM2_CR1
TIM2 $4 + constant TIM2_CR2
TIM2 $8 + constant TIM2_SMCR
TIM2 $C + constant TIM2_DIER
TIM2 $10 + constant TIM2_SR
TIM2 $14 + constant TIM2_EGR
TIM2 $18 + constant TIM2_CCMR1_Output
TIM2 $18 + constant TIM2_CCMR1_Input
TIM2 $1C + constant TIM2_CCMR2_Output
TIM2 $1C + constant TIM2_CCMR2_Input
TIM2 $20 + constant TIM2_CCER
TIM2 $24 + constant TIM2_CNT
TIM2 $28 + constant TIM2_PSC
TIM2 $2C + constant TIM2_ARR
TIM2 $34 + constant TIM2_CCR1
TIM2 $38 + constant TIM2_CCR2
TIM2 $3C + constant TIM2_CCR3
TIM2 $40 + constant TIM2_CCR4
TIM2 $48 + constant TIM2_DCR
TIM2 $4C + constant TIM2_DMAR
\ 11 constant tim1en
\ tim1en bit RCC-APB2ENR bis! \ enable timer1
0 constant tim2en
tim2en bit RCC-APB1ENR bis! \ enable timer2
0 constant cen
cen bit tim2_cr1 bic! \ disable counting
11519 tim2_PSC h! \ prescaler
62499 tim2_arr h! \ count max
\ 10sek with 72MHz
0 constant uif
: t2isr
CR ." Timer2: "
\ now . \ works only when time is set
uif bit tim2_sr bic! \ reset irq bit
eint
;
['] t2isr irq-tim2 !
\ 25 constant tim1_up
\ tim1_up bit nvic_iser0 bis!
28 constant tim2
tim2 bit nvic_iser0 bis!
0 constant uie
\ 6 constant tie
\ tie bit TIM1_DIER bis!
uie bit TIM2_DIER bis! \ enable update interupt
cen bit tim2_cr1 bis! \ start counting