comparison code_part1/OSTC_code_asm_part1/pled_outputs.asm @ 25:99512945c7a1

1.61 beta rc2
author heinrichsweikamp
date Thu, 13 May 2010 23:24:55 +0200
parents 73014f788032
children 8d7af04e0f85
comparison
equal deleted inserted replaced
22:70ce5847324c 25:99512945c7a1
23 ; known bugs: 23 ; known bugs:
24 ; ToDo: More comments 24 ; ToDo: More comments
25 25
26 PLED_standard_color: 26 PLED_standard_color:
27 GETCUSTOM8 d'35' ; Standard output color 27 GETCUSTOM8 d'35' ; Standard output color
28 tstfsz WREG ; =0?
29 bra PLED_standard_color2
30 movlw color_standard1 ; Reset Color
31 PLED_standard_color2:
28 call PLED_set_color 32 call PLED_set_color
29 return 33 return
30 34
31 PLED_divemask_color: 35 PLED_divemask_color:
32 GETCUSTOM8 d'36' ; Standard output color 36 GETCUSTOM8 d'36' ; Divemask output color
37 tstfsz WREG ; =0?
38 bra PLED_divemask_color2
39 movlw color_divemask ; Reset Color
40 PLED_divemask_color2:
33 call PLED_set_color 41 call PLED_set_color
34 return 42 return
35 43
44 PLED_warnings_color:
45 GETCUSTOM8 d'37' ; Warnings output color
46 tstfsz WREG ; =0?
47 bra PLED_warnings_color2
48 movlw color_warnings ; Reset Color
49 PLED_warnings_color2:
50 call PLED_set_color
51 return
36 52
37 ostc_debug macro debug_temp 53 ostc_debug macro debug_temp
38 movlw debug_temp 54 movlw debug_temp
39 call ostc_debug1 55 call ostc_debug1
40 endm 56 endm
807 return 823 return
808 824
809 btfsc multi_gf_display ; Is the Multi-GF Table displayed? 825 btfsc multi_gf_display ; Is the Multi-GF Table displayed?
810 return ; Yes, No update and return! 826 return ; Yes, No update and return!
811 827
828 WIN_INVERT .0 ; Init new Wordprocessor
829 call PLED_active_gas_divemode_show ; Show gas (Non-Inverted in all cases)
830
831 btfss better_gas_available ;=1: A better gas is available and a gas change is advised in divemode
832 return ; Done.
833
834 ; Check if Gas Output should blink when a better gas is available...
835 GETCUSTOM8 d'42' ; =1 if gas should blink
836 movwf lo
837 movlw d'1'
838 cpfseq lo ; =1?
839 return ; No, Done.
840
841 btg blinking_better_gas ; Toggle blink bit...
842 btfss blinking_better_gas ; blink now?
843 return ; No, Done.
844 WIN_INVERT .1 ; Init new Wordprocessor
845 call PLED_active_gas_divemode_show ; Show gas (Non-Inverted in all cases)
846 WIN_INVERT .0 ; Init new Wordprocessor
847 return ; Done.
848
849 PLED_active_gas_divemode_show:
812 ostc_debug 's' ; Sends debug-information to screen if debugmode active 850 ostc_debug 's' ; Sends debug-information to screen if debugmode active
813 ; gas 851 ; gas
814 WIN_TOP .192 852 WIN_TOP .192
815 WIN_LEFT .65 853 WIN_LEFT .65
816 WIN_FONT FT_SMALL 854 WIN_FONT FT_SMALL
817 WIN_INVERT .0 ; Init new Wordprocessor 855 call PLED_standard_color
818 call PLED_standard_color
819
820 856
821 movlw d'100' ; 100% in the tank 857 movlw d'100' ; 100% in the tank
822 movff char_I_N2_ratio,lo ; minus N2 858 movff char_I_N2_ratio,lo ; minus N2
823 bsf STATUS,C ; set borrow bit 859 bsf STATUS,C ; set borrow bit
824 subfwb lo,W 860 subfwb lo,W
852 movlw ' ' 888 movlw ' '
853 btfsc better_gas_available ;=1: A better gas is available and a gas change is advised in divemode 889 btfsc better_gas_available ;=1: A better gas is available and a gas change is advised in divemode
854 movlw '*' 890 movlw '*'
855 movwf POSTINC2 891 movwf POSTINC2
856 call word_processor 892 call word_processor
857 bra PLED_active_gas_divemode_exit 893 return
858 894
859 PLED_active_gas_divemode4: 895 PLED_active_gas_divemode4:
860 lfsr FSR2,letter 896 lfsr FSR2,letter
861 bsf leftbind ; left orientated output 897 bsf leftbind ; left orientated output
862 output_8 ; O2 ratio is still in "lo" 898 output_8 ; O2 ratio is still in "lo"
868 btfsc better_gas_available ;=1: A better gas is available and a gas change is advised in divemode 904 btfsc better_gas_available ;=1: A better gas is available and a gas change is advised in divemode
869 movlw '*' 905 movlw '*'
870 movwf POSTINC2 906 movwf POSTINC2
871 bcf leftbind 907 bcf leftbind
872 call word_processor 908 call word_processor
873 909 return
874 PLED_active_gas_divemode_exit: 910
875 btfss better_gas_available ;=1: A better gas is available and a gas change is advised in divemode
876 return ; Done.
877
878 ; Check if Gas Output should blink when a better gas is available...
879 GETCUSTOM8 d'42' ; =1 if gas should blink
880 movwf lo
881 movlw d'1'
882 cpfseq lo ; =1?
883 return ; No, Done.
884
885 btg blinking_better_gas ; Toggle blink bit...
886 btfss blinking_better_gas ; blink now?
887 return ; No, Done.
888 call PLED_active_gas_clear ; Blink once.
889 return ; Done.
890 911
891 912
892 PLED_display_decotype_surface: 913 PLED_display_decotype_surface:
893 WIN_LEFT .85 914 WIN_LEFT .85
894 WIN_FONT FT_SMALL 915 WIN_FONT FT_SMALL
1076 movlw color_grey 1097 movlw color_grey
1077 call PLED_set_color ; grey out inactive gases! 1098 call PLED_set_color ; grey out inactive gases!
1078 bra PLED_pre_dive_color_done 1099 bra PLED_pre_dive_color_done
1079 1100
1080 PLED_pre_dive_white: 1101 PLED_pre_dive_white:
1081 GETCUSTOM8 d'35' ;movlw color_white 1102 call PLED_standard_color
1082 call PLED_set_color ; grey out inactive gases!
1083 1103
1084 PLED_pre_dive_color_done: 1104 PLED_pre_dive_color_done:
1085 read_int_eeprom d'33' ; Read start gas (1-5) 1105 read_int_eeprom d'33' ; Read start gas (1-5)
1086 movf EEDATA,W 1106 movf EEDATA,W
1087 cpfseq hi ; Current Gas the active gas? 1107 cpfseq hi ; Current Gas the active gas?
1094 WIN_LEFT .90 1114 WIN_LEFT .90
1095 movff waitms_temp,win_top ; Set Row 1115 movff waitms_temp,win_top ; Set Row
1096 call word_processor ; No, display gas 1116 call word_processor ; No, display gas
1097 1117
1098 PLED_pre_dive_screen2b: 1118 PLED_pre_dive_screen2b:
1099 GETCUSTOM8 d'35' ;movlw color_white 1119 call PLED_standard_color
1100 call PLED_set_color ; grey out inactive gases!
1101 1120
1102 movlw d'5' ; list all four (remaining) gases 1121 movlw d'5' ; list all four (remaining) gases
1103 cpfseq hi ; All gases shown? 1122 cpfseq hi ; All gases shown?
1104 bra PLED_pre_dive_screen2_loop ; No 1123 bra PLED_pre_dive_screen2_loop ; No
1105 1124
1689 movff WREG,box_temp+3 ; column left (0-159) 1708 movff WREG,box_temp+3 ; column left (0-159)
1690 movlw .31 1709 movlw .31
1691 movff WREG,box_temp+4 ; column right (0-159) 1710 movff WREG,box_temp+4 ; column right (0-159)
1692 call PLED_frame 1711 call PLED_frame
1693 1712
1694 ; 3600-Vbatt 1713 ; 4100-Vbatt
1695 movlw LOW d'3600' 1714 movlw LOW d'4100'
1696 movwf sub_a+0 1715 movwf sub_a+0
1697 movlw HIGH d'3600' 1716 movlw HIGH d'4100'
1698 movwf sub_a+1 1717 movwf sub_a+1
1699 movff batt_voltage+0,sub_b+0 1718 movff batt_voltage+0,sub_b+0
1700 movff batt_voltage+1,sub_b+1 1719 movff batt_voltage+1,sub_b+1
1701 call sub16 ; sub_c = sub_a - sub_b 1720 call sub16 ; sub_c = sub_a - sub_b
1702 ; Battery full (>3600mV? 1721 ; Battery full (>4100mV?
1703 btfsc neg_flag 1722 btfsc neg_flag
1704 bra update_batt_voltage2_full 1723 bra update_batt_voltage2_full
1705 1724
1706 ; Vbatt-3000 1725 ; Vbatt-3500
1707 movlw LOW d'3000' 1726 movlw LOW d'3500'
1708 movwf sub_b+0 1727 movwf sub_b+0
1709 movlw HIGH d'3000' 1728 movlw HIGH d'3500'
1710 movwf sub_b+1 1729 movwf sub_b+1
1711 movff batt_voltage+0,sub_a+0 1730 movff batt_voltage+0,sub_a+0
1712 movff batt_voltage+1,sub_a+1 1731 movff batt_voltage+1,sub_a+1
1713 call sub16 ; sub_c = sub_a - sub_b 1732 call sub16 ; sub_c = sub_a - sub_b
1714 ; Battery lower then 3000mV? 1733 ; Battery lower then 3500mV?
1715 btfsc neg_flag 1734 btfsc neg_flag
1716 bra update_batt_voltage2_empty 1735 bra update_batt_voltage2_empty
1717 1736
1718 ; Battery is between 3000 and 3600mV 1737 ; Battery is between 3500 and 4100mV
1719 ; sub_c:2 is between 0 and 600 1738 ; sub_c:2 is between 0 and 600
1720 movff sub_c+0,xA+0 1739 movff sub_c+0,xA+0
1721 movff sub_c+1,xA+1 1740 movff sub_c+1,xA+1
1722 movlw d'20' 1741 movlw d'20'
1723 movwf xB+0 1742 movwf xB+0
1727 movff xC+0,wait_temp ;save value 1746 movff xC+0,wait_temp ;save value
1728 1747
1729 movlw d'2' 1748 movlw d'2'
1730 cpfsgt wait_temp 1749 cpfsgt wait_temp
1731 movwf wait_temp ; Minimum = 2 1750 movwf wait_temp ; Minimum = 2
1732
1733 1751
1734 update_batt_voltage2a: 1752 update_batt_voltage2a:
1735 GETCUSTOM8 d'35' ; Standard output color 1753 GETCUSTOM8 d'35' ; Standard output color
1736 movff WREG,box_temp+0 ; Data 1754 movff WREG,box_temp+0 ; Data
1737 movlw .181 1755 movlw .181
1740 movff WREG,box_temp+2 ; row bottom (0-239) 1758 movff WREG,box_temp+2 ; row bottom (0-239)
1741 movlw .31 1759 movlw .31
1742 movff WREG,box_temp+3 ; column left (0-159) 1760 movff WREG,box_temp+3 ; column left (0-159)
1743 movlw .33 1761 movlw .33
1744 movff WREG,box_temp+4 ; column right (0-159) 1762 movff WREG,box_temp+4 ; column right (0-159)
1745 call PLED_frame ; Empty cap 1763 call PLED_box ; Full Cap
1746 1764
1765 ; GETCUSTOM8 d'35' ; Standard output color
1766 ; movff WREG,box_temp+0 ; Data
1767 ; movlw .181
1768 ; movff WREG,box_temp+1 ; row top (0-239)
1769 ; movlw .187
1770 ; movff WREG,box_temp+2 ; row bottom (0-239)
1771 ; movlw .31
1772 ; movff WREG,box_temp+3 ; column left (0-159)
1773 ; movlw .33
1774 ; movff WREG,box_temp+4 ; column right (0-159)
1775 ; call PLED_frame ; Empty cap
1776 ;
1747 update_batt_voltage3: 1777 update_batt_voltage3:
1748 GETCUSTOM8 d'34' ; Color battery 1778 GETCUSTOM8 d'34' ; Color battery
1749 movff WREG,box_temp+0 ; Color Data 1779 movff WREG,box_temp+0 ; Color Data
1750 movlw .175 1780 movlw .176
1751 movff WREG,box_temp+1 ; row top (0-239) 1781 movff WREG,box_temp+1 ; row top (0-239)
1752 movlw .193 1782 movlw .192
1753 movff WREG,box_temp+2 ; row bottom (0-239) 1783 movff WREG,box_temp+2 ; row bottom (0-239)
1754 movlw .1 1784 movlw .1
1755 movff WREG,box_temp+3 ; column left (0-159) 1785 movff WREG,box_temp+3 ; column left (0-159)
1756 movff wait_temp,box_temp+4 ; column right (0-159) 1786 movff wait_temp,box_temp+4 ; column right (0-159)
1757 call PLED_box 1787 call PLED_box
1758 1788
1759 GETCUSTOM8 d'35' ; Standard output color 1789 call PLED_standard_color
1760 call PLED_set_color
1761 return 1790 return
1762 1791
1763 update_batt_voltage2_empty: 1792 update_batt_voltage2_empty:
1764 movlw d'1' 1793 movlw d'1'
1765 movwf wait_temp 1794 movwf wait_temp
1766 bra update_batt_voltage2a 1795 bra update_batt_voltage2a
1767 1796
1768 update_batt_voltage2_full: 1797 update_batt_voltage2_full:
1769 movlw d'30' 1798 movlw d'30'
1770 movwf wait_temp 1799 movwf wait_temp
1771 1800 bra update_batt_voltage2a
1772 GETCUSTOM8 d'35' ; Standard output color
1773 movff WREG,box_temp+0 ; Data
1774 movlw .181
1775 movff WREG,box_temp+1 ; row top (0-239)
1776 movlw .187
1777 movff WREG,box_temp+2 ; row bottom (0-239)
1778 movlw .31
1779 movff WREG,box_temp+3 ; column left (0-159)
1780 movlw .33
1781 movff WREG,box_temp+4 ; column right (0-159)
1782 call PLED_box ; Full Cap
1783 bra update_batt_voltage3
1784 1801
1785 PLED_convert_date: ; converts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2 1802 PLED_convert_date: ; converts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2
1786 read_int_eeprom d'91' ; Read date format (0=MMDDYY, 1=DDMMYY, 2=YYMMDD) 1803 read_int_eeprom d'91' ; Read date format (0=MMDDYY, 1=DDMMYY, 2=YYMMDD)
1787 tstfsz EEDATA 1804 tstfsz EEDATA
1788 bra PLED_convert_date1 1805 bra PLED_convert_date1
3190 ; movwf scaleY 3207 ; movwf scaleY
3191 ; call word_processor 3208 ; call word_processor
3192 ; return 3209 ; return
3193 ; 3210 ;
3194 3211
3195 ;PLED_gaschange_DEBUG: 3212 PLED_gaschange_DEBUG:
3196 ; movlw .008 3213 WIN_LEFT .0
3197 ; call PLED_SetColumn 3214 WIN_TOP .160
3198 ; movlw .016 3215 lfsr FSR2,letter
3199 ; call PLED_SetRow 3216 movff char_I_deco_He_ratio,lo
3200 ; lfsr FSR2,letter 3217 output_8
3201 ; movff char_I_deco_He_ratio,lo 3218 call word_processor
3202 ; output_8 3219
3203 ; call word_processor 3220 WIN_LEFT .25
3204 ; 3221 WIN_TOP .160
3205 ; movlw .024 3222 call PLED_SetRow
3206 ; call PLED_SetRow 3223 lfsr FSR2,letter
3207 ; lfsr FSR2,letter 3224 movff char_I_deco_N2_ratio,lo
3208 ; movff char_I_deco_N2_ratio,lo 3225 output_8
3209 ; output_8 3226 call word_processor
3210 ; call word_processor 3227
3211 ; 3228 WIN_LEFT .50
3212 ; movlw .032 3229 WIN_TOP .160
3213 ; call PLED_SetRow 3230 lfsr FSR2,letter
3214 ; lfsr FSR2,letter 3231 movff char_I_deco_gas_change,lo
3215 ; movff char_I_deco_gas_change,lo 3232 output_8
3216 ; output_8 3233 call word_processor
3217 ; call word_processor 3234
3218 ; 3235 WIN_LEFT .75
3219 ; movlw .040 3236 WIN_TOP .160
3220 ; call PLED_SetRow 3237 lfsr FSR2,letter
3221 ; lfsr FSR2,letter 3238 movff hi,lo
3222 ; movff hi,lo 3239 output_8
3223 ; output_8 3240 call word_processor
3224 ; call word_processor 3241 return
3225 ; return
3226 3242
3227 3243
3228 PLED_MultiGF_deco_mask: 3244 PLED_MultiGF_deco_mask:
3229 ; movlw 0x30 3245 ; movlw 0x30
3230 ; movwf wait_temp 3246 ; movwf wait_temp