summaryrefslogtreecommitdiff
path: root/software/ihu
diff options
context:
space:
mode:
Diffstat (limited to 'software/ihu')
-rw-r--r--software/ihu/ihu.asm228
-rw-r--r--software/ihu/solar.inc4
2 files changed, 128 insertions, 104 deletions
diff --git a/software/ihu/ihu.asm b/software/ihu/ihu.asm
index 552c213..6ccc821 100644
--- a/software/ihu/ihu.asm
+++ b/software/ihu/ihu.asm
@@ -197,7 +197,7 @@ int_dtmf
btfsc STATUS,Z
goto int_dtmf_end
-;; DTMF command complete
+ ;; DTMF command complete
movlw .1
movwf TMP
@@ -360,6 +360,9 @@ uart_rx_fe
;; -------------------------------------
include "adc.inc"
+
+ ;; -------------------------------------
+ include "solar.inc"
;; -------------------------------------
;; MAINLOOP
@@ -369,60 +372,77 @@ main
;; --------------------
;; ADC Test
- ;; call adc_get_solar
+ call adc_get_solar
+ call solar_calc_power
- ;; movf ADC_SOLAR_C0,w
- ;; movwf TXREG
- ;; movlw .1
- ;; call wait_ms
+ movlw .255
+ movwf TXREG
+ movlw .1
+ call wait_ms
- ;; movf ADC_SOLAR_C1,w
- ;; movwf TXREG
- ;; movlw .1
- ;; call wait_ms
+ movf ADC_SOLAR_C0,w
+ movwf TXREG
+ movlw .1
+ call wait_ms
- ;; movf ADC_SOLAR_C2,w
- ;; movwf TXREG
- ;; movlw .1
- ;; call wait_ms
+ movf ADC_SOLAR_C1,w
+ movwf TXREG
+ movlw .1
+ call wait_ms
- ;; movf ADC_SOLAR_C3,w
- ;; movwf TXREG
- ;; movlw .1
- ;; call wait_ms
+ movf ADC_SOLAR_C2,w
+ movwf TXREG
+ movlw .1
+ call wait_ms
- ;; movf ADC_SOLAR_C4,w
- ;; movwf TXREG
- ;; movlw .1
- ;; call wait_ms
+ movf ADC_SOLAR_C3,w
+ movwf TXREG
+ movlw .1
+ call wait_ms
- ;; movf ADC_SOLAR_C5,w
- ;; movwf TXREG
- ;; movlw .1
- ;; call wait_ms
+ movf ADC_SOLAR_V0,w
+ movwf TXREG
+ movlw .1
+ call wait_ms
- ;; movf ADC_SOLAR_C6,w
- ;; movwf TXREG
- ;; movlw .1
- ;; call wait_ms
+ movf ADC_SOLAR_C4,w
+ movwf TXREG
+ movlw .1
+ call wait_ms
- ;; movf ADC_SOLAR_C7,w
- ;; movwf TXREG
- ;; movlw .1
- ;; call wait_ms
+ movf ADC_SOLAR_C5,w
+ movwf TXREG
+ movlw .1
+ call wait_ms
- ;; movf ADC_SOLAR_V,w
- ;; movwf TXREG
- ;; movlw .1
- ;; call wait_ms
+ movf ADC_SOLAR_C6,w
+ movwf TXREG
+ movlw .1
+ call wait_ms
- ;; movlw .255
- ;; movwf TXREG
- ;; movlw .11
- ;; call wait_ms
+ movf ADC_SOLAR_C7,w
+ movwf TXREG
+ movlw .1
+ call wait_ms
- ;; clrf TMP
- ;; goto main
+ movf ADC_SOLAR_V1,w
+ movwf TXREG
+ movlw .1
+ call wait_ms
+
+ movf SOL_POWERH,w
+ movwf TXREG
+ movlw .1
+ call wait_ms
+
+ movf SOL_POWERL,w
+ movwf TXREG
+
+ movlw .8
+ call wait_ms
+
+ clrf TMP
+ goto main
;; --------------------
;; DTMF Test program
@@ -489,77 +509,77 @@ main
;; --------------------
;; RTC Test program
- movf TMP,f
- btfsc STATUS,Z
- goto main
+ ;; movf TMP,f
+ ;; btfsc STATUS,Z
+ ;; goto main
- call rtc_get_time
+ ;; call rtc_get_time
- swapf RTC_TOD3,w
- andlw b'00001111'
- call digit
- movwf TXREG
- movlw .1
- call wait_ms
+ ;; swapf RTC_TOD3,w
+ ;; andlw b'00001111'
+ ;; call digit
+ ;; movwf TXREG
+ ;; movlw .1
+ ;; call wait_ms
- movf RTC_TOD3,w
- andlw b'00001111'
- call digit
- movwf TXREG
- movlw .1
- call wait_ms
+ ;; movf RTC_TOD3,w
+ ;; andlw b'00001111'
+ ;; call digit
+ ;; movwf TXREG
+ ;; movlw .1
+ ;; call wait_ms
- swapf RTC_TOD2,w
- andlw b'00001111'
- call digit
- movwf TXREG
- movlw .1
- call wait_ms
+ ;; swapf RTC_TOD2,w
+ ;; andlw b'00001111'
+ ;; call digit
+ ;; movwf TXREG
+ ;; movlw .1
+ ;; call wait_ms
- movf RTC_TOD2,w
- andlw b'00001111'
- call digit
- movwf TXREG
- movlw .1
- call wait_ms
+ ;; movf RTC_TOD2,w
+ ;; andlw b'00001111'
+ ;; call digit
+ ;; movwf TXREG
+ ;; movlw .1
+ ;; call wait_ms
- swapf RTC_TOD1,w
- andlw b'00001111'
- call digit
- movwf TXREG
- movlw .1
- call wait_ms
+ ;; swapf RTC_TOD1,w
+ ;; andlw b'00001111'
+ ;; call digit
+ ;; movwf TXREG
+ ;; movlw .1
+ ;; call wait_ms
- movf RTC_TOD1,w
- andlw b'00001111'
- call digit
- movwf TXREG
- movlw .1
- call wait_ms
+ ;; movf RTC_TOD1,w
+ ;; andlw b'00001111'
+ ;; call digit
+ ;; movwf TXREG
+ ;; movlw .1
+ ;; call wait_ms
- swapf RTC_TOD0,w
- andlw b'00001111'
- call digit
- movwf TXREG
- movlw .1
- call wait_ms
+ ;; swapf RTC_TOD0,w
+ ;; andlw b'00001111'
+ ;; call digit
+ ;; movwf TXREG
+ ;; movlw .1
+ ;; call wait_ms
- movf RTC_TOD0,w
- andlw b'00001111'
- call digit
- movwf TXREG
- movlw .1
- call wait_ms
+ ;; movf RTC_TOD0,w
+ ;; andlw b'00001111'
+ ;; call digit
+ ;; movwf TXREG
+ ;; movlw .1
+ ;; call wait_ms
- movlw '\r'
- movwf TXREG
- movlw .1
- call wait_ms
- movlw '\n'
- movwf TXREG
+ ;; movlw '\r'
+ ;; movwf TXREG
+ ;; movlw .1
+ ;; call wait_ms
+ ;; movlw '\n'
+ ;; movwf TXREG
- clrf TMP
- goto main
+ ;; clrf TMP
+ ;; goto main
;; --------------------
;; Temp Test program
diff --git a/software/ihu/solar.inc b/software/ihu/solar.inc
index c41bcc3..484a538 100644
--- a/software/ihu/solar.inc
+++ b/software/ihu/solar.inc
@@ -40,6 +40,7 @@ sol_calc_power_single
;; sum up all currents -> SOL_CALC_0:2
sol_sum_current
movf INDF,w
+ bcf STATUS,C
addwf SOL_CALC_0,f
btfsc STATUS,C
incf SOL_CALC_1,f
@@ -90,6 +91,7 @@ sol_mula_rotate
;; -------------------------------------
solar_calc_power
+ ;; calc power of power line 1
movlw ADC_SOLAR_C0
movwf FSR
call sol_calc_power_single
@@ -102,11 +104,13 @@ solar_calc_power
movf SOL_CALC_5,w
movwf SOL_CALC_8
+ ;; calc power of power line 2
movlw ADC_SOLAR_C4
movwf FSR
call sol_calc_power_single
;; add SOL_CALC_3:5 to SOL_CALC_6:8 -> SOL_CALC_6:8
+ bcf STATUS,C
movf SOL_CALC_3,w
addwf SOL_CALC_6,f
movlw .1