Mercurial > public > hwos_code
comparison src/comm.asm @ 238:49512af55afc
cleanup
author | heinrichsweikamp |
---|---|
date | Sun, 01 Mar 2015 13:06:17 +0100 |
parents | 23311219dacc |
children | df8beb913ade |
comparison
equal
deleted
inserted
replaced
237:d730302fae75 | 238:49512af55afc |
---|---|
835 bra comm_send_dive_profile | 835 bra comm_send_dive_profile |
836 movff convert_value_temp+2,WREG | 836 movff convert_value_temp+2,WREG |
837 cpfseq ext_flash_address+2 | 837 cpfseq ext_flash_address+2 |
838 bra comm_send_dive_profile | 838 bra comm_send_dive_profile |
839 | 839 |
840 call rs232_wait_tx ; Wait for UART | 840 rcall comm_read_setting_wait ; Wait for UART |
841 bra comm_download_mode0 ; Done. Loop with timeout reset | 841 bra comm_download_mode0 ; Done. Loop with timeout reset |
842 | 842 |
843 ;----------------------------------------------------------------------------- | 843 ;----------------------------------------------------------------------------- |
844 | |
845 comm_read_unused: | |
846 bra comm_download_mode0 ; Done. Loop with timeout reset | |
847 | 844 |
848 comm_read_setting: | 845 comm_read_setting: |
849 movlw "r" | 846 movlw "r" |
850 movwf TXREG1 | 847 movwf TXREG1 |
851 call rs232_get_byte | 848 call rs232_get_byte |
852 btfsc rs232_recieve_overflow ; Got byte? | 849 btfsc rs232_recieve_overflow ; Got byte? |
853 bra comm_read_abort ; No, abort! | 850 bra comm_read_abort ; No, abort! |
854 call rs232_wait_tx ; Wait for UART | 851 rcall comm_read_setting_wait ; Wait for UART |
855 movf RCREG1,W ; Copy | 852 movlw 0x0F |
856 bz comm_read_unused ; RCREG1=0x00 | 853 cpfsgt RCREG1 ; 0x00-0x0F: unused |
857 dcfsnz WREG | 854 bra comm_read_abort ; abort! |
858 bra comm_read_unused ; RCREG1=0x01 | 855 subwf RCREG1,W ; Subtract unused commands |
859 dcfsnz WREG | |
860 bra comm_read_unused ; RCREG1=0x02 | |
861 dcfsnz WREG | |
862 bra comm_read_unused ; RCREG1=0x03 | |
863 dcfsnz WREG | |
864 bra comm_read_unused ; RCREG1=0x04 | |
865 dcfsnz WREG | |
866 bra comm_read_unused ; RCREG1=0x05 | |
867 dcfsnz WREG | |
868 bra comm_read_unused ; RCREG1=0x06 | |
869 dcfsnz WREG | |
870 bra comm_read_unused ; RCREG1=0x07 | |
871 dcfsnz WREG | |
872 bra comm_read_unused ; RCREG1=0x08 | |
873 dcfsnz WREG | |
874 bra comm_read_unused ; RCREG1=0x09 | |
875 dcfsnz WREG | |
876 bra comm_read_unused ; RCREG1=0x0A | |
877 dcfsnz WREG | |
878 bra comm_read_unused ; RCREG1=0x0B | |
879 dcfsnz WREG | |
880 bra comm_read_unused ; RCREG1=0x0C | |
881 dcfsnz WREG | |
882 bra comm_read_unused ; RCREG1=0x0D | |
883 dcfsnz WREG | |
884 bra comm_read_unused ; RCREG1=0x0E | |
885 dcfsnz WREG | |
886 bra comm_read_unused ; RCREG1=0x0F | |
887 dcfsnz WREG | 856 dcfsnz WREG |
888 bra comm_read_gas1 ; RCREG1=0x10 | 857 bra comm_read_gas1 ; RCREG1=0x10 |
889 dcfsnz WREG | 858 dcfsnz WREG |
890 bra comm_read_gas2 ; RCREG1=0x11 | 859 bra comm_read_gas2 ; RCREG1=0x11 |
891 dcfsnz WREG | 860 dcfsnz WREG |
979 comm_read_setting_wait: | 948 comm_read_setting_wait: |
980 call rs232_wait_tx ; Wait for UART | 949 call rs232_wait_tx ; Wait for UART |
981 return | 950 return |
982 | 951 |
983 comm_read_done: | 952 comm_read_done: |
984 call rs232_wait_tx ; Wait for UART | 953 rcall comm_read_setting_wait ; Wait for UART |
985 bra comm_download_mode0 ; Done. Loop with timeout reset | 954 bra comm_download_mode0 ; Done. Loop with timeout reset |
986 | 955 |
987 comm_read_gas1: | 956 comm_read_gas1: |
988 movff opt_gas_O2_ratio+0, TXREG1 | 957 movff opt_gas_O2_ratio+0, TXREG1 |
989 rcall comm_read_setting_wait ; Wait for UART | 958 rcall comm_read_setting_wait ; Wait for UART |
1102 movff char_I_setpoint_change+4, TXREG1 | 1071 movff char_I_setpoint_change+4, TXREG1 |
1103 bra comm_read_done ; Done. Wait for UART and loop with timeout reset | 1072 bra comm_read_done ; Done. Wait for UART and loop with timeout reset |
1104 | 1073 |
1105 | 1074 |
1106 ;----------------------------------------------------------------------------- | 1075 ;----------------------------------------------------------------------------- |
1107 | 1076 comm_write_gas1: |
1108 comm_write_unused: | 1077 movff RCREG1,opt_gas_O2_ratio+0 |
1109 goto comm_write_abort | 1078 rcall comm_write_get_byte |
1079 movff RCREG1,opt_gas_He_ratio+0 | |
1080 rcall comm_write_get_byte | |
1081 movff RCREG1,opt_gas_type+0 | |
1082 rcall comm_write_get_byte | |
1083 movff RCREG1,opt_OC_bail_gas_change+0 | |
1084 bra comm_write_abort ; Done. Loop with timeout reset | |
1085 comm_write_gas2: | |
1086 movff RCREG1,opt_gas_O2_ratio+1 | |
1087 rcall comm_write_get_byte | |
1088 movff RCREG1,opt_gas_He_ratio+1 | |
1089 rcall comm_write_get_byte | |
1090 movff RCREG1,opt_gas_type+1 | |
1091 rcall comm_write_get_byte | |
1092 movff RCREG1,opt_OC_bail_gas_change+1 | |
1093 bra comm_write_abort ; Done. Loop with timeout reset | |
1094 comm_write_gas3: | |
1095 movff RCREG1,opt_gas_O2_ratio+2 | |
1096 rcall comm_write_get_byte | |
1097 movff RCREG1,opt_gas_He_ratio+2 | |
1098 rcall comm_write_get_byte | |
1099 movff RCREG1,opt_gas_type+2 | |
1100 rcall comm_write_get_byte | |
1101 movff RCREG1,opt_OC_bail_gas_change+2 | |
1102 bra comm_write_abort ; Done. Loop with timeout reset | |
1103 comm_write_gas4: | |
1104 movff RCREG1,opt_gas_O2_ratio+3 | |
1105 rcall comm_write_get_byte | |
1106 movff RCREG1,opt_gas_He_ratio+3 | |
1107 rcall comm_write_get_byte | |
1108 movff RCREG1,opt_gas_type+3 | |
1109 rcall comm_write_get_byte | |
1110 movff RCREG1,opt_OC_bail_gas_change+3 | |
1111 bra comm_write_abort ; Done. Loop with timeout reset | |
1112 comm_write_gas5: | |
1113 movff RCREG1,opt_gas_O2_ratio+4 | |
1114 rcall comm_write_get_byte | |
1115 movff RCREG1,opt_gas_He_ratio+4 | |
1116 rcall comm_write_get_byte | |
1117 movff RCREG1,opt_gas_type+4 | |
1118 rcall comm_write_get_byte | |
1119 movff RCREG1,opt_OC_bail_gas_change+4 | |
1120 bra comm_write_abort ; Done. Loop with timeout reset | |
1121 | |
1110 | 1122 |
1111 comm_write_setting: | 1123 comm_write_setting: |
1112 movlw "w" | 1124 movlw "w" |
1113 movwf TXREG1 | 1125 movwf TXREG1 |
1114 rcall comm_write_get_byte ; "Byte 2" | 1126 rcall comm_write_get_byte ; "Byte 2" |
1115 btfsc rs232_recieve_overflow ; Got byte? | 1127 btfsc rs232_recieve_overflow ; Got byte? |
1116 bra comm_write_abort ; No, abort! | 1128 bra comm_write_abort ; No, abort! |
1117 movff RCREG1,temp1 ; Copy | 1129 movff RCREG1,temp1 ; Copy |
1118 rcall comm_write_get_byte ; "Byte 3" | 1130 rcall comm_write_get_byte ; "Byte 3" |
1119 call rs232_wait_tx ; Wait for UART | 1131 rcall comm_read_setting_wait ; Wait for UART |
1120 movf temp1,W | 1132 movlw 0x0F |
1121 bz comm_write_unused ; RCREG1=0x00 | 1133 cpfsgt temp1 ; 0x00-0x0F: unused |
1122 dcfsnz WREG | 1134 bra comm_write_abort ; abort! |
1123 bra comm_write_unused ; RCREG1=0x01 | 1135 subwf temp1,W ; Subtract unused commands |
1124 dcfsnz WREG | |
1125 bra comm_write_unused ; RCREG1=0x02 | |
1126 dcfsnz WREG | |
1127 bra comm_write_unused ; RCREG1=0x03 | |
1128 dcfsnz WREG | |
1129 bra comm_write_unused ; RCREG1=0x04 | |
1130 dcfsnz WREG | |
1131 bra comm_write_unused ; RCREG1=0x05 | |
1132 dcfsnz WREG | |
1133 bra comm_write_unused ; RCREG1=0x06 | |
1134 dcfsnz WREG | |
1135 bra comm_write_unused ; RCREG1=0x07 | |
1136 dcfsnz WREG | |
1137 bra comm_write_unused ; RCREG1=0x08 | |
1138 dcfsnz WREG | |
1139 bra comm_write_unused ; RCREG1=0x09 | |
1140 dcfsnz WREG | |
1141 bra comm_write_unused ; RCREG1=0x0A | |
1142 dcfsnz WREG | |
1143 bra comm_write_unused ; RCREG1=0x0B | |
1144 dcfsnz WREG | |
1145 bra comm_write_unused ; RCREG1=0x0C | |
1146 dcfsnz WREG | |
1147 bra comm_write_unused ; RCREG1=0x0D | |
1148 dcfsnz WREG | |
1149 bra comm_write_unused ; RCREG1=0x0E | |
1150 dcfsnz WREG | |
1151 bra comm_write_unused ; RCREG1=0x0F | |
1152 dcfsnz WREG | 1136 dcfsnz WREG |
1153 bra comm_write_gas1 ; RCREG1=0x10 | 1137 bra comm_write_gas1 ; RCREG1=0x10 |
1154 dcfsnz WREG | 1138 dcfsnz WREG |
1155 bra comm_write_gas2 ; RCREG1=0x11 | 1139 bra comm_write_gas2 ; RCREG1=0x11 |
1156 dcfsnz WREG | 1140 dcfsnz WREG |
1250 bra comm_download_mode0 ; Done. Loop with timeout reset | 1234 bra comm_download_mode0 ; Done. Loop with timeout reset |
1251 | 1235 |
1252 comm_write_get_byte: | 1236 comm_write_get_byte: |
1253 call rs232_get_byte | 1237 call rs232_get_byte |
1254 return | 1238 return |
1255 | |
1256 comm_write_gas1: | |
1257 movff RCREG1,opt_gas_O2_ratio+0 | |
1258 rcall comm_write_get_byte | |
1259 movff RCREG1,opt_gas_He_ratio+0 | |
1260 rcall comm_write_get_byte | |
1261 movff RCREG1,opt_gas_type+0 | |
1262 rcall comm_write_get_byte | |
1263 movff RCREG1,opt_OC_bail_gas_change+0 | |
1264 bra comm_write_abort ; Done. Loop with timeout reset | |
1265 comm_write_gas2: | |
1266 movff RCREG1,opt_gas_O2_ratio+1 | |
1267 rcall comm_write_get_byte | |
1268 movff RCREG1,opt_gas_He_ratio+1 | |
1269 rcall comm_write_get_byte | |
1270 movff RCREG1,opt_gas_type+1 | |
1271 rcall comm_write_get_byte | |
1272 movff RCREG1,opt_OC_bail_gas_change+1 | |
1273 bra comm_write_abort ; Done. Loop with timeout reset | |
1274 comm_write_gas3: | |
1275 movff RCREG1,opt_gas_O2_ratio+2 | |
1276 rcall comm_write_get_byte | |
1277 movff RCREG1,opt_gas_He_ratio+2 | |
1278 rcall comm_write_get_byte | |
1279 movff RCREG1,opt_gas_type+2 | |
1280 rcall comm_write_get_byte | |
1281 movff RCREG1,opt_OC_bail_gas_change+2 | |
1282 bra comm_write_abort ; Done. Loop with timeout reset | |
1283 comm_write_gas4: | |
1284 movff RCREG1,opt_gas_O2_ratio+3 | |
1285 rcall comm_write_get_byte | |
1286 movff RCREG1,opt_gas_He_ratio+3 | |
1287 rcall comm_write_get_byte | |
1288 movff RCREG1,opt_gas_type+3 | |
1289 rcall comm_write_get_byte | |
1290 movff RCREG1,opt_OC_bail_gas_change+3 | |
1291 bra comm_write_abort ; Done. Loop with timeout reset | |
1292 comm_write_gas5: | |
1293 movff RCREG1,opt_gas_O2_ratio+4 | |
1294 rcall comm_write_get_byte | |
1295 movff RCREG1,opt_gas_He_ratio+4 | |
1296 rcall comm_write_get_byte | |
1297 movff RCREG1,opt_gas_type+4 | |
1298 rcall comm_write_get_byte | |
1299 movff RCREG1,opt_OC_bail_gas_change+4 | |
1300 bra comm_write_abort ; Done. Loop with timeout reset | |
1301 | 1239 |
1302 comm_write_dil1: | 1240 comm_write_dil1: |
1303 movff RCREG1,opt_dil_O2_ratio+0 | 1241 movff RCREG1,opt_dil_O2_ratio+0 |
1304 rcall comm_write_get_byte | 1242 rcall comm_write_get_byte |
1305 movff RCREG1,opt_dil_He_ratio+0 | 1243 movff RCREG1,opt_dil_He_ratio+0 |