-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathconstv.asm
More file actions
122 lines (103 loc) · 3.9 KB
/
constv.asm
File metadata and controls
122 lines (103 loc) · 3.9 KB
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
;**********************************************************************
; P R O G R A M M MPPTnG *
; *
; Undervoltage routine *
;**********************************************************************
; *
; Filename: underv.asm *
; Date: 21.09.01 *
; Last Update: 28.09.01 *
; File Version: V3.0 *
; *
; Author: Michael Zuercher *
; *
; Company: HTA-Biel/Bienne Indulab *
; *
; Changes: program part which decreases current *
; *
; *
;**********************************************************************
; *
; Notes: *
; - Main program : mpptngv4.asm *
; *
;**********************************************************************
ConstVMode
call PWMoff
call wait20ms
Wait4Connect1 ;is bat. still connected?
call UpdateCAN
clrwdt ; reset watchdog
call GetFilteredUout ;UOUT<=MAXUOUT+2V
CheckMaxuout1
movlw 0x10 ;add 2V to MAXOUT
movwf Temp4
movlw MAXUOH
movwf Temp5
movlw MAXUOL
addwf Temp4,f
btfsc STATUS,C
incf Temp5
movfw Temp5
movwf Temp1
movf UOFH,w
subwf Temp1,w
btfsc _Z
goto CheckLsb21
btfss _C ;c set if w=MAXUOH-UOFH >=0
goto NoBatConnected
goto ConstVMode2
CheckLsb21
movfw Temp4
movwf Temp1
movfw UOFL
subwf Temp1,W
btfsc _C ;c set if w=MAXUOL-UOFL >=0
goto ConstVMode2
NoBatConnected
bsf REDLED
bsf NOC
bcf BVLR
call PWMoff
DeCharge1
call wait20ms ; wait for capacitor to be discharged
call UpdateCAN
call GetFilteredUin
jmpFltL UIF0H,MINUINH,CV_UVState3 ; jmp, if minimal voltage not reached
jmpFgtL UIF0H,MINUINH,CV_MeasUout3 ; go on, if minimal reached
jmpFleL UIF0L,MINUINL,CV_UVState3 ; consider L-Byte
goto CV_MeasUout3
CV_UVState3 call UnderVoltage
CV_MeasUout3
call GetFilteredUout
jmpFltL UOFH,MAXUOH,ClearNOC ; jmp, if minimal voltage not reached
jmpFgtL UOFH,MAXUOH,DeCharge1 ; go on, if minimal reached
jmpFleL UOFL,MAXUOL,ClearNOC ; consider L-Byte
goto DeCharge1
ClearNOC
bcf NOC
bcf REDLED
;------------------------------------------------------------------------
ConstVMode2
bsf BVLR
bsf REDLED
call DecDuty ; decrement duty cycle
call PWMon
call wait20ms ; to obtain an approximate tracking frequency of 50Hz
call UpdateCAN
call GetFilteredUin
jmpFltL UIF0H,MINUINH,CV_UVState ; jmp, if minimal voltage not reached
jmpFgtL UIF0H,MINUINH,CV_MeasUout ; go on, if minimal reached
jmpFleL UIF0L,MINUINL,CV_UVState ; consider L-Byte
goto CV_MeasUout
CV_UVState call UnderVoltage
call UpdateCAN
CV_MeasUout call GetFilteredUout ; test if battery reached full level
call UpdateCAN
jmpFltL UOFH,MAXUOH,MPPTtracking ; jmp, if output voltage within limits
jmpFgtL UOFH,MAXUOH,CheckBatCon ; go on, if ouput voltage exceeded
jmpFleL UOFL,MAXUOL,MPPTtracking ; consider L-Byte
goto Wait4Connect1
CheckBatCon
goto Wait4Connect1
;**********************************************************************