📄 map_bot.lst
字号:
019B 29A1 0977 GOTO m034
019C 29AA 0978 GOTO m035
019D 1283 0979 m033 BCF 0x03,RP0
019E 1303 0980 BCF 0x03,RP1
019F 1A64 0981 BTFSC 0x64,last_encoder_2
01A0 29AA 0982 GOTO m035
0983 ; {
0984 ; encoder_low[2]++;
01A1 0AF3 0985 m034 INCF encoder_low+2,1
0986 ;
0987 ; if (encoder_low[2] == 0)
01A2 1903 0988 BTFSC 0x03,Zero_
0989 ; encoder_high[2]++;
01A3 0AF7 0990 INCF encoder_high+2,1
0991 ;
0992 ;
0993 ; last_encoder_2 = encoder_2;
01A4 1283 0994 BCF 0x03,RP0
01A5 1303 0995 BCF 0x03,RP1
01A6 1264 0996 BCF 0x64,last_encoder_2
01A7 1908 0997 BTFSC 0x08,encoder_2
01A8 1664 0998 BSF 0x64,last_encoder_2
0999 ; encoder_2_count++;
01A9 0AEC 1000 INCF encoder_2_count,1
1001 ; }
1002 ;
1003 ; if (encoder_3 != last_encoder_3)
01AA 1283 1004 m035 BCF 0x03,RP0
01AB 1303 1005 BCF 0x03,RP1
01AC 1988 1006 BTFSC 0x08,encoder_3
01AD 29B1 1007 GOTO m036
01AE 1AE4 1008 BTFSC 0x64,last_encoder_3
01AF 29B5 1009 GOTO m037
01B0 29BE 1010 GOTO m038
01B1 1283 1011 m036 BCF 0x03,RP0
01B2 1303 1012 BCF 0x03,RP1
01B3 1AE4 1013 BTFSC 0x64,last_encoder_3
01B4 29BE 1014 GOTO m038
1015 ; {
1016 ; encoder_low[3]++;
01B5 0AF4 1017 m037 INCF encoder_low+3,1
1018 ;
1019 ; if (encoder_low[3] == 0)
01B6 1903 1020 BTFSC 0x03,Zero_
CC5X Version 3.1J, File: map_bot.c 4. Sep 2006 0:09 Page 18
ADDR CODE LINE SOURCE
1021 ; encoder_high[3]++;
01B7 0AF8 1022 INCF encoder_high+3,1
1023 ;
1024 ; last_encoder_3 = encoder_3;
01B8 1283 1025 BCF 0x03,RP0
01B9 1303 1026 BCF 0x03,RP1
01BA 12E4 1027 BCF 0x64,last_encoder_3
01BB 1988 1028 BTFSC 0x08,encoder_3
01BC 16E4 1029 BSF 0x64,last_encoder_3
1030 ; encoder_3_count++;
01BD 0AED 1031 INCF encoder_3_count,1
1032 ; }
1033 ;
1034 ; pwm_cycle++;
01BE 1283 1035 m038 BCF 0x03,RP0
01BF 1303 1036 BCF 0x03,RP1
01C0 0FE0 1037 INCFSZ pwm_cycle,1
1038 ;
1039 ; // Check for cycle starts.
1040 ; // Do not set the pin if the value is zero
1041 ; if (pwm_cycle == 0 && pwm_value[0]) pwm_out_0 = 1;
01C1 29C5 1042 GOTO m039
01C2 08C9 1043 MOVF pwm_value,1
01C3 1D03 1044 BTFSS 0x03,Zero_
01C4 1486 1045 BSF 0x06,pwm_out_0
1046 ; if (pwm_cycle == 0 && pwm_value[1]) pwm_out_1 = 1;
01C5 1283 1047 m039 BCF 0x03,RP0
01C6 1303 1048 BCF 0x03,RP1
01C7 08E0 1049 MOVF pwm_cycle,1
01C8 1D03 1050 BTFSS 0x03,Zero_
01C9 29CD 1051 GOTO m040
01CA 08CA 1052 MOVF pwm_value+1,1
01CB 1D03 1053 BTFSS 0x03,Zero_
01CC 1506 1054 BSF 0x06,pwm_out_1
1055 ; if (pwm_cycle == 0 && pwm_value[2]) pwm_out_2 = 1;
01CD 1283 1056 m040 BCF 0x03,RP0
01CE 1303 1057 BCF 0x03,RP1
01CF 08E0 1058 MOVF pwm_cycle,1
01D0 1D03 1059 BTFSS 0x03,Zero_
01D1 29D5 1060 GOTO m041
01D2 08CB 1061 MOVF pwm_value+2,1
01D3 1D03 1062 BTFSS 0x03,Zero_
01D4 1686 1063 BSF 0x06,pwm_out_2
1064 ; if (pwm_cycle == 0 && pwm_value[3]) pwm_out_3 = 1;
01D5 1283 1065 m041 BCF 0x03,RP0
01D6 1303 1066 BCF 0x03,RP1
01D7 08E0 1067 MOVF pwm_cycle,1
01D8 1D03 1068 BTFSS 0x03,Zero_
01D9 29DD 1069 GOTO m042
01DA 08CC 1070 MOVF pwm_value+3,1
01DB 1D03 1071 BTFSS 0x03,Zero_
01DC 1606 1072 BSF 0x06,pwm_out_3
1073 ;
1074 ; // turn outputs off after their duty has passed
1075 ; if (pwm_cycle > pwm_value[0]) pwm_out_0 = 0;
01DD 1283 1076 m042 BCF 0x03,RP0
01DE 1303 1077 BCF 0x03,RP1
01DF 0860 1078 MOVF pwm_cycle,W
01E0 0249 1079 SUBWF pwm_value,W
01E1 1C03 1080 BTFSS 0x03,Carry
CC5X Version 3.1J, File: map_bot.c 4. Sep 2006 0:09 Page 19
ADDR CODE LINE SOURCE
01E2 1086 1081 BCF 0x06,pwm_out_0
1082 ; if (pwm_cycle > pwm_value[1]) pwm_out_1 = 0;
01E3 1283 1083 BCF 0x03,RP0
01E4 1303 1084 BCF 0x03,RP1
01E5 0860 1085 MOVF pwm_cycle,W
01E6 024A 1086 SUBWF pwm_value+1,W
01E7 1C03 1087 BTFSS 0x03,Carry
01E8 1106 1088 BCF 0x06,pwm_out_1
1089 ; if (pwm_cycle > pwm_value[2]) pwm_out_2 = 0;
01E9 1283 1090 BCF 0x03,RP0
01EA 1303 1091 BCF 0x03,RP1
01EB 0860 1092 MOVF pwm_cycle,W
01EC 024B 1093 SUBWF pwm_value+2,W
01ED 1C03 1094 BTFSS 0x03,Carry
01EE 1286 1095 BCF 0x06,pwm_out_2
1096 ; if (pwm_cycle > pwm_value[3]) pwm_out_3 = 0;
01EF 1283 1097 BCF 0x03,RP0
01F0 1303 1098 BCF 0x03,RP1
01F1 0860 1099 MOVF pwm_cycle,W
01F2 024C 1100 SUBWF pwm_value+3,W
01F3 1C03 1101 BTFSS 0x03,Carry
01F4 1206 1102 BCF 0x06,pwm_out_3
1103 ;
1104 ; // TMR2 = 0xe0; // reset timer this is about 500 hz
1105 ;
1106 ; TMR2 = 0xd0; // reset timer this is about 500 hz
01F5 30D0 1107 MOVLW .208
01F6 1283 1108 BCF 0x03,RP0
01F7 1303 1109 BCF 0x03,RP1
01F8 0091 1110 MOVWF TMR2
1111 ;
1112 ; // TMR2 = 0x20;
1113 ;
1114 ; // See if we are waiting to start the A->D
1115 ; // Also, make sure it's not already running
1116 ; if (wait_analog && !GO)
01F9 08E5 1117 MOVF wait_analog,1
01FA 1903 1118 BTFSC 0x03,Zero_
01FB 2A01 1119 GOTO m043
01FC 191F 1120 BTFSC 0x1F,GO
01FD 2A01 1121 GOTO m043
1122 ; {
1123 ; // Reduce wait count
1124 ; wait_analog--;
01FE 03E5 1125 DECF wait_analog,1
1126 ;
1127 ; // Done waiting, start the converter
1128 ; if (wait_analog == 0)
01FF 1903 1129 BTFSC 0x03,Zero_
1130 ; GO = 1;
0200 151F 1131 BSF 0x1F,GO
1132 ; }
1133 ;
1134 ; TMR2IF = 0; // clear flag
0201 1283 1135 m043 BCF 0x03,RP0
0202 1303 1136 BCF 0x03,RP1
0203 108C 1137 BCF 0x0C,TMR2IF
1138 ; }
1139 ;
1140 ; // The analog to digital converter is done
CC5X Version 3.1J, File: map_bot.c 4. Sep 2006 0:09 Page 20
ADDR CODE LINE SOURCE
1141 ; if (ADIF)
0204 1283 1142 m044 BCF 0x03,RP0
0205 1303 1143 BCF 0x03,RP1
0206 1F0C 1144 BTFSS 0x0C,ADIF
0207 2A2C 1145 GOTO m045
1146 ; {
1147 ; // Save current values
1148 ; analog_low[cur_analog] = ADRESL;
0208 304D 1149 MOVLW .77
0209 075D 1150 ADDWF cur_analog,W
020A 0084 1151 MOVWF FSR
020B 1383 1152 BCF 0x03,IRP
020C 1683 1153 BSF 0x03,RP0
020D 081E 1154 MOVF ADRESL,W
020E 0080 1155 MOVWF INDF
1156 ; analog_high[cur_analog] = ADRESH & 0x03;
020F 3055 1157 MOVLW .85
0210 1283 1158 BCF 0x03,RP0
0211 075D 1159 ADDWF cur_analog,W
0212 0084 1160 MOVWF FSR
0213 1383 1161 BCF 0x03,IRP
0214 3003 1162 MOVLW .3
0215 051E 1163 ANDWF ADRESH,W
0216 0080 1164 MOVWF INDF
1165 ;
1166 ; // Setup for next analog channel
1167 ; cur_analog++;
0217 0ADD 1168 INCF cur_analog,1
1169 ;
1170 ; // Wrap arund back to first
1171 ; if (cur_analog >= NUM_ANALOG) cur_analog = 0;
0218 3008 1172 MOVLW .8
0219 025D 1173 SUBWF cur_analog,W
021A 1803 1174 BTFSC 0x03,Carry
021B 01DD 1175 CLRF cur_analog
1176 ;
1177 ; // Create mask for new channel
1178 ; unsigned char mask = cur_analog << 3;
021C 1003 1179 BCF 0x03,Carry
021D 1283 1180 BCF 0x03,RP0
021E 1303 1181 BCF 0x03,RP1
021F 0D5D 1182 RLF cur_analog,W
0220 00A1 1183 MOVWF mask
0221 1003 1184 BCF 0x03,Carry
0222 0DA1 1185 RLF mask,1
0223 1003 1186 BCF 0x03,Carry
0224 0DA1 1187 RLF mask,1
1188 ;
1189 ; ADCON0 &= 0b.1100.0111;
0225 30C7 1190 MOVLW .199
0226 059F 1191 ANDWF ADCON0,1
1192 ; ADCON0 |= mask; // mask off channel bits, and set new channel
0227 0821 1193 MOVF mask,W
0228 049F 1194 IORWF ADCON0,1
1195 ;
1196 ; // Setup to wait to fire the go signal
1197 ; wait_analog = 200;
0229 30C8 1198 MOVLW .200
022A 00E5 1199 MOVWF wait_analog
1200 ;
CC5X Version 3.1J, File: map_bot.c 4. Sep 2006 0:09 Page 21
ADDR CODE LINE SOURCE
1201 ; ADIF = 0; // Clear flag
022B 130C 1202 BCF 0x0C,ADIF
1203 ; }
1204 ;
1205 ; int_restore_registers
022C 1283 1206 m045 BCF 0x03,RP0
022D 1303 1207 BCF 0x03,RP1
022E 0E20 1208 SWAPF svrSTATUS,W
022F 0083 1209 MOVWF STATUS
0230 0EF0 1210 SWAPF svrWREG,1
0231 0E70 1211 SWAPF svrWREG,W
1212 ;}
0232 0009 1213 RETFIE
1214 ;/* end of interrupt service routine */
1215 ;
1216 ;/**************************
1217 ;** End of interrupt Code **
1218 ;**************************/
1219 ;
1220 ;
1221 ;/***********************
1222 ;** Serial functions **
1223 ;***********************/
1224 ;
1225 ;/* Set the serial port to 9600 8N1 */
1226 ;void setup_serial(void)
1227 ;{
1228 setup_serial
1229 ;// SPBRG = 129; // divisor for 9600 baud
1230 ; SPBRG = 64; // divisor for 19200 baud
0233 3040 1231 MOVLW .64
0234 1683 1232 BSF 0x03,RP0
0235 1303 1233 BCF 0x03,RP1
0236 0099 1234 MOVWF SPBRG
1235 ;
1236 ; TXSTA = 0b.0010.0100; // transmitt enable, high speed
0237 3024 1237 MOVLW .36
0238 0098 1238 MOVWF TXSTA
1239 ; RCSTA = 0b.1001.0000; // serial enable
0239 3090 1240 MOVLW .144
023A 1283 1241 BCF 0x03,RP0
023B 0098 1242 MOVWF RCSTA
1243 ;
1244 ; char ch = RCREG; // flush buffer
023C 081A 1245 MOVF RCREG,W
023D 00A3 1246 MOVWF ch
1247 ; ch = RCREG;
023E 081A 1248 MOVF RCREG,W
023F 00A3 1249 MOVWF ch
1250 ; ch = RCREG;
0240 081A 1251 MOVF RCREG,W
0241 00A3 1252 MOVWF ch
1253 ;}
0242 0008 1254 RETURN
1255 ;/* end of setup serial */
1256 ;
1257 ;
1258 ;
1259 ;
1260 ;/*******************
CC5X Version 3.1J, File: map_bot.c 4. Sep 2006 0:09 Page 22
ADDR CODE LINE SOURCE
1261 ;** Initialization **
1262 ;*******************/
1263 ;
1264 ;/* system startup */
1265 ;void startup( void )
1266 ;{
1267 startup
1268 ; PORTA = 0; // clear ports
0243 1283 1269 BCF 0x03,RP0
0244 1303 1270 BCF 0x03,RP1
0245 0185 1271 CLRF PORTA
1272 ; PORTB = 0;
0246 0186 1273 CLRF PORTB
1274 ; PORTC = 0;
0247 0187 1275 CLRF PORTC
1276 ; PORTD = 0;
0248 0188 1277 CLRF PORTD
1278 ; PORTE = 0;
0249 0189 1279 CLRF PORTE
1280 ;
1281 ; TRISA = 0b.1111.1111; // all inputs
024A 30FF 1282 MOVLW .255
024B 1683 1283 BSF 0x03,RP0
024C 0085 1284 MOVWF TRISA
1285 ; TRISB = 0b.0000.0001; // bit 0 is digital in 2, bit 3 is led1
024D 3001 1286 MOVLW .1
024E 0086 1287 MOVWF TRISB
1288 ; TRISC = 0b.1000.0000; // bit 7 is rx
024F 3080 1289 MOVLW .128
0250 0087 1290 MOVWF TRISC
1291 ;// TRISD = 0b.1100.0000; // D6, D7 radio in, all others digital out
1292 ;
1293 ; TRISD = 0b.0000.1111; // D6, D7 radio in, all others digital out
0251 300F 1294 MOVLW .15
0252 0088 1295 MOVWF TRISD
1296 ;
1297 ; TRISE = 0b.0000.0111; // E0-E2 digital in
0253 3007 1298 MOVLW .7
0254 0089 1299 MOVWF TRISE
1300 ;
1301 ;
1302 ;// ADCON0 = 0b.1000.0001 | mask;
1303 ;
1304 ; // clear core values before interrupts are turned on
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -