-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2_out_of_5_code.ewp
More file actions
54 lines (33 loc) · 972 Bytes
/
2_out_of_5_code.ewp
File metadata and controls
54 lines (33 loc) · 972 Bytes
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
#include "msp430.h" ; #define controlled include file
ORG 0X3010
DW 0X2010
NAME main ; module name
PUBLIC main ; make the main label vissible
; outside this module
ORG 0FFFEh
DC16 init ; set reset vector to 'init' label
RSEG CSTACK ; pre-declaration of segment
RSEG CODE ; place program in 'CODE' segment
init: MOV #SFE(CSTACK), SP ; set up stack
main: NOP ; main program
MOV.W #WDTPW+WDTHOLD,&WDTCTL ; Stop watchdog timer
CLR.W R5
CLR.W R8
CLR.W R6
CLR.W R7
MOV.B 0X3010(R5),R6
BIT.B #0X0E0,R6
JNZ DOWN
MOV.B #0X05,R7
UP: RRC.B R6
JNC DOWN2
INC R8
DOWN2: DEC R7
JNZ UP
CMP #0X02,R8
JNE DOWN
MOV.W #0X0AAAA,0X3020(R5)
JMP OVER
DOWN: MOV.W #0XFFFFF,0X3020(R5)
OVER: JMP $
END