-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.s43
53 lines (48 loc) · 2.36 KB
/
main.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
#include "bsp.h"
NAME main
PUBLIC state,main,counter,VoltDigitCounter,State2Counter,Task3state
EXTERN SysConfig,poll_delay,LCDCursorTo17
EXTERN PBs_ISR,ADC_ISR,CalcAvg,FreqOut
EXTERN FindExtremas,LCDPrintChar,LCDClear,LCDCursorOn
//==============================================================================
ORG 0x200
state DW 0
VoltDigitCounter DW 3
counter DW 1000
State2Counter DW NumberOfSamples ; 2000 Samples
Task3state DW 0
;==============================================================================
RSEG CSTACK
RSEG CODE
;==============================================================================
main MOV #SFE(CSTACK),SP
CALL #SysConfig
;==============================================================================
; FSM Loop
;==============================================================================
State0 CMP #0x00,state
JNZ State1
BIS.W #CPUOFF+GIE,SR
NOP
State1 CMP #1,state
JNZ State2
CALL #FindExtremas
JMP State0
State2 CMP #2,state
JNZ State3
CALL #CalcAvg
JMP State0
State3 CMP #3,state
JNZ State3
CALL #FreqOut
JMP State0
;---------------------------------------------------------------------------------------
COMMON INTVEC ; Interrupt Vectors-Begins a common segment name of INTVEC
;---------------------------------------------------------------------------------------
ORG PORT1_VECTOR ; PORT1 Interrupt Vector
DW PBs_ISR ; interrupt handler = ISR
ORG ADC_VECTOR ; ADC Interrupt Vector
DW ADC_ISR
ORG RESET_VECTOR ; MSP430 RESET Vector
DW main
END