comparison src/comm.asm @ 157:5ee76921e359

make new parameters configurable through pc
author heinrichsweikamp
date Fri, 29 Aug 2014 08:58:27 +0200
parents 074b1a9ded7b
children 2eb037f48c3f
comparison
equal deleted inserted replaced
156:afa54e9bdda6 157:5ee76921e359
940 bra comm_read_compass_gain ; RCREG1=0x34 940 bra comm_read_compass_gain ; RCREG1=0x34
941 dcfsnz WREG 941 dcfsnz WREG
942 bra comm_read_pressure_adjust ; RCREG1=0x35 942 bra comm_read_pressure_adjust ; RCREG1=0x35
943 dcfsnz WREG 943 dcfsnz WREG
944 bra comm_read_safety_stop ; RCREG1=0x36 944 bra comm_read_safety_stop ; RCREG1=0x36
945 945 dcfsnz WREG
946 946 bra comm_read_calibration_gas ; RCREG1=0x37
947 dcfsnz WREG
948 bra comm_read_fallback ; RCREG1=0x38
949 dcfsnz WREG
950 bra comm_read_flip_screen ; RCREG1=0x39
947 951
948 comm_read_unused: 952 comm_read_unused:
949 comm_read_abort: 953 comm_read_abort:
950 bra comm_download_mode0 ; Done. Loop with timeout reset 954 bra comm_download_mode0 ; Done. Loop with timeout reset
951 955
952 comm_read_setting_wait: 956 comm_read_setting_wait:
953 call rs232_wait_tx ; Wait for UART 957 call rs232_wait_tx ; Wait for UART
954 return 958 return
955 959
960 comm_read_done:
961 call rs232_wait_tx ; Wait for UART
962 bra comm_download_mode0 ; Done. Loop with timeout reset
963
956 comm_read_gas1: 964 comm_read_gas1:
957 movff opt_gas_O2_ratio+0, TXREG1 965 movff opt_gas_O2_ratio+0, TXREG1
958 rcall comm_read_setting_wait ; Wait for UART 966 rcall comm_read_setting_wait ; Wait for UART
959 movff opt_gas_He_ratio+0, TXREG1 967 movff opt_gas_He_ratio+0, TXREG1
960 rcall comm_read_setting_wait ; Wait for UART 968 rcall comm_read_setting_wait ; Wait for UART
961 movff opt_gas_type+0, TXREG1 969 movff opt_gas_type+0, TXREG1
962 rcall comm_read_setting_wait ; Wait for UART 970 rcall comm_read_setting_wait ; Wait for UART
963 movff opt_OC_bail_gas_change+0,TXREG1 971 movff opt_OC_bail_gas_change+0,TXREG1
964 bra comm_download_mode0 ; Done. Loop with timeout reset 972 bra comm_read_done ; Done. Wait for UART and loop with timeout reset
965 comm_read_gas2: 973 comm_read_gas2:
966 movff opt_gas_O2_ratio+1, TXREG1 974 movff opt_gas_O2_ratio+1, TXREG1
967 rcall comm_read_setting_wait ; Wait for UART 975 rcall comm_read_setting_wait ; Wait for UART
968 movff opt_gas_He_ratio+1, TXREG1 976 movff opt_gas_He_ratio+1, TXREG1
969 rcall comm_read_setting_wait ; Wait for UART 977 rcall comm_read_setting_wait ; Wait for UART
970 movff opt_gas_type+1, TXREG1 978 movff opt_gas_type+1, TXREG1
971 rcall comm_read_setting_wait ; Wait for UART 979 rcall comm_read_setting_wait ; Wait for UART
972 movff opt_OC_bail_gas_change+1,TXREG1 980 movff opt_OC_bail_gas_change+1,TXREG1
973 bra comm_download_mode0 ; Done. Loop with timeout reset 981 bra comm_read_done ; Done. Wait for UART and loop with timeout reset
974 comm_read_gas3: 982 comm_read_gas3:
975 movff opt_gas_O2_ratio+2, TXREG1 983 movff opt_gas_O2_ratio+2, TXREG1
976 rcall comm_read_setting_wait ; Wait for UART 984 rcall comm_read_setting_wait ; Wait for UART
977 movff opt_gas_He_ratio+2, TXREG1 985 movff opt_gas_He_ratio+2, TXREG1
978 rcall comm_read_setting_wait ; Wait for UART 986 rcall comm_read_setting_wait ; Wait for UART
979 movff opt_gas_type+2, TXREG1 987 movff opt_gas_type+2, TXREG1
980 rcall comm_read_setting_wait ; Wait for UART 988 rcall comm_read_setting_wait ; Wait for UART
981 movff opt_OC_bail_gas_change+2,TXREG1 989 movff opt_OC_bail_gas_change+2,TXREG1
982 bra comm_download_mode0 ; Done. Loop with timeout reset 990 bra comm_read_done ; Done. Wait for UART and loop with timeout reset
983 comm_read_gas4: 991 comm_read_gas4:
984 movff opt_gas_O2_ratio+3, TXREG1 992 movff opt_gas_O2_ratio+3, TXREG1
985 rcall comm_read_setting_wait ; Wait for UART 993 rcall comm_read_setting_wait ; Wait for UART
986 movff opt_gas_He_ratio+3, TXREG1 994 movff opt_gas_He_ratio+3, TXREG1
987 rcall comm_read_setting_wait ; Wait for UART 995 rcall comm_read_setting_wait ; Wait for UART
988 movff opt_gas_type+3, TXREG1 996 movff opt_gas_type+3, TXREG1
989 rcall comm_read_setting_wait ; Wait for UART 997 rcall comm_read_setting_wait ; Wait for UART
990 movff opt_OC_bail_gas_change+3,TXREG1 998 movff opt_OC_bail_gas_change+3,TXREG1
991 bra comm_download_mode0 ; Done. Loop with timeout reset 999 bra comm_read_done ; Done. Wait for UART and loop with timeout reset
992 comm_read_gas5: 1000 comm_read_gas5:
993 movff opt_gas_O2_ratio+4, TXREG1 1001 movff opt_gas_O2_ratio+4, TXREG1
994 rcall comm_read_setting_wait ; Wait for UART 1002 rcall comm_read_setting_wait ; Wait for UART
995 movff opt_gas_He_ratio+4, TXREG1 1003 movff opt_gas_He_ratio+4, TXREG1
996 rcall comm_read_setting_wait ; Wait for UART 1004 rcall comm_read_setting_wait ; Wait for UART
997 movff opt_gas_type+4, TXREG1 1005 movff opt_gas_type+4, TXREG1
998 rcall comm_read_setting_wait ; Wait for UART 1006 rcall comm_read_setting_wait ; Wait for UART
999 movff opt_OC_bail_gas_change+4,TXREG1 1007 movff opt_OC_bail_gas_change+4,TXREG1
1000 bra comm_download_mode0 ; Done. Loop with timeout reset 1008 bra comm_read_done ; Done. Wait for UART and loop with timeout reset
1001 1009
1002 comm_read_dil1: 1010 comm_read_dil1:
1003 movff opt_dil_O2_ratio+0, TXREG1 1011 movff opt_dil_O2_ratio+0, TXREG1
1004 rcall comm_read_setting_wait ; Wait for UART 1012 rcall comm_read_setting_wait ; Wait for UART
1005 movff opt_dil_He_ratio+0, TXREG1 1013 movff opt_dil_He_ratio+0, TXREG1
1006 rcall comm_read_setting_wait ; Wait for UART 1014 rcall comm_read_setting_wait ; Wait for UART
1007 movff opt_dil_type+0, TXREG1 1015 movff opt_dil_type+0, TXREG1
1008 rcall comm_read_setting_wait ; Wait for UART 1016 rcall comm_read_setting_wait ; Wait for UART
1009 movff char_I_dil_change+0,TXREG1 1017 movff char_I_dil_change+0,TXREG1
1010 bra comm_download_mode0 ; Done. Loop with timeout reset 1018 bra comm_read_done ; Done. Wait for UART and loop with timeout reset
1011 comm_read_dil2: 1019 comm_read_dil2:
1012 movff opt_dil_O2_ratio+1, TXREG1 1020 movff opt_dil_O2_ratio+1, TXREG1
1013 rcall comm_read_setting_wait ; Wait for UART 1021 rcall comm_read_setting_wait ; Wait for UART
1014 movff opt_dil_He_ratio+1, TXREG1 1022 movff opt_dil_He_ratio+1, TXREG1
1015 rcall comm_read_setting_wait ; Wait for UART 1023 rcall comm_read_setting_wait ; Wait for UART
1016 movff opt_dil_type+1, TXREG1 1024 movff opt_dil_type+1, TXREG1
1017 rcall comm_read_setting_wait ; Wait for UART 1025 rcall comm_read_setting_wait ; Wait for UART
1018 movff char_I_dil_change+1,TXREG1 1026 movff char_I_dil_change+1,TXREG1
1019 bra comm_download_mode0 ; Done. Loop with timeout reset 1027 bra comm_read_done ; Done. Wait for UART and loop with timeout reset
1020 comm_read_dil3: 1028 comm_read_dil3:
1021 movff opt_dil_O2_ratio+2, TXREG1 1029 movff opt_dil_O2_ratio+2, TXREG1
1022 rcall comm_read_setting_wait ; Wait for UART 1030 rcall comm_read_setting_wait ; Wait for UART
1023 movff opt_dil_He_ratio+2, TXREG1 1031 movff opt_dil_He_ratio+2, TXREG1
1024 rcall comm_read_setting_wait ; Wait for UART 1032 rcall comm_read_setting_wait ; Wait for UART
1025 movff opt_dil_type+2, TXREG1 1033 movff opt_dil_type+2, TXREG1
1026 rcall comm_read_setting_wait ; Wait for UART 1034 rcall comm_read_setting_wait ; Wait for UART
1027 movff char_I_dil_change+2,TXREG1 1035 movff char_I_dil_change+2,TXREG1
1028 bra comm_download_mode0 ; Done. Loop with timeout reset 1036 bra comm_read_done ; Done. Wait for UART and loop with timeout reset
1029 comm_read_dil4: 1037 comm_read_dil4:
1030 movff opt_dil_O2_ratio+3, TXREG1 1038 movff opt_dil_O2_ratio+3, TXREG1
1031 rcall comm_read_setting_wait ; Wait for UART 1039 rcall comm_read_setting_wait ; Wait for UART
1032 movff opt_dil_He_ratio+3, TXREG1 1040 movff opt_dil_He_ratio+3, TXREG1
1033 rcall comm_read_setting_wait ; Wait for UART 1041 rcall comm_read_setting_wait ; Wait for UART
1034 movff opt_dil_type+3, TXREG1 1042 movff opt_dil_type+3, TXREG1
1035 rcall comm_read_setting_wait ; Wait for UART 1043 rcall comm_read_setting_wait ; Wait for UART
1036 movff char_I_dil_change+3,TXREG1 1044 movff char_I_dil_change+3,TXREG1
1037 bra comm_download_mode0 ; Done. Loop with timeout reset 1045 bra comm_read_done ; Done. Wait for UART and loop with timeout reset
1038 comm_read_dil5: 1046 comm_read_dil5:
1039 movff opt_dil_O2_ratio+4, TXREG1 1047 movff opt_dil_O2_ratio+4, TXREG1
1040 rcall comm_read_setting_wait ; Wait for UART 1048 rcall comm_read_setting_wait ; Wait for UART
1041 movff opt_dil_He_ratio+4, TXREG1 1049 movff opt_dil_He_ratio+4, TXREG1
1042 rcall comm_read_setting_wait ; Wait for UART 1050 rcall comm_read_setting_wait ; Wait for UART
1043 movff opt_dil_type+4, TXREG1 1051 movff opt_dil_type+4, TXREG1
1044 rcall comm_read_setting_wait ; Wait for UART 1052 rcall comm_read_setting_wait ; Wait for UART
1045 movff char_I_dil_change+4,TXREG1 1053 movff char_I_dil_change+4,TXREG1
1046 bra comm_download_mode0 ; Done. Loop with timeout reset 1054 bra comm_read_done ; Done. Wait for UART and loop with timeout reset
1047 1055
1048 comm_read_sp1: 1056 comm_read_sp1:
1049 movff char_I_setpoint_cbar+0, TXREG1 1057 movff char_I_setpoint_cbar+0, TXREG1
1050 rcall comm_read_setting_wait ; Wait for UART 1058 rcall comm_read_setting_wait ; Wait for UART
1051 movff char_I_setpoint_change+0, TXREG1 1059 movff char_I_setpoint_change+0, TXREG1
1052 rcall comm_read_setting_wait ; Wait for UART 1060 bra comm_read_done ; Done. Wait for UART and loop with timeout reset
1053 bra comm_download_mode0 ; Done. Loop with timeout reset
1054 comm_read_sp2: 1061 comm_read_sp2:
1055 movff char_I_setpoint_cbar+1, TXREG1 1062 movff char_I_setpoint_cbar+1, TXREG1
1056 rcall comm_read_setting_wait ; Wait for UART 1063 rcall comm_read_setting_wait ; Wait for UART
1057 movff char_I_setpoint_change+1, TXREG1 1064 movff char_I_setpoint_change+1, TXREG1
1058 rcall comm_read_setting_wait ; Wait for UART 1065 bra comm_read_done ; Done. Wait for UART and loop with timeout reset
1059 bra comm_download_mode0 ; Done. Loop with timeout reset
1060 comm_read_sp3: 1066 comm_read_sp3:
1061 movff char_I_setpoint_cbar+2, TXREG1 1067 movff char_I_setpoint_cbar+2, TXREG1
1062 rcall comm_read_setting_wait ; Wait for UART 1068 rcall comm_read_setting_wait ; Wait for UART
1063 movff char_I_setpoint_change+2, TXREG1 1069 movff char_I_setpoint_change+2, TXREG1
1064 rcall comm_read_setting_wait ; Wait for UART 1070 bra comm_read_done ; Done. Wait for UART and loop with timeout reset
1065 bra comm_download_mode0 ; Done. Loop with timeout reset
1066 comm_read_sp4: 1071 comm_read_sp4:
1067 movff char_I_setpoint_cbar+3, TXREG1 1072 movff char_I_setpoint_cbar+3, TXREG1
1068 rcall comm_read_setting_wait ; Wait for UART 1073 rcall comm_read_setting_wait ; Wait for UART
1069 movff char_I_setpoint_change+3, TXREG1 1074 movff char_I_setpoint_change+3, TXREG1
1070 rcall comm_read_setting_wait ; Wait for UART 1075 bra comm_read_done ; Done. Wait for UART and loop with timeout reset
1071 bra comm_download_mode0 ; Done. Loop with timeout reset
1072 comm_read_sp5: 1076 comm_read_sp5:
1073 movff char_I_setpoint_cbar+4, TXREG1 1077 movff char_I_setpoint_cbar+4, TXREG1
1074 rcall comm_read_setting_wait ; Wait for UART 1078 rcall comm_read_setting_wait ; Wait for UART
1075 movff char_I_setpoint_change+4, TXREG1 1079 movff char_I_setpoint_change+4, TXREG1
1076 rcall comm_read_setting_wait ; Wait for UART 1080 bra comm_read_done ; Done. Wait for UART and loop with timeout reset
1077 bra comm_download_mode0 ; Done. Loop with timeout reset
1078
1079 comm_read_ccr_mode: 1081 comm_read_ccr_mode:
1080 movff opt_ccr_mode, TXREG1 1082 movff opt_ccr_mode, TXREG1
1081 rcall comm_read_setting_wait ; Wait for UART 1083 bra comm_read_done ; Done. Wait for UART and loop with timeout reset
1082 bra comm_download_mode0 ; Done. Loop with timeout reset
1083 comm_read_dive_mode: 1084 comm_read_dive_mode:
1084 movff opt_dive_mode, TXREG1 1085 movff opt_dive_mode, TXREG1
1085 rcall comm_read_setting_wait ; Wait for UART 1086 bra comm_read_done ; Done. Wait for UART and loop with timeout reset
1086 bra comm_download_mode0 ; Done. Loop with timeout reset
1087 comm_read_decotype: 1087 comm_read_decotype:
1088 movff char_I_deco_model, TXREG1 1088 movff char_I_deco_model, TXREG1
1089 rcall comm_read_setting_wait ; Wait for UART 1089 bra comm_read_done ; Done. Wait for UART and loop with timeout reset
1090 bra comm_download_mode0 ; Done. Loop with timeout reset
1091 comm_read_ppo2_max: 1090 comm_read_ppo2_max:
1092 movff opt_ppO2_max, TXREG1 1091 movff opt_ppO2_max, TXREG1
1093 rcall comm_read_setting_wait ; Wait for UART 1092 bra comm_read_done ; Done. Wait for UART and loop with timeout reset
1094 bra comm_download_mode0 ; Done. Loop with timeout reset
1095 comm_read_ppo2_min: 1093 comm_read_ppo2_min:
1096 movff opt_ppO2_min, TXREG1 1094 movff opt_ppO2_min, TXREG1
1097 rcall comm_read_setting_wait ; Wait for UART 1095 bra comm_read_done ; Done. Wait for UART and loop with timeout reset
1098 bra comm_download_mode0 ; Done. Loop with timeout reset
1099 comm_read_ftts: 1096 comm_read_ftts:
1100 movff char_I_extra_time, TXREG1 1097 movff char_I_extra_time, TXREG1
1101 rcall comm_read_setting_wait ; Wait for UART 1098 bra comm_read_done ; Done. Wait for UART and loop with timeout reset
1102 bra comm_download_mode0 ; Done. Loop with timeout reset
1103 comm_read_gf_low: 1099 comm_read_gf_low:
1104 movff opt_GF_low, TXREG1 1100 movff opt_GF_low, TXREG1
1105 rcall comm_read_setting_wait ; Wait for UART 1101 bra comm_read_done ; Done. Wait for UART and loop with timeout reset
1106 bra comm_download_mode0 ; Done. Loop with timeout reset
1107 comm_read_gf_high: 1102 comm_read_gf_high:
1108 movff opt_GF_high, TXREG1 1103 movff opt_GF_high, TXREG1
1109 rcall comm_read_setting_wait ; Wait for UART 1104 bra comm_read_done ; Done. Wait for UART and loop with timeout reset
1110 bra comm_download_mode0 ; Done. Loop with timeout reset
1111 comm_read_agf_low: 1105 comm_read_agf_low:
1112 movff opt_aGF_low, TXREG1 1106 movff opt_aGF_low, TXREG1
1113 rcall comm_read_setting_wait ; Wait for UART 1107 bra comm_read_done ; Done. Wait for UART and loop with timeout reset
1114 bra comm_download_mode0 ; Done. Loop with timeout reset
1115 comm_read_agf_high: 1108 comm_read_agf_high:
1116 movff opt_aGF_high, TXREG1 1109 movff opt_aGF_high, TXREG1
1117 rcall comm_read_setting_wait ; Wait for UART 1110 bra comm_read_done ; Done. Wait for UART and loop with timeout reset
1118 bra comm_download_mode0 ; Done. Loop with timeout reset
1119 comm_read_agf_selectable: 1111 comm_read_agf_selectable:
1120 movff opt_enable_aGF, TXREG1 1112 movff opt_enable_aGF, TXREG1
1121 rcall comm_read_setting_wait ; Wait for UART 1113 bra comm_read_done ; Done. Wait for UART and loop with timeout reset
1122 bra comm_download_mode0 ; Done. Loop with timeout reset
1123 comm_read_saturation: 1114 comm_read_saturation:
1124 movff char_I_saturation_multiplier, TXREG1 1115 movff char_I_saturation_multiplier, TXREG1
1125 rcall comm_read_setting_wait ; Wait for UART 1116 bra comm_read_done ; Done. Wait for UART and loop with timeout reset
1126 bra comm_download_mode0 ; Done. Loop with timeout reset
1127 comm_read_desaturation: 1117 comm_read_desaturation:
1128 movff char_I_desaturation_multiplier, TXREG1 1118 movff char_I_desaturation_multiplier, TXREG1
1129 rcall comm_read_setting_wait ; Wait for UART 1119 bra comm_read_done ; Done. Wait for UART and loop with timeout reset
1130 bra comm_download_mode0 ; Done. Loop with timeout reset
1131 comm_read_last_deco: 1120 comm_read_last_deco:
1132 movff opt_last_stop, TXREG1 1121 movff opt_last_stop, TXREG1
1133 rcall comm_read_setting_wait ; Wait for UART 1122 bra comm_read_done ; Done. Wait for UART and loop with timeout reset
1134 bra comm_download_mode0 ; Done. Loop with timeout reset
1135 comm_read_brightness: 1123 comm_read_brightness:
1136 movff opt_brightness, TXREG1 1124 movff opt_brightness, TXREG1
1137 rcall comm_read_setting_wait ; Wait for UART 1125 bra comm_read_done ; Done. Wait for UART and loop with timeout reset
1138 bra comm_download_mode0 ; Done. Loop with timeout reset
1139 comm_read_units: 1126 comm_read_units:
1140 movff opt_units, TXREG1 1127 movff opt_units, TXREG1
1141 rcall comm_read_setting_wait ; Wait for UART 1128 bra comm_read_done ; Done. Wait for UART and loop with timeout reset
1142 bra comm_download_mode0 ; Done. Loop with timeout reset
1143 comm_read_samplingrate: 1129 comm_read_samplingrate:
1144 movff opt_sampling_rate, TXREG1 1130 movff opt_sampling_rate, TXREG1
1145 rcall comm_read_setting_wait ; Wait for UART 1131 bra comm_read_done ; Done. Wait for UART and loop with timeout reset
1146 bra comm_download_mode0 ; Done. Loop with timeout reset
1147 comm_read_salinity: 1132 comm_read_salinity:
1148 movff opt_salinity, TXREG1 1133 movff opt_salinity, TXREG1
1149 rcall comm_read_setting_wait ; Wait for UART 1134 bra comm_read_done ; Done. Wait for UART and loop with timeout reset
1150 bra comm_download_mode0 ; Done. Loop with timeout reset
1151 comm_read_divemode_colour: 1135 comm_read_divemode_colour:
1152 movff opt_dive_color_scheme, TXREG1 1136 movff opt_dive_color_scheme, TXREG1
1153 rcall comm_read_setting_wait ; Wait for UART 1137 bra comm_read_done ; Done. Wait for UART and loop with timeout reset
1154 bra comm_download_mode0 ; Done. Loop with timeout reset
1155 comm_read_language: 1138 comm_read_language:
1156 movff opt_language, TXREG1 1139 movff opt_language, TXREG1
1157 rcall comm_read_setting_wait ; Wait for UART 1140 bra comm_read_done ; Done. Wait for UART and loop with timeout reset
1158 bra comm_download_mode0 ; Done. Loop with timeout reset
1159 comm_read_date_format: 1141 comm_read_date_format:
1160 movff opt_dateformat, TXREG1 1142 movff opt_dateformat, TXREG1
1161 rcall comm_read_setting_wait ; Wait for UART 1143 bra comm_read_done ; Done. Wait for UART and loop with timeout reset
1162 bra comm_download_mode0 ; Done. Loop with timeout reset
1163 comm_read_compass_gain: 1144 comm_read_compass_gain:
1164 movff opt_compass_gain, TXREG1 1145 movff opt_compass_gain, TXREG1
1165 rcall comm_read_setting_wait ; Wait for UART 1146 bra comm_read_done ; Done. Wait for UART and loop with timeout reset
1166 bra comm_download_mode0 ; Done. Loop with timeout reset
1167 comm_read_pressure_adjust: 1147 comm_read_pressure_adjust:
1168 movff opt_pressure_adjust, TXREG1 1148 movff opt_pressure_adjust, TXREG1
1169 rcall comm_read_setting_wait ; Wait for UART 1149 bra comm_read_done ; Done. Wait for UART and loop with timeout reset
1170 bra comm_download_mode0 ; Done. Loop with timeout reset
1171 comm_read_safety_stop: 1150 comm_read_safety_stop:
1172 movff opt_enable_safetystop, TXREG1 1151 movff opt_enable_safetystop, TXREG1
1173 rcall comm_read_setting_wait ; Wait for UART 1152 bra comm_read_done ; Done. Wait for UART and loop with timeout reset
1174 bra comm_download_mode0 ; Done. Loop with timeout reset 1153 comm_read_calibration_gas:
1154 movff opt_calibration_O2_ratio, TXREG1
1155 bra comm_read_done ; Done. Wait for UART and loop with timeout reset
1156 comm_read_fallback:
1157 movff opt_sensor_fallback, TXREG1
1158 bra comm_read_done ; Done. Wait for UART and loop with timeout reset
1159 comm_read_flip_screen:
1160 movff opt_flip_screen, TXREG1
1161 bra comm_read_done ; Done. Wait for UART and loop with timeout reset
1175 1162
1176 1163
1177 ;----------------------------------------------------------------------------- 1164 ;-----------------------------------------------------------------------------
1178 1165
1179 1166
1180 comm_write_setting: 1167 comm_write_setting:
1181 movlw "w" 1168 movlw "w"
1182 movwf TXREG1 1169 movwf TXREG1
1183 call rs232_get_byte 1170 rcall comm_write_get_byte ; "Byte 2"
1184 btfsc rs232_recieve_overflow ; Got byte? 1171 btfsc rs232_recieve_overflow ; Got byte?
1185 bra comm_write_abort ; No, abort! 1172 bra comm_write_abort ; No, abort!
1186 call rs232_wait_tx ; Wait for UART 1173 movff RCREG1,temp1 ; Copy
1187 movf RCREG1,W ; Copy 1174 rcall comm_write_get_byte ; "Byte 3"
1175 call rs232_wait_tx ; Wait for UART
1176 movf temp1,W
1188 bz comm_write_unused ; RCREG1=0 1177 bz comm_write_unused ; RCREG1=0
1189 dcfsnz WREG 1178 dcfsnz WREG
1190 bra comm_write_unused ; RCREG1=1 1179 bra comm_write_unused ; RCREG1=1
1191 dcfsnz WREG 1180 dcfsnz WREG
1192 bra comm_write_unused ; RCREG1=2 1181 bra comm_write_unused ; RCREG1=2
1292 bra comm_write_compass_gain ; RCREG1=0x34 1281 bra comm_write_compass_gain ; RCREG1=0x34
1293 dcfsnz WREG 1282 dcfsnz WREG
1294 bra comm_write_pressure_adjust ; RCREG1=0x35 1283 bra comm_write_pressure_adjust ; RCREG1=0x35
1295 dcfsnz WREG 1284 dcfsnz WREG
1296 bra comm_write_safety_stop ; RCREG1=0x36 1285 bra comm_write_safety_stop ; RCREG1=0x36
1286 dcfsnz WREG
1287 bra comm_write_calibration_gas ; RCREG1=0x37
1288 dcfsnz WREG
1289 bra comm_write_fallback ; RCREG1=0x38
1290 dcfsnz WREG
1291 bra comm_write_flip_screen ; RCREG1=0x39
1297 1292
1298 comm_write_unused: 1293 comm_write_unused:
1299 comm_write_abort: 1294 comm_write_abort:
1300 ; Check Options, gases and diluents 1295 ; Check Options, gases and diluents
1301 call option_check_all ; Check all options (and reset if not within their min/max boundaries) 1296 call option_check_all ; Check all options (and reset if not within their min/max boundaries)
1305 call gaslist_cleanup_list ; Takes care that only one gas can be first and first has 0m change depth 1300 call gaslist_cleanup_list ; Takes care that only one gas can be first and first has 0m change depth
1306 call get_first_gas_to_WREG ; Makes sure at least one Gas is "First" 1301 call get_first_gas_to_WREG ; Makes sure at least one Gas is "First"
1307 call get_first_dil_to_WREG ; Makes sure at least one Diluent is "First" 1302 call get_first_dil_to_WREG ; Makes sure at least one Diluent is "First"
1308 bra comm_download_mode0 ; Done. Loop with timeout reset 1303 bra comm_download_mode0 ; Done. Loop with timeout reset
1309 1304
1305 comm_write_get_byte:
1306 call rs232_get_byte
1307 return
1308
1310 comm_write_gas1: 1309 comm_write_gas1:
1311 call rs232_get_byte
1312 movff RCREG1,opt_gas_O2_ratio+0 1310 movff RCREG1,opt_gas_O2_ratio+0
1313 call rs232_get_byte 1311 rcall comm_write_get_byte
1314 movff RCREG1,opt_gas_He_ratio+0 1312 movff RCREG1,opt_gas_He_ratio+0
1315 call rs232_get_byte 1313 rcall comm_write_get_byte
1316 movff RCREG1,opt_gas_type+0 1314 movff RCREG1,opt_gas_type+0
1317 call rs232_get_byte 1315 rcall comm_write_get_byte
1318 movff RCREG1,opt_OC_bail_gas_change+0 1316 movff RCREG1,opt_OC_bail_gas_change+0
1319 bra comm_write_abort ; Done. Loop with timeout reset 1317 bra comm_write_abort ; Done. Loop with timeout reset
1320 comm_write_gas2: 1318 comm_write_gas2:
1321 call rs232_get_byte
1322 movff RCREG1,opt_gas_O2_ratio+1 1319 movff RCREG1,opt_gas_O2_ratio+1
1323 call rs232_get_byte 1320 rcall comm_write_get_byte
1324 movff RCREG1,opt_gas_He_ratio+1 1321 movff RCREG1,opt_gas_He_ratio+1
1325 call rs232_get_byte 1322 rcall comm_write_get_byte
1326 movff RCREG1,opt_gas_type+1 1323 movff RCREG1,opt_gas_type+1
1327 call rs232_get_byte 1324 rcall comm_write_get_byte
1328 movff RCREG1,opt_OC_bail_gas_change+1 1325 movff RCREG1,opt_OC_bail_gas_change+1
1329 bra comm_write_abort ; Done. Loop with timeout reset 1326 bra comm_write_abort ; Done. Loop with timeout reset
1330 comm_write_gas3: 1327 comm_write_gas3:
1331 call rs232_get_byte
1332 movff RCREG1,opt_gas_O2_ratio+2 1328 movff RCREG1,opt_gas_O2_ratio+2
1333 call rs232_get_byte 1329 rcall comm_write_get_byte
1334 movff RCREG1,opt_gas_He_ratio+2 1330 movff RCREG1,opt_gas_He_ratio+2
1335 call rs232_get_byte 1331 rcall comm_write_get_byte
1336 movff RCREG1,opt_gas_type+2 1332 movff RCREG1,opt_gas_type+2
1337 call rs232_get_byte 1333 rcall comm_write_get_byte
1338 movff RCREG1,opt_OC_bail_gas_change+2 1334 movff RCREG1,opt_OC_bail_gas_change+2
1339 bra comm_write_abort ; Done. Loop with timeout reset 1335 bra comm_write_abort ; Done. Loop with timeout reset
1340 comm_write_gas4: 1336 comm_write_gas4:
1341 call rs232_get_byte
1342 movff RCREG1,opt_gas_O2_ratio+3 1337 movff RCREG1,opt_gas_O2_ratio+3
1343 call rs232_get_byte 1338 rcall comm_write_get_byte
1344 movff RCREG1,opt_gas_He_ratio+3 1339 movff RCREG1,opt_gas_He_ratio+3
1345 call rs232_get_byte 1340 rcall comm_write_get_byte
1346 movff RCREG1,opt_gas_type+3 1341 movff RCREG1,opt_gas_type+3
1347 call rs232_get_byte 1342 rcall comm_write_get_byte
1348 movff RCREG1,opt_OC_bail_gas_change+3 1343 movff RCREG1,opt_OC_bail_gas_change+3
1349 bra comm_write_abort ; Done. Loop with timeout reset 1344 bra comm_write_abort ; Done. Loop with timeout reset
1350 comm_write_gas5: 1345 comm_write_gas5:
1351 call rs232_get_byte
1352 movff RCREG1,opt_gas_O2_ratio+4 1346 movff RCREG1,opt_gas_O2_ratio+4
1353 call rs232_get_byte 1347 rcall comm_write_get_byte
1354 movff RCREG1,opt_gas_He_ratio+4 1348 movff RCREG1,opt_gas_He_ratio+4
1355 call rs232_get_byte 1349 rcall comm_write_get_byte
1356 movff RCREG1,opt_gas_type+4 1350 movff RCREG1,opt_gas_type+4
1357 call rs232_get_byte 1351 rcall comm_write_get_byte
1358 movff RCREG1,opt_OC_bail_gas_change+4 1352 movff RCREG1,opt_OC_bail_gas_change+4
1359 bra comm_write_abort ; Done. Loop with timeout reset 1353 bra comm_write_abort ; Done. Loop with timeout reset
1360 1354
1361 comm_write_dil1: 1355 comm_write_dil1:
1362 call rs232_get_byte
1363 movff RCREG1,opt_dil_O2_ratio+0 1356 movff RCREG1,opt_dil_O2_ratio+0
1364 call rs232_get_byte 1357 rcall comm_write_get_byte
1365 movff RCREG1,opt_dil_He_ratio+0 1358 movff RCREG1,opt_dil_He_ratio+0
1366 call rs232_get_byte 1359 rcall comm_write_get_byte
1367 movff RCREG1,opt_dil_type+0 1360 movff RCREG1,opt_dil_type+0
1368 call rs232_get_byte 1361 rcall comm_write_get_byte
1369 movff RCREG1,char_I_dil_change+0 1362 movff RCREG1,char_I_dil_change+0
1370 bra comm_write_abort ; Done. Loop with timeout reset 1363 bra comm_write_abort ; Done. Loop with timeout reset
1371 comm_write_dil2: 1364 comm_write_dil2:
1372 call rs232_get_byte
1373 movff RCREG1,opt_dil_O2_ratio+1 1365 movff RCREG1,opt_dil_O2_ratio+1
1374 call rs232_get_byte 1366 rcall comm_write_get_byte
1375 movff RCREG1,opt_dil_He_ratio+1 1367 movff RCREG1,opt_dil_He_ratio+1
1376 call rs232_get_byte 1368 rcall comm_write_get_byte
1377 movff RCREG1,opt_dil_type+1 1369 movff RCREG1,opt_dil_type+1
1378 call rs232_get_byte 1370 rcall comm_write_get_byte
1379 movff RCREG1,char_I_dil_change+1 1371 movff RCREG1,char_I_dil_change+1
1380 bra comm_write_abort ; Done. Loop with timeout reset 1372 bra comm_write_abort ; Done. Loop with timeout reset
1381 comm_write_dil3: 1373 comm_write_dil3:
1382 call rs232_get_byte
1383 movff RCREG1,opt_dil_O2_ratio+2 1374 movff RCREG1,opt_dil_O2_ratio+2
1384 call rs232_get_byte 1375 rcall comm_write_get_byte
1385 movff RCREG1,opt_dil_He_ratio+2 1376 movff RCREG1,opt_dil_He_ratio+2
1386 call rs232_get_byte 1377 rcall comm_write_get_byte
1387 movff RCREG1,opt_dil_type+2 1378 movff RCREG1,opt_dil_type+2
1388 call rs232_get_byte 1379 rcall comm_write_get_byte
1389 movff RCREG1,char_I_dil_change+2 1380 movff RCREG1,char_I_dil_change+2
1390 bra comm_write_abort ; Done. Loop with timeout reset 1381 bra comm_write_abort ; Done. Loop with timeout reset
1391 comm_write_dil4: 1382 comm_write_dil4:
1392 call rs232_get_byte
1393 movff RCREG1,opt_dil_O2_ratio+3 1383 movff RCREG1,opt_dil_O2_ratio+3
1394 call rs232_get_byte 1384 rcall comm_write_get_byte
1395 movff RCREG1,opt_dil_He_ratio+3 1385 movff RCREG1,opt_dil_He_ratio+3
1396 call rs232_get_byte 1386 rcall comm_write_get_byte
1397 movff RCREG1,opt_dil_type+3 1387 movff RCREG1,opt_dil_type+3
1398 call rs232_get_byte 1388 rcall comm_write_get_byte
1399 movff RCREG1,char_I_dil_change+3 1389 movff RCREG1,char_I_dil_change+3
1400 bra comm_write_abort ; Done. Loop with timeout reset 1390 bra comm_write_abort ; Done. Loop with timeout reset
1401 comm_write_dil5: 1391 comm_write_dil5:
1402 call rs232_get_byte
1403 movff RCREG1,opt_dil_O2_ratio+4 1392 movff RCREG1,opt_dil_O2_ratio+4
1404 call rs232_get_byte 1393 rcall comm_write_get_byte
1405 movff RCREG1,opt_dil_He_ratio+4 1394 movff RCREG1,opt_dil_He_ratio+4
1406 call rs232_get_byte 1395 rcall comm_write_get_byte
1407 movff RCREG1,opt_dil_type+4 1396 movff RCREG1,opt_dil_type+4
1408 call rs232_get_byte 1397 rcall comm_write_get_byte
1409 movff RCREG1,char_I_dil_change+4 1398 movff RCREG1,char_I_dil_change+4
1410 bra comm_write_abort ; Done. Loop with timeout reset 1399 bra comm_write_abort ; Done. Loop with timeout reset
1411 1400
1412 comm_write_sp1: 1401 comm_write_sp1:
1413 call rs232_get_byte
1414 movff RCREG1,char_I_setpoint_cbar+0 1402 movff RCREG1,char_I_setpoint_cbar+0
1415 call rs232_get_byte 1403 rcall comm_write_get_byte
1416 movff RCREG1,char_I_setpoint_change+0 1404 movff RCREG1,char_I_setpoint_change+0
1417 bra comm_write_abort ; Done. Loop with timeout reset 1405 bra comm_write_abort ; Done. Loop with timeout reset
1418 comm_write_sp2: 1406 comm_write_sp2:
1419 call rs232_get_byte
1420 movff RCREG1,char_I_setpoint_cbar+1 1407 movff RCREG1,char_I_setpoint_cbar+1
1421 call rs232_get_byte 1408 rcall comm_write_get_byte
1422 movff RCREG1,char_I_setpoint_change+1 1409 movff RCREG1,char_I_setpoint_change+1
1423 bra comm_write_abort ; Done. Loop with timeout reset 1410 bra comm_write_abort ; Done. Loop with timeout reset
1424 comm_write_sp3: 1411 comm_write_sp3:
1425 call rs232_get_byte
1426 movff RCREG1,char_I_setpoint_cbar+2 1412 movff RCREG1,char_I_setpoint_cbar+2
1427 call rs232_get_byte 1413 rcall comm_write_get_byte
1428 movff RCREG1,char_I_setpoint_change+2 1414 movff RCREG1,char_I_setpoint_change+2
1429 bra comm_write_abort ; Done. Loop with timeout reset 1415 bra comm_write_abort ; Done. Loop with timeout reset
1430 comm_write_sp4: 1416 comm_write_sp4:
1431 call rs232_get_byte
1432 movff RCREG1,char_I_setpoint_cbar+3 1417 movff RCREG1,char_I_setpoint_cbar+3
1433 call rs232_get_byte 1418 rcall comm_write_get_byte
1434 movff RCREG1,char_I_setpoint_change+3 1419 movff RCREG1,char_I_setpoint_change+3
1435 bra comm_write_abort ; Done. Loop with timeout reset 1420 bra comm_write_abort ; Done. Loop with timeout reset
1436 comm_write_sp5: 1421 comm_write_sp5:
1437 call rs232_get_byte
1438 movff RCREG1,char_I_setpoint_cbar+4 1422 movff RCREG1,char_I_setpoint_cbar+4
1439 call rs232_get_byte 1423 rcall comm_write_get_byte
1440 movff RCREG1,char_I_setpoint_change+4 1424 movff RCREG1,char_I_setpoint_change+4
1441 bra comm_write_abort ; Done. Loop with timeout reset 1425 bra comm_write_abort ; Done. Loop with timeout reset
1442 1426
1443 comm_write_ccr_mode: 1427 comm_write_ccr_mode:
1444 call rs232_get_byte
1445 movff RCREG1, opt_ccr_mode 1428 movff RCREG1, opt_ccr_mode
1446 bra comm_write_abort ; Done. Loop with timeout reset 1429 bra comm_write_abort ; Done. Loop with timeout reset
1447 comm_write_dive_mode: 1430 comm_write_dive_mode:
1448 call rs232_get_byte
1449 movff RCREG1, opt_dive_mode 1431 movff RCREG1, opt_dive_mode
1450 bra comm_write_abort ; Done. Loop with timeout reset 1432 bra comm_write_abort ; Done. Loop with timeout reset
1451 comm_write_decotype: 1433 comm_write_decotype:
1452 call rs232_get_byte
1453 movff RCREG1, char_I_deco_model 1434 movff RCREG1, char_I_deco_model
1454 bra comm_write_abort ; Done. Loop with timeout reset 1435 bra comm_write_abort ; Done. Loop with timeout reset
1455 comm_write_ppo2_max: 1436 comm_write_ppo2_max:
1456 call rs232_get_byte
1457 movff RCREG1, opt_ppO2_max 1437 movff RCREG1, opt_ppO2_max
1458 bra comm_write_abort ; Done. Loop with timeout reset 1438 bra comm_write_abort ; Done. Loop with timeout reset
1459 comm_write_ppo2_min: 1439 comm_write_ppo2_min:
1460 call rs232_get_byte
1461 movff RCREG1, opt_ppO2_min 1440 movff RCREG1, opt_ppO2_min
1462 bra comm_write_abort ; Done. Loop with timeout reset 1441 bra comm_write_abort ; Done. Loop with timeout reset
1463 comm_write_ftts: 1442 comm_write_ftts:
1464 call rs232_get_byte
1465 movff RCREG1, char_I_extra_time 1443 movff RCREG1, char_I_extra_time
1466 bra comm_write_abort ; Done. Loop with timeout reset 1444 bra comm_write_abort ; Done. Loop with timeout reset
1467 comm_write_gf_low: 1445 comm_write_gf_low:
1468 call rs232_get_byte
1469 movff RCREG1, opt_GF_low 1446 movff RCREG1, opt_GF_low
1470 bra comm_write_abort ; Done. Loop with timeout reset 1447 bra comm_write_abort ; Done. Loop with timeout reset
1471 comm_write_gf_high: 1448 comm_write_gf_high:
1472 call rs232_get_byte
1473 movff RCREG1, opt_GF_high 1449 movff RCREG1, opt_GF_high
1474 bra comm_write_abort ; Done. Loop with timeout reset 1450 bra comm_write_abort ; Done. Loop with timeout reset
1475 comm_write_agf_low: 1451 comm_write_agf_low:
1476 call rs232_get_byte
1477 movff RCREG1, opt_aGF_low 1452 movff RCREG1, opt_aGF_low
1478 bra comm_write_abort ; Done. Loop with timeout reset 1453 bra comm_write_abort ; Done. Loop with timeout reset
1479 comm_write_agf_high: 1454 comm_write_agf_high:
1480 call rs232_get_byte
1481 movff RCREG1, opt_aGF_high 1455 movff RCREG1, opt_aGF_high
1482 bra comm_write_abort ; Done. Loop with timeout reset 1456 bra comm_write_abort ; Done. Loop with timeout reset
1483 comm_write_agf_selectable: 1457 comm_write_agf_selectable:
1484 call rs232_get_byte
1485 movff RCREG1, opt_enable_aGF 1458 movff RCREG1, opt_enable_aGF
1486 bra comm_write_abort ; Done. Loop with timeout reset 1459 bra comm_write_abort ; Done. Loop with timeout reset
1487 comm_write_saturation: 1460 comm_write_saturation:
1488 call rs232_get_byte
1489 movff RCREG1, char_I_saturation_multiplier 1461 movff RCREG1, char_I_saturation_multiplier
1490 bra comm_write_abort ; Done. Loop with timeout reset 1462 bra comm_write_abort ; Done. Loop with timeout reset
1491 comm_write_desaturation: 1463 comm_write_desaturation:
1492 call rs232_get_byte
1493 movff RCREG1, char_I_desaturation_multiplier 1464 movff RCREG1, char_I_desaturation_multiplier
1494 bra comm_write_abort ; Done. Loop with timeout reset 1465 bra comm_write_abort ; Done. Loop with timeout reset
1495 comm_write_last_deco: 1466 comm_write_last_deco:
1496 call rs232_get_byte
1497 movff RCREG1, opt_last_stop 1467 movff RCREG1, opt_last_stop
1498 bra comm_write_abort ; Done. Loop with timeout reset 1468 bra comm_write_abort ; Done. Loop with timeout reset
1499 comm_write_brightness: 1469 comm_write_brightness:
1500 call rs232_get_byte
1501 movff RCREG1, opt_brightness 1470 movff RCREG1, opt_brightness
1502 bra comm_write_abort ; Done. Loop with timeout reset 1471 bra comm_write_abort ; Done. Loop with timeout reset
1503 comm_write_units: 1472 comm_write_units:
1504 call rs232_get_byte
1505 movff RCREG1, opt_units 1473 movff RCREG1, opt_units
1506 bra comm_write_abort ; Done. Loop with timeout reset 1474 bra comm_write_abort ; Done. Loop with timeout reset
1507 comm_write_samplingrate: 1475 comm_write_samplingrate:
1508 call rs232_get_byte
1509 movff RCREG1, opt_sampling_rate 1476 movff RCREG1, opt_sampling_rate
1510 bra comm_write_abort ; Done. Loop with timeout reset 1477 bra comm_write_abort ; Done. Loop with timeout reset
1511 comm_write_salinity: 1478 comm_write_salinity:
1512 call rs232_get_byte
1513 movff RCREG1, opt_salinity 1479 movff RCREG1, opt_salinity
1514 bra comm_write_abort ; Done. Loop with timeout reset 1480 bra comm_write_abort ; Done. Loop with timeout reset
1515 comm_write_divemode_colour: 1481 comm_write_divemode_colour:
1516 call rs232_get_byte
1517 movff RCREG1, opt_dive_color_scheme 1482 movff RCREG1, opt_dive_color_scheme
1518 bra comm_write_abort ; Done. Loop with timeout reset 1483 bra comm_write_abort ; Done. Loop with timeout reset
1519 comm_write_language: 1484 comm_write_language:
1520 call rs232_get_byte
1521 movff RCREG1, opt_language 1485 movff RCREG1, opt_language
1522 bra comm_write_abort ; Done. Loop with timeout reset 1486 bra comm_write_abort ; Done. Loop with timeout reset
1523 comm_write_date_format: 1487 comm_write_date_format:
1524 call rs232_get_byte
1525 movff RCREG1, opt_dateformat 1488 movff RCREG1, opt_dateformat
1526 bra comm_write_abort ; Done. Loop with timeout reset 1489 bra comm_write_abort ; Done. Loop with timeout reset
1527 comm_write_compass_gain: 1490 comm_write_compass_gain:
1528 call rs232_get_byte
1529 movff RCREG1, opt_compass_gain 1491 movff RCREG1, opt_compass_gain
1530 bra comm_write_abort ; Done. Loop with timeout reset 1492 bra comm_write_abort ; Done. Loop with timeout reset
1531 comm_write_pressure_adjust: 1493 comm_write_pressure_adjust:
1532 call rs232_get_byte
1533 movff RCREG1, opt_pressure_adjust 1494 movff RCREG1, opt_pressure_adjust
1534 bra comm_write_abort ; Done. Loop with timeout reset 1495 bra comm_write_abort ; Done. Loop with timeout reset
1535 comm_write_safety_stop: 1496 comm_write_safety_stop:
1536 call rs232_get_byte
1537 movff RCREG1, opt_enable_safetystop 1497 movff RCREG1, opt_enable_safetystop
1498 bra comm_write_abort ; Done. Loop with timeout reset
1499 comm_write_calibration_gas:
1500 movff RCREG1, opt_calibration_O2_ratio
1501 bra comm_write_abort ; Done. Loop with timeout reset
1502 comm_write_fallback:
1503 movff RCREG1, opt_sensor_fallback
1504 bra comm_write_abort ; Done. Loop with timeout reset
1505 comm_write_flip_screen:
1506 movff RCREG1, opt_flip_screen
1538 bra comm_write_abort ; Done. Loop with timeout reset 1507 bra comm_write_abort ; Done. Loop with timeout reset
1539 1508
1540 ;----------------------------------------------------------------------------- 1509 ;-----------------------------------------------------------------------------
1541 1510
1542 comm_send_string: 1511 comm_send_string: