-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.s43
123 lines (95 loc) · 3.61 KB
/
setup.s43
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#include "msp430.h" ; #define controlled include file
MODULE setup
PUBLIC SetupPins, UnlockGPIO, SetupInterruptsS1, SetupInterruptsS2, SetupLCD, SetupTimer, SetupTimerA1
RSEG CSTACK ; pre-declaration of segment
RSEG CODE ; place program in 'CODE' segment
;Objetivo: Setea los pines de los botones
;Precondiciones:
;Postcondiciones:
;Autor: Kenneth J. Rosario
;Fecha: 11/marzo/2021
SetupPins:
bic.b #0xFF, &P1SEL0
bic.b #0xFF, &P1SEL1
bic.b #0xFF, &P9SEL0
bic.b #0xFF, &P9SEL1
mov.b #11111001B,&P1DIR
bis.b #0xFF, &P9DIR
mov.b #00000110B,&P1REN
bis.b #00000110B,&P1OUT
ret
;Objetivo: Desblockea el GPIO y limpia pantalla
;Precondiciones:
;Postcondiciones:
;Autor: Kenneth J. Rosario
;Fecha: 11/marzo/2021
UnlockGPIO:
bic.w #LOCKLPM5, &PM5CTL0
MOV.W #2, &LCDCMEMCTL
ret
;Objetivo: Setup interrupts for s1 button
;Precondiciones:
;Postcondiciones:
;Autor: Kenneth J. Rosario
;Fecha: 11/marzo/2021
SetupInterruptsS1:
bis.b #02h, &P1IE ; Enable interrupt at P1.1
bis.b #02h, &P1IES ; Set interrupt on high-to-low
ret ; transition of P1.1
;Objetivo: Setup interrupts for s2 button
;Precondiciones:
;Postcondiciones:
;Autor: Kenneth J. Rosario
;Fecha: 11/marzo/2021
SetupInterruptsS2:
bis.b #04h, &P1IE ; Enable interrupt at P1.1
bis.b #04h, &P1IES ; Set interrupt on high-to-low
ret ; transition of P1.1
SetupLCD:
mov.w #0xffff, &LCDCPCTL0
mov.w #0xfc3f, &LCDCPCTL1
mov.w #0x0fff, &LCDCPCTL2
mov #0x041e, &LCDCCTL0
mov #0x0208, &LCDCVCTL
mov #0x8000, &LCDCCPCTL
bis #1, &LCDCCTL0
ret
;Objetivo: Setup the timer to operate with a period of 0.2 segs
;Precondiciones:
;Postcondiciones:
;Autor: Gustavo Roman
;Fecha:
SetupTimer:
mov #TASSEL_2+MC_1+ID_3, &TA0CTL ;Set timer according to next table
nop
; Uses SMCLK and up mode
; TASSELx MCx (mode control) IDx (input divider)
; 00 -> TACLK 00 -> Stop 00 -> /1
; 01 -> ACLK 01 -> Up mode (up to TACCR0) 01 -> /2
; 10 -> SMCLK 10 -> Continuous (up to 0FFFFh) 10 -> /4
; 11 -> INCLK 11 -> Up/down (top on TACCR0) 11 -> /8
; period = cycles * divider / SMLCK
; Assuming SMLCK = 1 MHz, divider = 8 and period = 0.2 seg
; cycles = 25000.
mov #25000, &TA0CCR0 ; Set the timer capture compare register 0
ret
;Objetivo: Configura el timer a1 a 0.2s
;Precondiciones: Ninguna
;Postcondiciones: Ninguna
;Autor: Kenneth J. Rosario
;Fecha: 18/abril/2021
SetupTimerA1:
mov #TASSEL_2+MC_1+ID_3, &TA1CTL ;Set timer according to next table
nop
; Uses SMCLK and up mode
; TASSELx MCx (mode control) IDx (input divider)
; 00 -> TACLK 00 -> Stop 00 -> /1
; 01 -> ACLK 01 -> Up mode (up to TACCR0) 01 -> /2
; 10 -> SMCLK 10 -> Continuous (up to 0FFFFh) 10 -> /4
; 11 -> INCLK 11 -> Up/down (top on TACCR0) 11 -> /8
; period = cycles * divider / SMLCK
; Assuming SMLCK = 1 MHz, divider = 8 and period = 0.2 seg
; cycles = 25000.
mov #25000, &TA1CCR0 ; Set the timer capture compare register
ret
END