MPASM 1.00 Released IRSCAN.ASM 3-11-1994 19:26:4 PAGE 1 IR SCANNER FIRMWARE LOC OBJECT CODE LINE SOURCE TEXT 0001 TITLE "IR SCANNER FIRMWARE" 0002 LIST F=INHX8M, P=16C56, R=HEX, C=120, N=42 0003 include "picreg.h" 0003 0004 ; 0005 ; 0006 ; IR Scanner firmware for the Cougar. 0007 ; Written 2/14/94 by Chuck McManis 0008 ; 0009 ; Copyright (c) 1994, Chuck McManis all rights reserved. 0010 ; 0011 ; Modification history: 0012 ; * 2/24/94 - Redesigned the UI to send serial 0013 ; collision information, detect 0014 ; reflections and to use 100Hz 0015 ; modulation on the IR LEDs. 0016 ; * 2/15/94 - added outputs on PA0 and PA1 to 0017 ; identify when the LEDs were 0018 ; broadcasting. 0019 ; 0020 ; This program is used to drive the cougar's IR scanner 0021 ; board. The board is constructed out of a PICProto 18 0022 ; board from Micro Engineering Laboratories (Colo Spgs, 0023 ; CO) and has a 2.4576Mhz crystal driving it. This gives 0024 ; the PIC a cycle time of 1.627604 uS. The Sharp IR 0025 ; detectors I used have a center frequency of 38Khz and 0026 ; the inner loops are constructed in such a way to 0027 ; generate this frequency. 0028 ; 0029 ; There are 5 LEDs on the board pointed at 270, 315, 0, 0030 ; 45, and 90 degrees (0 is straight ahead) and they are 0031 ; activated in sequence alternately from the left and 0032 ; from the right. This gives the visible LEDs in 0033 ; parallel with the IR leds a sort of "Cylon" eye 0034 ; effect. 0035 ; MPASM 1.00 Released IRSCAN.ASM 3-11-1994 19:26:4 PAGE 2 IR SCANNER FIRMWARE LOC OBJECT CODE LINE SOURCE TEXT 0036 ; Each LED is illuminated for 50 ms (or .05 seconds) 0037 ; This gives 4 complete scans every second. 0038 ; 0005 0039 LOOPCNT EQU 5 ; time for each LED = LOOPCNT * .01 00C0 0040 MAINLOOP EQU 0xC0 ; Length of time illuminated MAINLOOP * 26.04uS 0041 ; 0042 ; Data section, we're currently using 15 bytes of RAM, plus the 7 registers 0043 ; in the pic means we've used 22 out of a possible 32 locations. Still within 0044 ; the 16C54's abilities. 0045 ; 0046 ORG 0x8 ; start of "free" registers on PIC '56 0008 0001 0047 TEMP RES 1 ; Temporary register 0009 0001 0048 leds_on RES 1 ; Which LEDs are 'on' 000A 0001 0049 led_num RES 1 ; Current LED 'number' 000B 0001 0050 led_dir RES 1 ; loop counter 000C 0001 0051 cycle2 RES 1 ; loop counter 000D 0001 0052 ncycle RES 1 ; number of cycles to tranmit per LED 000E 0001 0053 det1 RES 1 ; Count for Detectors 1 and 2. 000F 0001 0054 det2 RES 1 ; Detector 2 count 0010 0001 0055 det3 RES 1 ; Detector 3 count 0011 0001 0056 detect1 RES 1 ; Detector 1 (integrator) 0012 0001 0057 detect2 RES 1 ; Detector 2 (integrator) 0013 0001 0058 detect3 RES 1 ; Detector 3 (integrator) 0014 0001 0059 collide RES 1 ; Bitmask of the detected collisions. 0015 0001 0060 dt_leds RES 1 ; Detection Indication LEDs 0016 0001 0061 near RES 1 ; Long or short range bumpers 0062 ; 0063 ; Main program space, note the lookup subroutines have to be in the 0064 ; first 256 words of ROM to function correctly as the ADDWF 2,Same 0065 ; uses 8 bit arithmetic to adjust the PC. 0066 ; 0067 ORG 0 0068 ; 0069 ; Collision Tables, indexed by LED numbers. These are 0070 ; passed the number of the LED that is illuminated (0-4) 0071 ; in W and they return the 'zone' that is indicated for MPASM 1.00 Released IRSCAN.ASM 3-11-1994 19:26:4 PAGE 3 IR SCANNER FIRMWARE LOC OBJECT CODE LINE SOURCE TEXT 0072 ; that detector/LED combination. These are combined into 0073 ; the 'collide' variable. Once complete we have a full 0074 ; mask of what is in front of us. 0075 ; 0076 0000 01E2 0077 getdet1 ADDWF 2,Same ; Computed branch 0001 0801 0078 RETLW B'00000001' ; Detector 1, LED 0 0002 0802 0079 RETLW B'00000010' ; Detector 1, LED 1 0003 0804 0080 RETLW B'00000100' ; Detector 1, LED 2 0004 0800 0081 RETLW B'00000000' ; Detector 1, LED 3 (XXX) 0005 0800 0082 RETLW B'00000000' ; Detector 1, LED 4 (XXX) 0083 0006 01E2 0084 getdet2 ADDWF 2,Same 0007 0800 0085 RETLW B'00000000' ; Detector 2, LED 0 (XXX) 0008 0804 0086 RETLW B'00000100' ; Detector 2, LED 1 0009 0808 0087 RETLW B'00001000' ; Detector 2, LED 2 000A 0810 0088 RETLW B'00010000' ; Detector 2, LED 3 000B 0800 0089 RETLW B'00000000' ; Detector 2, LED 4 (XXX) 0090 000C 01E2 0091 getdet3 ADDWF 2,Same 000D 0800 0092 RETLW B'00000000' ; Detector 3, LED 0 (XXX) 000E 0800 0093 RETLW B'00000000' ; Detector 3, LED 1 (XXX) 000F 0810 0094 RETLW B'00010000' ; Detector 3, LED 2 0010 0820 0095 RETLW B'00100000' ; Detector 3, LED 3 0011 0840 0096 RETLW B'01000000' ; Detector 3, LED 4 0012 08FF 0097 RETLW B'11111111' ; Guard against bad LED value 0013 08FF 0098 RETLW B'11111111' ; Guard against bad LED value 0014 08FF 0099 RETLW B'11111111' ; Guard against bad LED value 0100 ; 0101 ; nxtled - process Next LED to illuminate. 0102 ; 0103 ; This subroutine will advance to the next "LED" in the sequence 0104 ; (0 - 1 - 2 - 3 - 4 - 3 - 2 - 1 - 0 - 1 ...) it keeps track of 0105 ; which LED is illuminated in led_number, and the appropriate bit 0106 ; to send out in leds_on. At the end of each sweep (LEDs 0 or 4 to 0107 ; be illuminated) it updates the state of the detection indication MPASM 1.00 Released IRSCAN.ASM 3-11-1994 19:26:4 PAGE 4 IR SCANNER FIRMWARE LOC OBJECT CODE LINE SOURCE TEXT 0108 ; LEDs on the board, and if a collision has been detected it sends 0109 ; this information out and resets the collide bits. 0110 ; 0015 0403 0111 nxtled BCF STATUS,C ; Clear Carry bit 0016 060B 0112 BTFSC led_dir,0 ; Check direction, if set 0017 0A21 0113 GOTO right ; direction is to right 0018 0369 0114 RLF leds_on,Same ; Rotate next LEFT led on 0019 02AA 0115 INCF led_num ; Add 1 to LED number 001A 0789 0116 BTFSS leds_on,4 ; Did we rotate LAST LED? 001B 0800 0117 RETLW 0 ; Nope we can return 001C 050B 0118 BSF led_dir,0 ; Change the LED direction 001D 0215 0119 MOVF dt_leds,W ; Put detect LEDs into W 001E 0026 0120 MOVWF PORT_B ; And out into PORT B 001F 0CC0 0121 MOVLW MAINLOOP ; Reset LEDs preserve #0 0020 0A29 0122 GOTO doneled ; check for data and exit 0021 0329 0123 right RRF leds_on,Same ; Rotate next LED right. 0022 00EA 0124 DECF led_num ; dec the 'current LED' 0023 0709 0125 BTFSS leds_on,0 ; is this rightmost LED? 0024 0800 0126 RETLW 0 ; No so return. 0025 040B 0127 BCF led_dir,0 ; Change the direction 0026 0215 0128 MOVF dt_leds,W ; Put detect LEDs into W 0027 0026 0129 MOVWF PORT_B ; And out into PORT B 0028 0C60 0130 MOVLW 0x60 ; Reset LEDs preserve #1 0029 0135 0131 doneled IORWF dt_leds ; Store 'em 002A 0214 0132 MOVF collide,W ; Check for collision data 002B 0743 0133 BTFSS STATUS,Z ; Skip next zero 002C 0A2F 0134 GOTO sndit 002D 04F6 0135 BCF near,7 ; Reset 'near' bit 002E 0800 0136 RETLW 0 ; Else we're done. MPASM 1.00 Released IRSCAN.ASM 3-11-1994 19:26:4 PAGE 5 IR SCANNER FIRMWARE LOC OBJECT CODE LINE SOURCE TEXT 0138 ; 0139 ; sndit - send 8 bits of collision data out serially 0140 ; 0141 ; This code serializes collision data and sends it to 0142 ; the miniboard at 9600 baud. The byte is framed by one start bit 0143 ; and one stop bit. The high order bit of the 8 data bits 0144 ; is near/far flag, when set it means the obstacle is 'close' 0145 ; The lower 7 bits bits are detection data. The baud rate can 0146 ; be enhanced by shortening the delay loop. You need 104.16 uS 0147 ; per bit for 9600 baud (constant 13 decimal) or 52.083 uS for 0148 ; 19.2K baud. The other thing this code does is update the status 0149 ; of the 'near' bit which determines if the long range or short 0150 ; range scan is done. 0151 ; 002F 06F6 0152 sndit BTFSC near,7 ; Check to see if we're 0030 0A33 0153 GOTO do_snd ; already in short range mode 0031 05F6 0154 BSF near,7 ; else switch into short range 0032 0A35 0155 GOTO snd2 ; and send it 0033 0216 0156 do_snd MOVF near,W ; Get the near/far bit 0034 0134 0157 IORWF collide,Same ; store combination in collide 0035 0C0A 0158 snd2 MOVLW .10 ; get ready to send 10 bits 0036 0028 0159 MOVWF TEMP ; store it into send count 0037 0403 0160 BCF STATUS,C ; Start bit. 0161 ; 0162 ; Now send a bit. The timing in this loop is critical! 0163 ; 0038 0603 0164 sndbit BTFSC STATUS,C ; check the status of the Carry bit 0039 0A3D 0165 GOTO sndone ; send a '1' bit 003A 0465 0166 sndzero BCF PORT_A,3 ; send a '0' 003B 0000 0167 NOP ; These 2 instructions even out the cycle 003C 0A3F 0168 GOTO snddly ; ... count for different paths thru here 003D 0565 0169 sndone BSF PORT_A,3 ; send a '1' bit 003E 0A3F 0170 GOTO snddly ; cycle eater (for symmetry with one bits) 003F 0C0D 0171 snddly MOVLW .13 ; add enough cycles to get to 104.16uS 0040 002D 0172 MOVWF ncycle ; Store it in num of cycles 0041 0000 0173 s_loop NOP ; Waste 13 * 4 = 52 cycles MPASM 1.00 Released IRSCAN.ASM 3-11-1994 19:26:4 PAGE 6 IR SCANNER FIRMWARE LOC OBJECT CODE LINE SOURCE TEXT 0042 02ED 0174 DECFSZ ncycle ; See if we're done 0043 0A41 0175 GOTO s_loop ; nope, so loop 0176 ; 0177 ; Note we rotate '1' bits into collide so that when we've sent all of 0178 ; the data bits collide will contain $FF, we send an 'extra' bit (which 0179 ; will always be 1, and this is our stop bit. We could send two stop bits 0180 ; by adding 1 to TEMP above. 0181 ; 0044 0503 0182 BSF STATUS,C ; SET the carry bit 0045 0334 0183 RRF collide,Same ; rotate next bit into place b7 = 1 0046 02E8 0184 DECFSZ TEMP ; When done, skip next 0047 0A38 0185 GOTO sndbit ; loop until done 0048 0040 0186 CLRW ; clear W 0049 0034 0187 MOVWF collide ; store it into collide 004A 0800 0188 RETLW 0 MPASM 1.00 Released IRSCAN.ASM 3-11-1994 19:26:4 PAGE 7 IR SCANNER FIRMWARE LOC OBJECT CODE LINE SOURCE TEXT 0190 ; 0191 ; short is designed to take 29uS (it actually takes 0192 ; 29.44uS) when using a 2.4576Mhz clock. This generates 0193 ; an output frequency of 34Khz. This frequency 0194 ; is not as easily 'seen' by the detectors so doesn't 0195 ; extend as far out from the Cougar. 0196 ; 004B 0040 0197 short CLRW ; Clear detector values 004C 0031 0198 MOVWF detect1 004D 0032 0199 MOVWF detect2 004E 0033 0200 MOVWF detect3 004F 0CC0 0201 MOVLW MAINLOOP ; A bit longer than .005s 0050 002D 0202 MOVWF ncycle 0051 0209 0203 onshort MOVF leds_on,w ; turn ON the LED 0052 0126 0204 IORWF PORT_B,Same ; edge1 -> edge1 == 1/f 0053 0645 0205 BTFSC PORT_A,2 ; Detector 0 0054 02B1 0206 INCF detect1,Same ; Add one to the detection 0055 0625 0207 BTFSC PORT_A,1 ; Check bit 1 0056 02B2 0208 INCF detect2,Same ; Up the count if changed 0057 0000 0209 NOP ; Xtra instruction 0058 0CE0 0210 MOVLW 0xE0 ; turn LEDs off 0059 0166 0211 ANDWF PORT_B,Same ; edge2 - edge1 == 1/(f*2) 005A 0605 0212 BTFSC PORT_A,0 ; Check bit 2 and ... 005B 02B3 0213 INCF detect3,Same ; bump detector 3 if true 005C 0000 0214 NOP ; Place holders for 005D 0000 0215 NOP ; .. symmetric waveform 005E 0000 0216 NOP ; .. generation 005F 00ED 0217 DECF ncycle,Same ; Dec the number of cycles 0060 0743 0218 BTFSS STATUS,2 ; Skip if zero TRUE 0061 0A51 0219 GOTO onshort ; .. != 0 so loop. 0062 0800 0220 RETLW 0 ; Now do the 'off' cycle 0221 ; 0222 ; long is designed to take 26uS (it actually takes 0223 ; 26.04uS) when using a 2.4576Mhz clock. This gives 0224 ; the best range for the detectors. 0225 ; MPASM 1.00 Released IRSCAN.ASM 3-11-1994 19:26:4 PAGE 8 IR SCANNER FIRMWARE LOC OBJECT CODE LINE SOURCE TEXT 0063 0040 0226 long CLRW ; Clear detector values 0064 0031 0227 MOVWF detect1 0065 0032 0228 MOVWF detect2 0066 0033 0229 MOVWF detect3 0067 0CC0 0230 MOVLW MAINLOOP ; (.005 seconds of 38Khz) 0068 002D 0231 MOVWF ncycle 0069 0209 0232 onlong MOVF leds_on,w ; turn ON the LED 006A 0126 0233 IORWF PORT_B,Same ; edge1 -> edge1 == 1/f 006B 0645 0234 BTFSC PORT_A,2 ; Detector 0 006C 02B1 0235 INCF detect1,Same ; Add one to the detection 006D 0625 0236 BTFSC PORT_A,1 ; Check bit 1 006E 02B2 0237 INCF detect2,Same ; Up the count if changed 006F 0CE0 0238 MOVLW 0xE0 ; turn LEDs off 0070 0166 0239 ANDWF PORT_B,Same ; edge2 - edge1 == 1/(f*2) 0071 0605 0240 BTFSC PORT_A,0 ; Check bit 2 and 0072 02B3 0241 INCF detect3,Same ; bump detector 3 if true 0073 0000 0242 NOP ; Place holders for 0074 0000 0243 NOP ; symmetric wave form. 0075 00ED 0244 DECF ncycle,Same ; Dec # of cycles sent 0076 0743 0245 BTFSS STATUS,2 ; Skip if Zero is TRUE 0077 0A69 0246 GOTO onlong ; != 0 so loop 0078 0800 0247 RETLW 0 ; else return 0248 ; 0249 ; Main initialization code 0250 ; 0251 ; Sets up the PIC registers and initialized variables to 0252 ; their initial state. 0253 ; 0079 0C1F 0254 start MOVLW 0x1f ; OPTION value 007A 0002 0255 OPTION 007B 0CF7 0256 MOVLW 0xF7 ; RB0, RB1, and RB2 are 007C 0005 0257 TRIS PORT_A ; inputs and RB3 is out 007D 0040 0258 CLRW ; put 0 in W 007E 0006 0259 TRIS PORT_B ; Port B is all outputs. 007F 002B 0260 MOVWF led_dir ; start to the left 0080 0034 0261 MOVWF collide ; clear the collision information MPASM 1.00 Released IRSCAN.ASM 3-11-1994 19:26:4 PAGE 9 IR SCANNER FIRMWARE LOC OBJECT CODE LINE SOURCE TEXT 0081 0036 0262 MOVWF near ; clear the collision information 0082 002A 0263 MOVWF led_num ; Led number '0' 0083 0C01 0264 MOVLW 0x1 ; First LED and #1 0084 0029 0265 MOVWF leds_on ; 'contents' of PORT_B 0085 0CE0 0266 MOVLW 0xE0 ; Detect LEDs are off 0086 0026 0267 MOVWF PORT_B ; Initially 0087 0035 0268 MOVWF dt_leds ; accumulator for status 0088 0565 0269 BSF PORT_A,3 ; Set serial bit 'true' 0270 ; 0271 ; Transmit on one LED for LOOPCNT*.01 seconds and record 0272 ; detector values 0273 ; 0274 ; Assumptions: 0275 ; leds_on has the mask for the LED to be illuminated. 0276 ; led_num has the number associated with that mask. 0277 ; 0089 0040 0278 pulse CLRW ; Main loop 008A 002E 0279 MOVWF det1 ; Initially no detections. 008B 002F 0280 MOVWF det2 ; Initially no detections. 008C 0030 0281 MOVWF det3 ; Initially no detections. 008D 0031 0282 MOVWF detect1 ; clear the collision information 008E 0032 0283 MOVWF detect2 ; clear the collision information 008F 0033 0284 MOVWF detect3 ; clear the collision information 0090 0C05 0285 MOVLW LOOPCNT ; LOOPCNT .01 cycles. 0091 002C 0286 MOVWF cycle2 ; for .01 * LOOPCNT seconds "on" 0092 06F6 0287 xmit BTFSC near,7 ; Check if they are near 0093 0A96 0288 GOTO do_near 0094 0963 0289 CALL long ; Else look long 0095 0A97 0290 GOTO do_off ; continue 0096 094B 0291 do_near CALL short ; Look near 0292 ; 0293 ; Now do .005 seconds of silence (eg non-broadcasting) and check to see 0294 ; if the detectors go 'dark' indicating we are the source of the IR that 0295 ; we've seen 0296 ; 0097 0CC0 0297 do_off MOVLW MAINLOOP ; 192 cycles MPASM 1.00 Released IRSCAN.ASM 3-11-1994 19:26:4 PAGE 10 IR SCANNER FIRMWARE LOC OBJECT CODE LINE SOURCE TEXT 0098 002D 0298 MOVWF ncycle 0099 0CE0 0299 offloop MOVLW 0xE0 ; turn OFF the LED 009A 0166 0300 ANDWF PORT_B,Same ; edge1 -> edge1 == 1/f 009B 0745 0301 BTFSS PORT_A,2 ; Detector 0 009C 00F1 0302 DECF detect1,Same ; Subtract 1 009D 0725 0303 BTFSS PORT_A,1 ; Check bit 1 009E 00F2 0304 DECF detect2,Same ; Subtract 1 009F 0000 0305 NOP ; As we aren't toggling 00A0 0000 0306 NOP ; LEDs this is nop'ed out 00A1 0705 0307 BTFSS PORT_A,0 ; Check bit 2 00A2 00F3 0308 DECF detect3,Same ; Subtract 1 00A3 0000 0309 NOP ; #1 00A4 0000 0310 NOP ; #2 00A5 00ED 0311 DECF ncycle,Same ; Dec number of cycles 00A6 0743 0312 BTFSS STATUS,2 ; Is the ZERO flag set? 00A7 0A99 0313 GOTO offloop ; No, so loop back 0314 ; 0315 ; Now determine if we saw anything reflected back from the 0316 ; current LED on this 'cycle' of the 100hz modulator, we've 0317 ; integrated the value of the detector over the .01 seconds 0318 ; and if it tracked the output of the LED its value will be 0 0319 ; (192 increments + 192 decrements). To the extent that the 0320 ; value is not zero, indicates less chance that we saw 0321 ; our own beam. Thus we find the absolute value in the 0322 ; detector variable and arbitrarily use a sigma of 16 to 0323 ; check for 'nearness' to 0. That is if abs(detector) < 0324 ; sigma (16) then we consider it to have 'tracked' our 0325 ; beam. Otherwise we consider it to have not seen our 0326 ; beam. 0327 ; 00A8 06F1 0328 chk_it BTFSC detect1,7 ; compute abs(detect) 00A9 0271 0329 COMF detect1,Same ; If negative, complement 00AA 06F2 0330 BTFSC detect2,7 00AB 0272 0331 COMF detect2,Same 00AC 06F3 0332 BTFSC detect3,7 00AD 0273 0333 COMF detect3,Same MPASM 1.00 Released IRSCAN.ASM 3-11-1994 19:26:4 PAGE 11 IR SCANNER FIRMWARE LOC OBJECT CODE LINE SOURCE TEXT 00AE 0C10 0334 MOVLW 0x10 ; Our sigma value 00AF 00B1 0335 SUBWF detect1,Same ; adjust detector value 00B0 0703 0336 BTFSS STATUS,CARRY ; if value < 16 then 00B1 02AE 0337 INCF det1,Same ; One of LOOPCNT seen 00B2 00B2 0338 SUBWF detect2,Same ; Now check detector 3 00B3 0703 0339 BTFSS STATUS,CARRY ; If value < sigma then 00B4 02AF 0340 INCF det2,Same ; noted for detector 2 00B5 00B3 0341 SUBWF detect3,Same ; Check detector 3 00B6 0703 0342 BTFSS STATUS,CARRY ; If value < sigma then 00B7 02B0 0343 INCF det3,Same ; noted for Detector 3 00B8 02EC 0344 DECFSZ cycle2,Same ; Do this LOOPCNT times 00B9 0A92 0345 GOTO xmit ; Loop if not done. 0346 ; 0347 ; Now process the detection. Each det variable 0348 ; (one for each detector) has a value from 0 - LOOPCNT. If 0349 ; they saw nothing for all cycles in the group then they have 0350 ; 0 in them and if they saw signal for all of them then they 0351 ; have LOOPCNT in them. Anything else and its a 'maybe' 0352 ; 0353 ; We subtract LOOPCNT from each one and check for zero 0354 ; 0355 ; GOTO nn3 ; XXX FOR TESTING ONLY XXX 0356 ; 00BA 0C05 0357 MOVLW LOOPCNT ; Mask for detector counts 00BB 00AE 0358 SUBWF det1,Same ; Check Detector 1 00BC 0743 0359 BTFSS STATUS,Z ; Process this one if zero set 00BD 0AC3 0360 GOTO nn1 ; else go try the next on 00BE 04B5 0361 BCF dt_leds,5 ; Turn ON LED and 00BF 020A 0362 MOVF led_num,W ; Put LED number in W 00C0 0900 0363 CALL getdet1 ; Get appropriate bit mask 00C1 0134 0364 IORWF collide,Same ; Or it into the collision mask 00C2 0C05 0365 MOVLW LOOPCNT ; Get the loop count back 00C3 00AF 0366 nn1 SUBWF det2,Same ; Now do detector 2 00C4 0743 0367 BTFSS STATUS,Z ; If its zero, process it 00C5 0ACB 0368 GOTO nn2 ; Else continue 00C6 04D5 0369 BCF dt_leds,6 ; Turn ON LED MPASM 1.00 Released IRSCAN.ASM 3-11-1994 19:26:4 PAGE 12 IR SCANNER FIRMWARE LOC OBJECT CODE LINE SOURCE TEXT 00C7 020A 0370 MOVF led_num,W ; Get LED # in W 00C8 0906 0371 CALL getdet2 ; Get bits for detector 2 00C9 0134 0372 IORWF collide,Same ; Or them into mask 00CA 0C05 0373 MOVLW LOOPCNT ; Restore Loop count 00CB 00B0 0374 nn2 SUBWF det3,Same ; Now try Detector 3 00CC 0743 0375 BTFSS STATUS,Z ; Skip if zero, ie process it 00CD 0AD2 0376 GOTO nn3 ; Else continue on. 00CE 04F5 0377 BCF dt_leds,7 ; Else we turn on LED 00CF 020A 0378 MOVF led_num,W ; Get LED number into W 00D0 090C 0379 CALL getdet3 ; Get detector 3 value 00D1 0134 0380 IORWF collide,Same ; And put it into collide 0381 ; 0382 ; Get the next LED in the sequence, this code uses the 0383 ; led_dir variable to determine which way the LEDs 0384 ; illuminate. If collide is non-zero and we're going 0385 ; to start back (we are at the end of a scan) then 0386 ; we send the collision data to the Cougar and reset 0387 ; the variable 0388 ; 00D2 0915 0389 nn3 CALL nxtled 00D3 0A89 0390 GOTO pulse 0391 ; 0392 ; Reset Vector 0393 ; 0394 org PIC56 ; reset vector 03FF 0A79 0395 GOTO start 0396 ; 0397 END 0398 0399 MPASM 1.00 Released IRSCAN.ASM 3-11-1994 19:26:4 PAGE 13 IR SCANNER FIRMWARE SYMBOL TABLE LABEL VALUE ADCON0 0008 ADCON1 0088 ADCS0 0006 ADCS1 0007 ADIE 0006 ADIF 0001 ADON 0000 ADRES 0009 C 0000 CARRY 0000 CHS0 0003 CHS1 0004 DC 0001 DCARRY 0001 FALSE 0000 FSR 0004 GIE 0007 GO 0002 INTCON 000B INTE 0004 INTF 0001 IRP 0007 LOOPCNT 0005 LSB 0000 MAINLOOP 00C0 MSB 0007 NO 0000 PA0 0005 PA1 0006 PA2 0007 PC 0002 PCFG0 0000 PCFG1 0001 PCLATH 000A PD 0003 MPASM 1.00 Released IRSCAN.ASM 3-11-1994 19:26:4 PAGE 14 IR SCANNER FIRMWARE SYMBOL TABLE - Continued LABEL VALUE PIC54 01FF PIC55 01FF PIC56 03FF PIC57 07FF PIC71 0000 PORT_A 0005 PORT_B 0006 PORT_C 0007 P_DOWN 0003 RBIE 0003 RBIF 0000 RP0 0005 RP1 0006 RTCC 0001 RTIE 0005 RTIF 0002 STATUS 0003 Same 0001 TEMP 0008 TO 0004 TRISA 0085 TRISB 0086 TRUE 0001 T_OUT 0004 YES 0001 Z 0002 Z_bit 0002 chk_it 00A8 collide 0014 cycle2 000C det1 000E det2 000F det3 0010 detect1 0011 detect2 0012 MPASM 1.00 Released IRSCAN.ASM 3-11-1994 19:26:4 PAGE 15 IR SCANNER FIRMWARE SYMBOL TABLE - Continued LABEL VALUE detect3 0013 do_near 0096 do_off 0097 do_snd 0033 doneled 0029 dt_leds 0015 getdet1 0000 getdet2 0006 getdet3 000C led_dir 000B led_num 000A leds_on 0009 long 0063 ncycle 000D near 0016 nn1 00C3 nn2 00CB nn3 00D2 nxtled 0015 offloop 0099 onlong 0069 onshort 0051 pulse 0089 right 0021 s_loop 0041 short 004B snd2 0035 sndbit 0038 snddly 003F sndit 002F sndone 003D sndzero 003A start 0079 xmit 0092 MPASM 1.00 Released IRSCAN.ASM 3-11-1994 19:26:4 PAGE 16 IR SCANNER FIRMWARE MEMORY USAGE MAP ('X' = Used, '-' = Unused) 0000 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX 0040 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX 0080 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX 00C0 : XXXXXXXXXXXXXXXX XXXX------------ ---------------- ---------------- 0380 : ---------------- ---------------- ---------------- ---------------- 03C0 : ---------------- ---------------- ---------------- ---------------X All other memory blocks unused. Errors : 0 Warnings : 0