comparison code_part1/OSTC_code_asm_part1/menu_gassetup.asm @ 272:9657a7bcc7e1

inactive gases with change depth>0 ignored
author heinrichsweikamp
date Wed, 13 Apr 2011 08:35:46 +0200
parents 8dbcc26878d3
children f8f865c70a0d
comparison
equal deleted inserted replaced
271:5c17b2b4b9dd 272:9657a7bcc7e1
1125 ; Initialize sorting... 1125 ; Initialize sorting...
1126 bcf menubit2 ; Change Start gas only 1x 1126 bcf menubit2 ; Change Start gas only 1x
1127 movlw d'99' 1127 movlw d'99'
1128 movwf logbook_temp4 ; Last Gas change depth 1128 movwf logbook_temp4 ; Last Gas change depth
1129 1129
1130 movff letter+.25, logbook_temp5 ; Activity flags
1131
1130 ; Done. Copy Gas #logbook_temp3 into EEPROM Place Gas 5 1132 ; Done. Copy Gas #logbook_temp3 into EEPROM Place Gas 5
1131 rcall gassetup_sort_sort ; Sort! 1133 rcall gassetup_sort_sort ; Sort!
1132 movlw d'5' ; Gas 5 1134 movlw d'5' ; Gas 5
1133 movwf logbook_temp5 1135 movwf logbook_temp2
1134 rcall gassetup_sort_store 1136 rcall gassetup_sort_store
1135 1137
1136 ; Done. Copy Gas #logbook_temp3 into EEPROM Place Gas 4 1138 ; Done. Copy Gas #logbook_temp3 into EEPROM Place Gas 4
1137 rcall gassetup_sort_sort ; Sort! 1139 rcall gassetup_sort_sort ; Sort!
1138 movlw d'4' ; Gas 4 1140 movlw d'4' ; Gas 4
1139 movwf logbook_temp5 1141 movwf logbook_temp2
1140 rcall gassetup_sort_store 1142 rcall gassetup_sort_store
1141 1143
1142 ; Done. Copy Gas #logbook_temp3 into EEPROM Place Gas 3 1144 ; Done. Copy Gas #logbook_temp3 into EEPROM Place Gas 3
1143 rcall gassetup_sort_sort ; Sort! 1145 rcall gassetup_sort_sort ; Sort!
1144 movlw d'3' ; Gas 3 1146 movlw d'3' ; Gas 3
1145 movwf logbook_temp5 1147 movwf logbook_temp2
1146 rcall gassetup_sort_store 1148 rcall gassetup_sort_store
1147 1149
1148 ; Done. Copy Gas #logbook_temp3 into EEPROM Place Gas 2 1150 ; Done. Copy Gas #logbook_temp3 into EEPROM Place Gas 2
1149 rcall gassetup_sort_sort ; Sort! 1151 rcall gassetup_sort_sort ; Sort!
1150 movlw d'2' ; Gas 2 1152 movlw d'2' ; Gas 2
1151 movwf logbook_temp5 1153 movwf logbook_temp2
1152 rcall gassetup_sort_store 1154 rcall gassetup_sort_store
1153 1155
1154 ; Done. Copy Gas #logbook_temp3 into EEPROM Place Gas 1 1156 ; Done. Copy Gas #logbook_temp3 into EEPROM Place Gas 1
1155 rcall gassetup_sort_sort ; Sort! 1157 rcall gassetup_sort_sort ; Sort!
1156 movlw d'1' ; Gas 1 1158 movlw d'1' ; Gas 1
1157 movwf logbook_temp5 1159 movwf logbook_temp2
1158 bra gassetup_sort_store 1160 bra gassetup_sort_store
1159 1161
1160 ;----------------------------------------------------------------------------- 1162 ;-----------------------------------------------------------------------------
1161 gassetup_sort_sort: 1163 gassetup_sort_sort:
1162 clrf logbook_temp2 ; Tested gas (0-4) 1164 clrf logbook_temp2 ; Tested gas (0-4)
1163 clrf logbook_temp1 ; Found change depth in m 1165 clrf logbook_temp1 ; Found change depth in m
1164 clrf logbook_temp3 ; Found gas (0-4) 1166 clrf logbook_temp3 ; Found gas (0-4)
1165 movff letter+.25, logbook_temp5 ; Activity flags 1167 ; movff letter+.25, logbook_temp5 ; Activity flags
1166 1168
1167 lfsr FSR2,letter+.20 ; Change depths Gas1 1169 lfsr FSR2,letter+.20 ; Change depths Gas1
1168 gassetup_sort_gaslist2: 1170 gassetup_sort_gaslist2:
1169 movf POSTINC2,W ; Get Change depth into WREG 1171 movf POSTINC2,W ; Get Change depth into WREG
1170 1172
1174 bra gassetup_sort_gaslist3 ; Skip, tested depth < max. Depth from this run 1176 bra gassetup_sort_gaslist3 ; Skip, tested depth < max. Depth from this run
1175 1177
1176 ; Is gas active? 1178 ; Is gas active?
1177 ; Should not select inactive gas, because we might have several 1179 ; Should not select inactive gas, because we might have several
1178 ; gas with the same depth, some active, some not... 1180 ; gas with the same depth, some active, some not...
1181
1179 rrcf logbook_temp5,F ; Shift into Carry bit 1182 rrcf logbook_temp5,F ; Shift into Carry bit
1180 btfss STATUS,C ; Was Gas active? 1183 btfss STATUS,C ; Was Gas active?
1181 bra gassetup_sort_gaslist3 ; No: Skip. 1184 bra gassetup_sort_gaslist3 ; No: Skip.
1182 1185
1183 movwf logbook_temp1 ; copy new depth (current run) 1186 movwf logbook_temp1 ; copy new depth (current run)
1191 1194
1192 ; Done: 1195 ; Done:
1193 movff logbook_temp1,logbook_temp4 ; copy new depth (Store for next run) 1196 movff logbook_temp1,logbook_temp4 ; copy new depth (Store for next run)
1194 1197
1195 ; Debugger 1198 ; Debugger
1196 ;call enable_rs232
1197 ; movff logbook_temp1,TXREG
1198 ; call rs232_wait_tx ; wait for UART
1199 ; movff logbook_temp2,TXREG 1199 ; movff logbook_temp2,TXREG
1200 ; call rs232_wait_tx ; wait for UART 1200 ; call rs232_wait_tx ; wait for UART
1201 ; movff logbook_temp3,TXREG 1201 ; movff logbook_temp3,TXREG
1202 ; call rs232_wait_tx ; wait for UART 1202 ; call rs232_wait_tx ; wait for UART
1203 ; movff logbook_temp4,TXREG 1203 ; movff logbook_temp4,TXREG
1231 gassetup_sort_store2: 1231 gassetup_sort_store2:
1232 ;call enable_rs232 1232 ;call enable_rs232
1233 ;movff logbook_temp1,TXREG 1233 ;movff logbook_temp1,TXREG
1234 ;call rs232_wait_tx ; wait for UART 1234 ;call rs232_wait_tx ; wait for UART
1235 1235
1236 movf logbook_temp5,W ; Destination slot : 1-5 1236 movf logbook_temp2,W ; Destination slot : 1-5
1237 mullw d'4' 1237 mullw d'4'
1238 movff PRODL,EEADR ; Point to EEPROM of Gas #logbook_temp5 1238 movff PRODL,EEADR ; Point to EEPROM of Gas #logbook_temp5
1239 movlw d'90' ; +90 Offset to new... 1239 movlw d'90' ; +90 Offset to new...
1240 addwf EEADR,F ; ..sorted list! 1240 addwf EEADR,F ; ..sorted list!
1241 1241
1249 call write_eeprom ; store in internal EEPROM 1249 call write_eeprom ; store in internal EEPROM
1250 incf EEADR,F ; +1 1250 incf EEADR,F ; +1
1251 movff POSTINC2,EEDATA ; He Current 1251 movff POSTINC2,EEDATA ; He Current
1252 call write_eeprom ; store in internal EEPROM 1252 call write_eeprom ; store in internal EEPROM
1253 1253
1254 movf logbook_temp5,W ; Destination slot : 1-5 1254 movf logbook_temp2,W ; Destination slot : 1-5
1255 addlw d'117' 1255 addlw d'117'
1256 movwf EEADR 1256 movwf EEADR
1257 movff logbook_temp1,EEDATA ; Change depth -> EEDATA 1257 movff logbook_temp1,EEDATA ; Change depth -> EEDATA
1258 call write_eeprom ; store in internal EEPROM 1258 call write_eeprom ; store in internal EEPROM
1259 1259