forked from KentuckySolarCar/Drivetek_MPPT
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUSER23.INC
More file actions
141 lines (118 loc) · 6.43 KB
/
USER23.INC
File metadata and controls
141 lines (118 loc) · 6.43 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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
;**********************************************************************
; P R O G R A M M MPPTnG *
; *
; Traking program for MPPT new generation *
;**********************************************************************
; *
; Filename: user.inc *
; Date: 20.04.01 *
; Last Update: 14.03.05 *
; File Version: V3.0 *
; *
; Author: Michael Zürcher, Christoph Raible *
; *
; Company: HTA-Biel/Bienne Indulab, drivetek ag *
; *
; Changes: *
; *
;**********************************************************************
; *
; Notes: *
; - Main program : mpptng.asm *
; - Client : 23 *
; *
; Order Number: 23 *
; *
;**********************************************************************
;--------------------------
;John Broadbent University Of Kentucky Solar Car Team (UKSC)
;We downloaded this code from UC Berkly (CalSol), with the goal of useing this to change the operating point for our trackers.
;The p16f877 has serveral 10 bit adc's, and the MPPT send can messages with a 10 bit voltage.
;The target operating points are below
;Minimum Input Voltage [V] 37.79
;Maximum Input Voltage [V] 69.37
;Nominal Battery Voltage [V] 132
;Minimum Output Voltage [V] 90
;Maximum Output Voltage [V] 148
;Maximum Input MPP Current [A] 5.79
;Maximum Input Short Circuit Current [A] 6.22
;
; and the volts to count (for the version 4 from the PDF)are
;Input voltage multiplication factor: 150.49 [mV/LSB]
;Output voltage multiplication factor: 208.79 [mV/LSB]
;Input MPP current multiplication factor: 8.72 [mA/LSB]
;-----------------
;**********************************************************************
; maximum battery voltage
;**********************************************************************
#define INITDUTY 0x74 ; Duty resulting of Ubat and Uoc
;CalSol's values are below. Kinda neat, I guess.
;#define MAXUOH 0x02 ; 117.6 V: Max Batt. volt HByte
; in 196.97 mV Units
;#define MAXUOL 0x55 ; 117.6 V: Max Batt. volt LByte in
; 196.97 mV Unit
;UKSC new values (JB)
; (target voltage) / ( mV per Count) = number of counts needed
;( 148 volts / 208.79mV per Count) = 709 Counts = 0x02c4
;#define MAXUOH 0x02
;#define MAXUOL 0xc4
;Eclipse X
; (target voltage) / ( mV per Count) = number of counts needed
;( 135 volts / 208.79mV per Count) = 646 Counts = 0x0286
#define MAXUOH 0x02
#define MAXUOL 0x86
;**********************************************************************
; P&O Constants
;**********************************************************************
;CalSol's values are below. Kinda neat, I guess.
;#define MINUINH 0x00 ; Min input voltage HByte 26V in 150.49 mV Units
;#define MINUINL 0xAD ; Min input voltage LByte 26V; in 150.49 mV Units
;UKSC new values (JB)
;(target Voltage) / (mV per Count) = number of counts needed
;(37.79 votls) / ( 150.49 mV / per count) = 251 = 0x00FB
;#define MINUINH 0x00
;#define MINUINH 0xFB
;Eclipse X
;(target Voltage) / (mV per Count) = number of counts needed
;(26 volts) / ( 150.49 mV / per count) = 173 = 0x0159
#define MINUINH 0x00
#define MINUINL 0xAD
;**********************************************************************
;Min Output Voltage, used for Precharge
;**********************************************************************
;#define MINUBATH 0x01 ; Min output voltage HByte 84 V in 196.97 mV Units
;#define MINUBATL 0xAA ; Min output voltage LByte 84 V in 196.97 mV Units
;UKSC new values (JB)
;(target Voltage) / (mV per Count) = number of counts needed
;(90 volts) / (208.79 mV perCount) = 433 = 0x01b1
;#define MINUBATH 0x01
;#define MINUBATL 0xb1
;Eclipse X
;(target Voltage) / (mV per Count) = number of counts needed
;(80 volts) / (208.79 mV perCount) = 383 = 0x017f
#define MINUBATH 0x01
#define MINUBATL 0x7F
;**********************************************************************
; border ot discontinuous mode
; ON-Values have to be greater than OFF-Values
; notice the hysteresis NOT USED IN HARDWARE V3.0!!!
;**********************************************************************
;#define IHFETONH 0x01 ; H-FET Turn on HByte 32% of max current
;#define IHFETONL 0x47 ; H-FET Turn on LByte 32% of max current
;#define IHFETOFFH 0x01 ; H-FET Turn on HByte 25% of max current
;#define IHFETOFFL 0x00 ; H-FET Turn on LByte 25% of max current
;**********************************************************************
; Minimum Input Power of
;**********************************************************************
#define MINPINM 0x16 ; M-Byte Min input power 5W (5.86 mA/Bit x 150.49 mV/Bit)
#define MINPINL 0x26 ; L-Byte Min input power
;**********************************************************************
; Maximum Power Point Input Voltage (influences tracking step width)
;**********************************************************************
;#define UmppH 0x02 ; Mpp input voltage HByte 86 V in 150.49 mV Units
;#define UmppL 0x3B ; Mpp input voltage LByte 86 V in 150.49 mV Units
;UKSC new values (JB)
;(target Voltage) / (mV per Count) = number of counts needed
;( 52.97 volts) / (150.49 mV perCount) = 461 = 0x01CD
#define UmppH 0x01
#define UmppL 0x60