;; ;; mur.sat ;; ;; Somewhen in the year 20xx, mur.at will have a nano satellite launched ;; into a low earth orbit (310 km above the surface of our planet). The ;; satellite itself is a TubeSat personal satellite kit, developed and ;; launched by interorbital systems. mur.sat is a joint venture of mur.at, ;; ESC im Labor and realraum. ;; ;; Please visit the project hompage at sat.mur.at for further information. ;; ;; ;; Copyright (C) 2011-2015 Christian Pointner ;; ;; This file is part of mur.sat. ;; ;; mur.sat is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; any later version. ;; ;; mur.sat is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; ;; You should have received a copy of the GNU General Public License ;; along with mur.sat. If not, see . ;; ;; ------------------------------------- ;; DEFINES ;; constants sol_calc_power_single clrf SOL_CALC_0 clrf SOL_CALC_1 clrf SOL_CALC_2 movlw .4 movwf SOL_CALC_CNT ;; 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 incf FSR,f decfsz SOL_CALC_CNT,f goto sol_sum_current movf INDF,w movwf SOL_CALC_9 clrf SOL_CALC_3 clrf SOL_CALC_4 clrf SOL_CALC_5 ;; multiply SOL_CALC_0:2 with SOL_CALC_9 -> SOL_CALC_3:5 movlw .8 movwf SOL_CALC_CNT sol_mula_vc btfss SOL_CALC_9,0 goto sol_mula_rotate bcf STATUS,C movf SOL_CALC_0,w addwf SOL_CALC_3,f btfss STATUS,C goto sol_mula_vc1 bcf STATUS,C movlw .1 addwf SOL_CALC_4,f btfsc STATUS,C incf SOL_CALC_5,f sol_mula_vc1 bcf STATUS,C movf SOL_CALC_1,w addwf SOL_CALC_4,f btfsc STATUS,C incf SOL_CALC_5,f movf SOL_CALC_2,w addwf SOL_CALC_5,f sol_mula_rotate rrf SOL_CALC_9,f bcf STATUS,C rlf SOL_CALC_0,f rlf SOL_CALC_1,f rlf SOL_CALC_2,f decfsz SOL_CALC_CNT,f goto sol_mula_vc return ;; ------------------------------------- solar_calc_power ;; calc power of power line 1 movlw ADC_SOLAR_C0 movwf FSR call sol_calc_power_single ;; move SOL_CALC_3:5 -> SOL_CALC_6:8 movf SOL_CALC_3,w movwf SOL_CALC_6 movf SOL_CALC_4,w movwf SOL_CALC_7 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 btfss STATUS,C goto solar_calc_power1 bcf STATUS,C movlw .1 addwf SOL_CALC_7,f btfsc STATUS,C incf SOL_CALC_8,f solar_calc_power1 movf SOL_CALC_4,w addwf SOL_CALC_7,f btfsc STATUS,C incf SOL_CALC_8,f movf SOL_CALC_5,w addwf SOL_CALC_8,f ;; SOL_CALC_6:8 << 1 -> SOL_CALC_6:8 rlf SOL_CALC_6,f rlf SOL_CALC_7,f rlf SOL_CALC_8,f ;; if(SOL_CALC_6 & 0x80) SOL_CALC_7:8+=1 bcf STATUS,C movlw .1 btfsc SOL_CALC_6,7 addwf SOL_CALC_7,f btfsc STATUS,C incf SOL_CALC_8,f ;; SOL_CALC_7 -> SOL_POWERL, SOL_CALC_8 -> SOL_POWERH movf SOL_CALC_7,w movwf SOL_POWERL movf SOL_CALC_8,w movwf SOL_POWERH return ;; -------------------------------------