Blame | Last modification | View Log | Download
CCS PCM C Compiler, Version 3.221, 27853 26-IV-05 21:32
Filename: D:\KAKLIK\programy\PIC_C\roboti\merkur\PIC16F88\turn_L\tank.LST
ROM used: 1705 words (42%)
Largest free fragment is 2048
RAM used: 87 (50%) at main() level
98 (56%) worst case
Stack: 4 worst case (3 in main + 1 for interrupts)
*
0000: MOVLW 00
0001: MOVWF 0A
0002: GOTO 4E8
0003: NOP
0004: MOVWF 7F
0005: SWAPF 03,W
0006: CLRF 03
0007: MOVWF 21
0008: MOVF 7F,W
0009: MOVWF 20
000A: MOVF 0A,W
000B: MOVWF 28
000C: CLRF 0A
000D: SWAPF 20,F
000E: MOVF 04,W
000F: MOVWF 22
0010: MOVF 77,W
0011: MOVWF 23
0012: MOVF 78,W
0013: MOVWF 24
0014: MOVF 79,W
0015: MOVWF 25
0016: MOVF 7A,W
0017: MOVWF 26
0018: MOVF 7B,W
0019: MOVWF 27
001A: BCF 03.7
001B: BCF 03.5
001C: MOVLW 8C
001D: MOVWF 04
001E: BTFSS 00.1
001F: GOTO 022
0020: BTFSC 0C.1
0021: GOTO 035
0022: MOVF 22,W
0023: MOVWF 04
0024: MOVF 23,W
0025: MOVWF 77
0026: MOVF 24,W
0027: MOVWF 78
0028: MOVF 25,W
0029: MOVWF 79
002A: MOVF 26,W
002B: MOVWF 7A
002C: MOVF 27,W
002D: MOVWF 7B
002E: MOVF 28,W
002F: MOVWF 0A
0030: SWAPF 21,W
0031: MOVWF 03
0032: SWAPF 7F,F
0033: SWAPF 7F,W
0034: RETFIE
0035: BCF 0A.3
0036: GOTO 037
.................... #include "tank.h"
.................... #include <16F88.h>
.................... //////// Standard Header file for the PIC16F88 device ////////////////
.................... #device PIC16F88
.................... #list
....................
.................... #device adc=8
.................... #fuses NOWDT,INTRC_IO, NOPUT, MCLR, NOBROWNOUT, NOLVP, NOCPD, NOWRT, NODEBUG, NOPROTECT, NOFCMEN, NOIESO
.................... #use delay(clock=4000000)
*
0047: MOVLW 12
0048: BSF 03.5
0049: SUBWF 22,F
004A: BTFSS 03.0
004B: GOTO 05A
004C: MOVLW A2
004D: MOVWF 04
004E: MOVLW FC
004F: ANDWF 00,F
0050: BCF 03.0
0051: RRF 00,F
0052: RRF 00,F
0053: MOVF 00,W
0054: BTFSC 03.2
0055: GOTO 05A
0056: GOTO 058
0057: NOP
0058: DECFSZ 00,F
0059: GOTO 057
005A: BCF 03.5
005B: RETLW 00
*
0088: MOVLW 75
0089: MOVWF 04
008A: MOVF 00,W
008B: BTFSC 03.2
008C: GOTO 09C
008D: MOVLW 01
008E: MOVWF 78
008F: CLRF 77
0090: DECFSZ 77,F
0091: GOTO 090
0092: DECFSZ 78,F
0093: GOTO 08F
0094: MOVLW 4A
0095: MOVWF 77
0096: DECFSZ 77,F
0097: GOTO 096
0098: NOP
0099: NOP
009A: DECFSZ 00,F
009B: GOTO 08D
009C: RETLW 00
....................
....................
....................
.................... #define DEBUG
....................
.................... #define TXo PIN_A3 // To the transmitter modulator
.................... #include "AX25.c" // podprogram pro prenos telemetrie
.................... #list
....................
....................
.................... unsigned int8 sensors; // pomocna promenna pro cteni cidel na caru
.................... unsigned int8 line; // na ktere strane byla detekovana cara
.................... unsigned int8 speed; // rychlost zataceni
.................... unsigned int8 rovinka; // pocitadlo pro zjisteni rovneho useku
.................... unsigned int8 last; // kde byla cara, kdyz byly minule cidla mimo
.................... unsigned int8 movement; // obsahuje aktualni smer zataceni
.................... unsigned int8 dira; // pocita dobu po kterou je ztracena cara
....................
.................... // Konstanty pro dynamiku pohybu
.................... #define T_DIRA 87 // po jakem case zataceni se detekuje dira
.................... #define INC_SPEED 1 // prirustek rychlosti v jednom kroku
.................... #define FW_POMALU 230 // trochu mimo caru vnitrni pas
.................... #define FW_ZATACKA 200 // rychlost vnejsiho kola pri zataceni
.................... #define FW_STREDNE 240 // trochu mimo caru vnejsi pas
.................... #define COUVANI 600 // couvnuti zpet na caru, po detekci diry
.................... #define PRES_DIRU 250
.................... #define MAX_ROVINKA (255-FW_STREDNE)
.................... #define TRESHOLD 10 // rozhodovaci uroven komparatoru, 0xF = 0.75*Vdd
.................... #define BUMPER_TRESHOLD 128
.................... #define CIK_CAK 30000
.................... #define T_CIHLA 50 // perioda detekce cihly
....................
.................... //motory //Napred vypnout potom zapnout!
.................... #define FR output_low(PIN_B5); output_high(PIN_B4) // Vpred
.................... #define FL output_low(PIN_B7); output_high(PIN_B6)
.................... #define BR output_low(PIN_B4); output_high(PIN_B5) // Vzad
.................... #define BL output_low(PIN_B6); output_high(PIN_B7)
.................... #define STOPR output_low(PIN_B4);output_low(PIN_B5) // Zastav
.................... #define STOPL output_low(PIN_B6);output_low(PIN_B7)
....................
.................... #define L 0b10 // left
.................... #define R 0b01 // right
.................... #define S 0b11 // straight
....................
.................... //cidla
.................... #define RSENSOR C2OUT // Senzory na caru
.................... #define LSENSOR C1OUT
.................... #define BUMPER PIN_A4 // Senzor na cihlu
....................
.................... #define DIAG_SERVO PIN_B3 // Propojka pro diagnosticky mod
.................... #define DIAG_SENSORS PIN_B2 // Propojka pro diagnosticky mod
....................
.................... #DEFINE SOUND_HI PIN_A6 // komplementarni vystupy pro piezo pipak
.................... #DEFINE SOUND_LO PIN_A7
....................
.................... char AXstring[40]; // Buffer pro prenos telemetrie
....................
.................... // makro pro PWM
.................... #define GO(motor, direction, power) if(get_timer0()<=power) \
.................... {direction##motor;} else {stop##motor;}
....................
.................... #int_TIMER2
.................... void TIMER2_isr()
.................... {
.................... if (speed<255) speed+=INC_SPEED;
*
0037: INCFSZ 42,W
0038: GOTO 03A
0039: GOTO 03C
003A: MOVLW 01
003B: ADDWF 42,F
.................... if (rovinka<MAX_ROVINKA) rovinka++;
003C: MOVF 43,W
003D: SUBLW 0E
003E: BTFSC 03.0
003F: INCF 43,F
.................... if (dira<=T_DIRA) dira++;
0040: MOVF 46,W
0041: SUBLW 57
0042: BTFSC 03.0
0043: INCF 46,F
.................... }
.................... // Primitivni Pipani
0044: BCF 0C.1
0045: BCF 0A.3
0046: GOTO 022
.................... void beep(unsigned int16 period, unsigned int16 length)
.................... {
.................... unsigned int16 nn;
....................
.................... for(nn=length; nn>0; nn--)
*
005C: MOVF 7D,W
005D: BSF 03.5
005E: MOVWF 21
005F: MOVF 7C,W
0060: MOVWF 20
0061: MOVF 20,F
0062: BTFSS 03.2
0063: GOTO 067
0064: MOVF 21,F
0065: BTFSC 03.2
0066: GOTO 086
.................... {
.................... output_high(SOUND_HI);output_low(SOUND_LO);
0067: BCF 05.6
0068: BCF 03.5
0069: BSF 05.6
006A: BSF 03.5
006B: BCF 05.7
006C: BCF 03.5
006D: BCF 05.7
.................... delay_us(period);
006E: MOVF 74,W
006F: BSF 03.5
0070: MOVWF 22
0071: BCF 03.5
0072: CALL 047
.................... output_high(SOUND_LO);output_low(SOUND_HI);
0073: BSF 03.5
0074: BCF 05.7
0075: BCF 03.5
0076: BSF 05.7
0077: BSF 03.5
0078: BCF 05.6
0079: BCF 03.5
007A: BCF 05.6
.................... delay_us(period);
007B: MOVF 74,W
007C: BSF 03.5
007D: MOVWF 22
007E: BCF 03.5
007F: CALL 047
.................... }
0080: BSF 03.5
0081: MOVF 20,W
0082: BTFSC 03.2
0083: DECF 21,F
0084: DECF 20,F
0085: GOTO 061
.................... }
0086: BCF 03.5
0087: RETLW 00
.................... /******************************************************************************/
.................... void diagnostika()
.................... {
.................... unsigned int16 n;
....................
.................... while (input(DIAG_SERVO)) // Propojka, ktera spousti diagnostiku
.................... {
*
009D: BSF 03.5
009E: BSF 06.3
009F: BCF 03.5
00A0: BTFSS 06.3
00A1: GOTO 1C8
.................... for (n=500; n<800; n+=100)
00A2: MOVLW 01
00A3: MOVWF 72
00A4: MOVLW F4
00A5: MOVWF 71
00A6: MOVF 72,W
00A7: SUBLW 03
00A8: BTFSS 03.0
00A9: GOTO 0BE
00AA: BTFSS 03.2
00AB: GOTO 0B0
00AC: MOVF 71,W
00AD: SUBLW 1F
00AE: BTFSS 03.0
00AF: GOTO 0BE
.................... {
.................... beep(n,n); //beep UP
00B0: MOVF 72,W
00B1: MOVWF 75
00B2: MOVF 71,W
00B3: MOVWF 74
00B4: MOVF 72,W
00B5: MOVWF 7D
00B6: MOVF 71,W
00B7: MOVWF 7C
00B8: CALL 05C
.................... };
00B9: MOVLW 64
00BA: ADDWF 71,F
00BB: BTFSC 03.0
00BC: INCF 72,F
00BD: GOTO 0A6
.................... Delay_ms(1000);
00BE: MOVLW 04
00BF: MOVWF 73
00C0: MOVLW FA
00C1: MOVWF 75
00C2: CALL 088
00C3: DECFSZ 73,F
00C4: GOTO 0C0
.................... //zastav vse
.................... STOPL; STOPR;
00C5: BSF 03.5
00C6: BCF 06.6
00C7: BCF 03.5
00C8: BCF 06.6
00C9: BSF 03.5
00CA: BCF 06.7
00CB: BCF 03.5
00CC: BCF 06.7
00CD: BSF 03.5
00CE: BCF 06.4
00CF: BCF 03.5
00D0: BCF 06.4
00D1: BSF 03.5
00D2: BCF 06.5
00D3: BCF 03.5
00D4: BCF 06.5
.................... //pravy pas
.................... FR; Delay_ms(1000); STOPR; Delay_ms(1000);
00D5: BSF 03.5
00D6: BCF 06.5
00D7: BCF 03.5
00D8: BCF 06.5
00D9: BSF 03.5
00DA: BCF 06.4
00DB: BCF 03.5
00DC: BSF 06.4
00DD: MOVLW 04
00DE: MOVWF 73
00DF: MOVLW FA
00E0: MOVWF 75
00E1: CALL 088
00E2: DECFSZ 73,F
00E3: GOTO 0DF
00E4: BSF 03.5
00E5: BCF 06.4
00E6: BCF 03.5
00E7: BCF 06.4
00E8: BSF 03.5
00E9: BCF 06.5
00EA: BCF 03.5
00EB: BCF 06.5
00EC: MOVLW 04
00ED: MOVWF 73
00EE: MOVLW FA
00EF: MOVWF 75
00F0: CALL 088
00F1: DECFSZ 73,F
00F2: GOTO 0EE
.................... BR; Delay_ms(1000); STOPR; Delay_ms(1000);
00F3: BSF 03.5
00F4: BCF 06.4
00F5: BCF 03.5
00F6: BCF 06.4
00F7: BSF 03.5
00F8: BCF 06.5
00F9: BCF 03.5
00FA: BSF 06.5
00FB: MOVLW 04
00FC: MOVWF 73
00FD: MOVLW FA
00FE: MOVWF 75
00FF: CALL 088
0100: DECFSZ 73,F
0101: GOTO 0FD
0102: BSF 03.5
0103: BCF 06.4
0104: BCF 03.5
0105: BCF 06.4
0106: BSF 03.5
0107: BCF 06.5
0108: BCF 03.5
0109: BCF 06.5
010A: MOVLW 04
010B: MOVWF 73
010C: MOVLW FA
010D: MOVWF 75
010E: CALL 088
010F: DECFSZ 73,F
0110: GOTO 10C
.................... Beep(880,100); Delay_ms(1000);
0111: MOVLW 03
0112: MOVWF 75
0113: MOVLW 70
0114: MOVWF 74
0115: CLRF 7D
0116: MOVLW 64
0117: MOVWF 7C
0118: CALL 05C
0119: MOVLW 04
011A: MOVWF 73
011B: MOVLW FA
011C: MOVWF 75
011D: CALL 088
011E: DECFSZ 73,F
011F: GOTO 11B
.................... //levy pas
.................... FL; Delay_ms(1000); STOPL; Delay_ms(1000);
0120: BSF 03.5
0121: BCF 06.7
0122: BCF 03.5
0123: BCF 06.7
0124: BSF 03.5
0125: BCF 06.6
0126: BCF 03.5
0127: BSF 06.6
0128: MOVLW 04
0129: MOVWF 73
012A: MOVLW FA
012B: MOVWF 75
012C: CALL 088
012D: DECFSZ 73,F
012E: GOTO 12A
012F: BSF 03.5
0130: BCF 06.6
0131: BCF 03.5
0132: BCF 06.6
0133: BSF 03.5
0134: BCF 06.7
0135: BCF 03.5
0136: BCF 06.7
0137: MOVLW 04
0138: MOVWF 73
0139: MOVLW FA
013A: MOVWF 75
013B: CALL 088
013C: DECFSZ 73,F
013D: GOTO 139
.................... BL; Delay_ms(1000); STOPL; Delay_ms(1000);
013E: BSF 03.5
013F: BCF 06.6
0140: BCF 03.5
0141: BCF 06.6
0142: BSF 03.5
0143: BCF 06.7
0144: BCF 03.5
0145: BSF 06.7
0146: MOVLW 04
0147: MOVWF 73
0148: MOVLW FA
0149: MOVWF 75
014A: CALL 088
014B: DECFSZ 73,F
014C: GOTO 148
014D: BSF 03.5
014E: BCF 06.6
014F: BCF 03.5
0150: BCF 06.6
0151: BSF 03.5
0152: BCF 06.7
0153: BCF 03.5
0154: BCF 06.7
0155: MOVLW 04
0156: MOVWF 73
0157: MOVLW FA
0158: MOVWF 75
0159: CALL 088
015A: DECFSZ 73,F
015B: GOTO 157
.................... Beep(880,100); Delay_ms(1000);
015C: MOVLW 03
015D: MOVWF 75
015E: MOVLW 70
015F: MOVWF 74
0160: CLRF 7D
0161: MOVLW 64
0162: MOVWF 7C
0163: CALL 05C
0164: MOVLW 04
0165: MOVWF 73
0166: MOVLW FA
0167: MOVWF 75
0168: CALL 088
0169: DECFSZ 73,F
016A: GOTO 166
.................... //oba pasy
.................... FL; FR; Delay_ms(1000); STOPL; STOPR; Delay_ms(1000);
016B: BSF 03.5
016C: BCF 06.7
016D: BCF 03.5
016E: BCF 06.7
016F: BSF 03.5
0170: BCF 06.6
0171: BCF 03.5
0172: BSF 06.6
0173: BSF 03.5
0174: BCF 06.5
0175: BCF 03.5
0176: BCF 06.5
0177: BSF 03.5
0178: BCF 06.4
0179: BCF 03.5
017A: BSF 06.4
017B: MOVLW 04
017C: MOVWF 73
017D: MOVLW FA
017E: MOVWF 75
017F: CALL 088
0180: DECFSZ 73,F
0181: GOTO 17D
0182: BSF 03.5
0183: BCF 06.6
0184: BCF 03.5
0185: BCF 06.6
0186: BSF 03.5
0187: BCF 06.7
0188: BCF 03.5
0189: BCF 06.7
018A: BSF 03.5
018B: BCF 06.4
018C: BCF 03.5
018D: BCF 06.4
018E: BSF 03.5
018F: BCF 06.5
0190: BCF 03.5
0191: BCF 06.5
0192: MOVLW 04
0193: MOVWF 73
0194: MOVLW FA
0195: MOVWF 75
0196: CALL 088
0197: DECFSZ 73,F
0198: GOTO 194
.................... BL; BR; Delay_ms(1000); STOPL; STOPR; Delay_ms(1000);
0199: BSF 03.5
019A: BCF 06.6
019B: BCF 03.5
019C: BCF 06.6
019D: BSF 03.5
019E: BCF 06.7
019F: BCF 03.5
01A0: BSF 06.7
01A1: BSF 03.5
01A2: BCF 06.4
01A3: BCF 03.5
01A4: BCF 06.4
01A5: BSF 03.5
01A6: BCF 06.5
01A7: BCF 03.5
01A8: BSF 06.5
01A9: MOVLW 04
01AA: MOVWF 73
01AB: MOVLW FA
01AC: MOVWF 75
01AD: CALL 088
01AE: DECFSZ 73,F
01AF: GOTO 1AB
01B0: BSF 03.5
01B1: BCF 06.6
01B2: BCF 03.5
01B3: BCF 06.6
01B4: BSF 03.5
01B5: BCF 06.7
01B6: BCF 03.5
01B7: BCF 06.7
01B8: BSF 03.5
01B9: BCF 06.4
01BA: BCF 03.5
01BB: BCF 06.4
01BC: BSF 03.5
01BD: BCF 06.5
01BE: BCF 03.5
01BF: BCF 06.5
01C0: MOVLW 04
01C1: MOVWF 73
01C2: MOVLW FA
01C3: MOVWF 75
01C4: CALL 088
01C5: DECFSZ 73,F
01C6: GOTO 1C2
.................... };
01C7: GOTO 09D
.................... while (input(DIAG_SENSORS))
.................... {
01C8: BSF 03.5
01C9: BSF 06.2
01CA: BCF 03.5
01CB: BTFSS 06.2
01CC: GOTO 1FB
.................... if (RSENSOR) beep(900,500);
01CD: BSF 03.5
01CE: BTFSS 1C.7
01CF: GOTO 1DB
01D0: MOVLW 03
01D1: MOVWF 75
01D2: MOVLW 84
01D3: MOVWF 74
01D4: MOVLW 01
01D5: MOVWF 7D
01D6: MOVLW F4
01D7: MOVWF 7C
01D8: BCF 03.5
01D9: CALL 05C
01DA: BSF 03.5
.................... if (LSENSOR) beep(800,500);
01DB: BTFSS 1C.6
01DC: GOTO 1E8
01DD: MOVLW 03
01DE: MOVWF 75
01DF: MOVLW 20
01E0: MOVWF 74
01E1: MOVLW 01
01E2: MOVWF 7D
01E3: MOVLW F4
01E4: MOVWF 7C
01E5: BCF 03.5
01E6: CALL 05C
01E7: BSF 03.5
.................... if ((read_adc(ADC_READ_ONLY)<BUMPER_TRESHOLD)) beep(1000,500);
01E8: BCF 03.5
01E9: BTFSS 1F.2
01EA: GOTO 1ED
01EB: BSF 03.5
01EC: GOTO 1E8
01ED: MOVF 1E,W
01EE: SUBLW 7F
01EF: BTFSS 03.0
01F0: GOTO 1FA
01F1: MOVLW 03
01F2: MOVWF 75
01F3: MOVLW E8
01F4: MOVWF 74
01F5: MOVLW 01
01F6: MOVWF 7D
01F7: MOVLW F4
01F8: MOVWF 7C
01F9: CALL 05C
.................... };
01FA: GOTO 1C8
.................... }
01FB: BCF 0A.3
01FC: GOTO 596 (RETURN)
.................... ///////////////////////////////////////////////////////////////////////////////
.................... void cikcak()
.................... {
.................... unsigned int16 n;
.................... sem1:
.................... n=CIK_CAK;
01FD: MOVLW 75
01FE: MOVWF 75
01FF: MOVLW 30
0200: MOVWF 74
.................... while (0==RSENSOR||LSENSOR) // zkontroluj caru
.................... {
0201: MOVLW 00
0202: BSF 03.5
0203: BTFSC 1C.7
0204: MOVLW 01
0205: XORLW 00
0206: BTFSC 03.2
0207: GOTO 20A
0208: BTFSS 1C.6
0209: GOTO 264
.................... if (n==CIK_CAK) // zmen smer zataceni
020A: MOVF 74,W
020B: SUBLW 30
020C: BTFSS 03.2
020D: GOTO 25E
020E: MOVF 75,W
020F: SUBLW 75
0210: BTFSS 03.2
0211: GOTO 25E
.................... {
.................... n=0;
0212: CLRF 75
0213: CLRF 74
.................... switch(movement)
.................... {
0214: BCF 03.5
0215: MOVF 45,W
0216: XORLW 02
0217: BTFSC 03.2
0218: GOTO 220
0219: XORLW 03
021A: BTFSC 03.2
021B: GOTO 233
021C: XORLW 02
021D: BTFSC 03.2
021E: GOTO 246
021F: GOTO 25D
.................... case L:
.................... FL;BR;
0220: BSF 03.5
0221: BCF 06.7
0222: BCF 03.5
0223: BCF 06.7
0224: BSF 03.5
0225: BCF 06.6
0226: BCF 03.5
0227: BSF 06.6
0228: BSF 03.5
0229: BCF 06.4
022A: BCF 03.5
022B: BCF 06.4
022C: BSF 03.5
022D: BCF 06.5
022E: BCF 03.5
022F: BSF 06.5
.................... movement=R;
0230: MOVLW 01
0231: MOVWF 45
.................... break;
0232: GOTO 25D
.................... case R:
.................... FR;BL;
0233: BSF 03.5
0234: BCF 06.5
0235: BCF 03.5
0236: BCF 06.5
0237: BSF 03.5
0238: BCF 06.4
0239: BCF 03.5
023A: BSF 06.4
023B: BSF 03.5
023C: BCF 06.6
023D: BCF 03.5
023E: BCF 06.6
023F: BSF 03.5
0240: BCF 06.7
0241: BCF 03.5
0242: BSF 06.7
.................... movement=L;
0243: MOVLW 02
0244: MOVWF 45
.................... break;
0245: GOTO 25D
.................... case S:
.................... FL;BR;
0246: BSF 03.5
0247: BCF 06.7
0248: BCF 03.5
0249: BCF 06.7
024A: BSF 03.5
024B: BCF 06.6
024C: BCF 03.5
024D: BSF 06.6
024E: BSF 03.5
024F: BCF 06.4
0250: BCF 03.5
0251: BCF 06.4
0252: BSF 03.5
0253: BCF 06.5
0254: BCF 03.5
0255: BSF 06.5
.................... movement=R;
0256: MOVLW 01
0257: MOVWF 45
.................... n=CIK_CAK/2;
0258: MOVLW 3A
0259: MOVWF 75
025A: MOVLW 98
025B: MOVWF 74
.................... break;
025C: GOTO 25D
025D: BSF 03.5
.................... }
.................... }
.................... n++;
025E: INCF 74,F
025F: BTFSC 03.2
0260: INCF 75,F
.................... }
0261: BCF 03.5
0262: GOTO 201
0263: BSF 03.5
.................... STOPL;STOPR;
0264: BCF 06.6
0265: BCF 03.5
0266: BCF 06.6
0267: BSF 03.5
0268: BCF 06.7
0269: BCF 03.5
026A: BCF 06.7
026B: BSF 03.5
026C: BCF 06.4
026D: BCF 03.5
026E: BCF 06.4
026F: BSF 03.5
0270: BCF 06.5
0271: BCF 03.5
0272: BCF 06.5
.................... line = RSENSOR; // cteni senzoru na caru
0273: CLRF 41
0274: BSF 03.5
0275: BTFSS 1C.7
0276: GOTO 27A
0277: BCF 03.5
0278: INCF 41,F
0279: BSF 03.5
.................... line |= LSENSOR << 1;
027A: MOVLW 00
027B: BTFSC 1C.6
027C: MOVLW 01
027D: MOVWF 77
027E: BCF 03.0
027F: RLF 77,F
0280: MOVF 77,W
0281: BCF 03.5
0282: IORWF 41,F
.................... if (line==0) goto sem1;
0283: MOVF 41,F
0284: BTFSC 03.2
0285: GOTO 1FD
.................... // nasli jsme caru
.................... line=S;
0286: MOVLW 03
0287: MOVWF 41
.................... }
0288: RETLW 00
.................... ///////////////////////////////////////////////////////////////////////////////
.................... void objizdka() // objede cihlu
.................... {
.................... unsigned int16 n;
....................
.................... BL;BR;Delay_ms(200);
0289: BSF 03.5
028A: BCF 06.6
028B: BCF 03.5
028C: BCF 06.6
028D: BSF 03.5
028E: BCF 06.7
028F: BCF 03.5
0290: BSF 06.7
0291: BSF 03.5
0292: BCF 06.4
0293: BCF 03.5
0294: BCF 06.4
0295: BSF 03.5
0296: BCF 06.5
0297: BCF 03.5
0298: BSF 06.5
0299: MOVLW C8
029A: MOVWF 75
029B: CALL 088
.................... STOPR;STOPL;
029C: BSF 03.5
029D: BCF 06.4
029E: BCF 03.5
029F: BCF 06.4
02A0: BSF 03.5
02A1: BCF 06.5
02A2: BCF 03.5
02A3: BCF 06.5
02A4: BSF 03.5
02A5: BCF 06.6
02A6: BCF 03.5
02A7: BCF 06.6
02A8: BSF 03.5
02A9: BCF 06.7
02AA: BCF 03.5
02AB: BCF 06.7
.................... beep(900,1000);
02AC: MOVLW 03
02AD: MOVWF 75
02AE: MOVLW 84
02AF: MOVWF 74
02B0: MOVLW 03
02B1: MOVWF 7D
02B2: MOVLW E8
02B3: MOVWF 7C
02B4: CALL 05C
.................... // movement=S;
.................... //cikcak();
....................
.................... BL; FR; Delay_ms(215); // otoc se 70° do leva
02B5: BSF 03.5
02B6: BCF 06.6
02B7: BCF 03.5
02B8: BCF 06.6
02B9: BSF 03.5
02BA: BCF 06.7
02BB: BCF 03.5
02BC: BSF 06.7
02BD: BSF 03.5
02BE: BCF 06.5
02BF: BCF 03.5
02C0: BCF 06.5
02C1: BSF 03.5
02C2: BCF 06.4
02C3: BCF 03.5
02C4: BSF 06.4
02C5: MOVLW D7
02C6: MOVWF 75
02C7: CALL 088
....................
.................... FR; FL; Delay_ms(600); // popojed rovne
02C8: BSF 03.5
02C9: BCF 06.5
02CA: BCF 03.5
02CB: BCF 06.5
02CC: BSF 03.5
02CD: BCF 06.4
02CE: BCF 03.5
02CF: BSF 06.4
02D0: BSF 03.5
02D1: BCF 06.7
02D2: BCF 03.5
02D3: BCF 06.7
02D4: BSF 03.5
02D5: BCF 06.6
02D6: BCF 03.5
02D7: BSF 06.6
02D8: MOVLW 03
02D9: MOVWF 73
02DA: MOVLW C8
02DB: MOVWF 75
02DC: CALL 088
02DD: DECFSZ 73,F
02DE: GOTO 2DA
....................
.................... BR; Delay_ms(50); // otoc se 90° do prava
02DF: BSF 03.5
02E0: BCF 06.4
02E1: BCF 03.5
02E2: BCF 06.4
02E3: BSF 03.5
02E4: BCF 06.5
02E5: BCF 03.5
02E6: BSF 06.5
02E7: MOVLW 32
02E8: MOVWF 75
02E9: CALL 088
.................... STOPR; FL; Delay_ms(600);
02EA: BSF 03.5
02EB: BCF 06.4
02EC: BCF 03.5
02ED: BCF 06.4
02EE: BSF 03.5
02EF: BCF 06.5
02F0: BCF 03.5
02F1: BCF 06.5
02F2: BSF 03.5
02F3: BCF 06.7
02F4: BCF 03.5
02F5: BCF 06.7
02F6: BSF 03.5
02F7: BCF 06.6
02F8: BCF 03.5
02F9: BSF 06.6
02FA: MOVLW 03
02FB: MOVWF 73
02FC: MOVLW C8
02FD: MOVWF 75
02FE: CALL 088
02FF: DECFSZ 73,F
0300: GOTO 2FC
....................
.................... FR; FL; Delay_ms(100); // popojed rovne na slepo
0301: BSF 03.5
0302: BCF 06.5
0303: BCF 03.5
0304: BCF 06.5
0305: BSF 03.5
0306: BCF 06.4
0307: BCF 03.5
0308: BSF 06.4
0309: BSF 03.5
030A: BCF 06.7
030B: BCF 03.5
030C: BCF 06.7
030D: BSF 03.5
030E: BCF 06.6
030F: BCF 03.5
0310: BSF 06.6
0311: MOVLW 64
0312: MOVWF 75
0313: CALL 088
.................... for(n=600;n>0;n--) // popojed rovne ale kontroluj caru
0314: MOVLW 02
0315: MOVWF 72
0316: MOVLW 58
0317: MOVWF 71
0318: MOVF 71,F
0319: BTFSS 03.2
031A: GOTO 31E
031B: MOVF 72,F
031C: BTFSC 03.2
031D: GOTO 33D
.................... {
.................... line = RSENSOR; // cteni senzoru na caru
031E: CLRF 41
031F: BSF 03.5
0320: BTFSS 1C.7
0321: GOTO 325
0322: BCF 03.5
0323: INCF 41,F
0324: BSF 03.5
.................... line |= LSENSOR << 1;
0325: MOVLW 00
0326: BTFSC 1C.6
0327: MOVLW 01
0328: MOVWF 77
0329: BCF 03.0
032A: RLF 77,F
032B: MOVF 77,W
032C: BCF 03.5
032D: IORWF 41,F
.................... if (line!=0) {Delay_ms(50); break;} // kdyz narazis na caru, za chvili zastav
032E: MOVF 41,F
032F: BTFSC 03.2
0330: GOTO 335
0331: MOVLW 32
0332: MOVWF 75
0333: CALL 088
0334: GOTO 33D
.................... Delay_ms(1);
0335: MOVLW 01
0336: MOVWF 75
0337: CALL 088
.................... }
0338: MOVF 71,W
0339: BTFSC 03.2
033A: DECF 72,F
033B: DECF 71,F
033C: GOTO 318
....................
.................... BL; // otoc se 60° do leva
033D: BSF 03.5
033E: BCF 06.6
033F: BCF 03.5
0340: BCF 06.6
0341: BSF 03.5
0342: BCF 06.7
0343: BCF 03.5
0344: BSF 06.7
.................... for(n=600;n>0;n--)
0345: MOVLW 02
0346: MOVWF 72
0347: MOVLW 58
0348: MOVWF 71
0349: MOVF 71,F
034A: BTFSS 03.2
034B: GOTO 34F
034C: MOVF 72,F
034D: BTFSC 03.2
034E: GOTO 36A
.................... {
.................... line = RSENSOR; // cteni senzoru na caru
034F: CLRF 41
0350: BSF 03.5
0351: BTFSS 1C.7
0352: GOTO 356
0353: BCF 03.5
0354: INCF 41,F
0355: BSF 03.5
.................... line |= LSENSOR << 1;
0356: MOVLW 00
0357: BTFSC 1C.6
0358: MOVLW 01
0359: MOVWF 77
035A: BCF 03.0
035B: RLF 77,F
035C: MOVF 77,W
035D: BCF 03.5
035E: IORWF 41,F
.................... if (line!=0) break;
035F: MOVF 41,F
0360: BTFSS 03.2
0361: GOTO 36A
.................... Delay_ms(1);
0362: MOVLW 01
0363: MOVWF 75
0364: CALL 088
.................... }
0365: MOVF 71,W
0366: BTFSC 03.2
0367: DECF 72,F
0368: DECF 71,F
0369: GOTO 349
.................... STOPR; STOPL;
036A: BSF 03.5
036B: BCF 06.4
036C: BCF 03.5
036D: BCF 06.4
036E: BSF 03.5
036F: BCF 06.5
0370: BCF 03.5
0371: BCF 06.5
0372: BSF 03.5
0373: BCF 06.6
0374: BCF 03.5
0375: BCF 06.6
0376: BSF 03.5
0377: BCF 06.7
0378: BCF 03.5
0379: BCF 06.7
....................
.................... movement=R;
037A: MOVLW 01
037B: MOVWF 45
.................... cikcak();
037C: CALL 1FD
.................... dira=0;
037D: CLRF 46
.................... }
037E: BCF 0A.3
037F: GOTO 5C6 (RETURN)
.................... ///////////////////////////////////////////////////////////////////////////////
.................... void prejeddiru() // vyresi diru
.................... {
.................... unsigned int16 n;
.................... unsigned int8 speed_dira;
....................
.................... STOPL;STOPR;
0380: BSF 03.5
0381: BCF 06.6
0382: BCF 03.5
0383: BCF 06.6
0384: BSF 03.5
0385: BCF 06.7
0386: BCF 03.5
0387: BCF 06.7
0388: BSF 03.5
0389: BCF 06.4
038A: BCF 03.5
038B: BCF 06.4
038C: BSF 03.5
038D: BCF 06.5
038E: BCF 03.5
038F: BCF 06.5
.................... speed_dira=speed;
0390: MOVF 42,W
0391: MOVWF 73
.................... beep(1000,500);
0392: MOVLW 03
0393: MOVWF 75
0394: MOVLW E8
0395: MOVWF 74
0396: MOVLW 01
0397: MOVWF 7D
0398: MOVLW F4
0399: MOVWF 7C
039A: CALL 05C
.................... switch (movement) //vrat se zpet na caru
.................... {
039B: MOVF 45,W
039C: XORLW 02
039D: BTFSC 03.2
039E: GOTO 3A6
039F: XORLW 03
03A0: BTFSC 03.2
03A1: GOTO 3DE
03A2: XORLW 02
03A3: BTFSC 03.2
03A4: GOTO 416
03A5: GOTO 418
.................... case L:
.................... for (n=COUVANI;n>0;n--) {GO(R,B,speed_dira); Delay_ms(1);}
03A6: MOVLW 02
03A7: MOVWF 72
03A8: MOVLW 58
03A9: MOVWF 71
03AA: MOVF 71,F
03AB: BTFSS 03.2
03AC: GOTO 3B0
03AD: MOVF 72,F
03AE: BTFSC 03.2
03AF: GOTO 3CD
03B0: MOVF 01,W
03B1: SUBWF 73,W
03B2: BTFSS 03.0
03B3: GOTO 3BD
03B4: BSF 03.5
03B5: BCF 06.4
03B6: BCF 03.5
03B7: BCF 06.4
03B8: BSF 03.5
03B9: BCF 06.5
03BA: BCF 03.5
03BB: BSF 06.5
03BC: GOTO 3C5
03BD: BSF 03.5
03BE: BCF 06.4
03BF: BCF 03.5
03C0: BCF 06.4
03C1: BSF 03.5
03C2: BCF 06.5
03C3: BCF 03.5
03C4: BCF 06.5
03C5: MOVLW 01
03C6: MOVWF 75
03C7: CALL 088
03C8: MOVF 71,W
03C9: BTFSC 03.2
03CA: DECF 72,F
03CB: DECF 71,F
03CC: GOTO 3AA
.................... STOPL;STOPR;
03CD: BSF 03.5
03CE: BCF 06.6
03CF: BCF 03.5
03D0: BCF 06.6
03D1: BSF 03.5
03D2: BCF 06.7
03D3: BCF 03.5
03D4: BCF 06.7
03D5: BSF 03.5
03D6: BCF 06.4
03D7: BCF 03.5
03D8: BCF 06.4
03D9: BSF 03.5
03DA: BCF 06.5
03DB: BCF 03.5
03DC: BCF 06.5
.................... break;
03DD: GOTO 418
.................... case R:
.................... for (n=COUVANI;n>0;n--) {GO(L,B,speed_dira); Delay_ms(1);}
03DE: MOVLW 02
03DF: MOVWF 72
03E0: MOVLW 58
03E1: MOVWF 71
03E2: MOVF 71,F
03E3: BTFSS 03.2
03E4: GOTO 3E8
03E5: MOVF 72,F
03E6: BTFSC 03.2
03E7: GOTO 405
03E8: MOVF 01,W
03E9: SUBWF 73,W
03EA: BTFSS 03.0
03EB: GOTO 3F5
03EC: BSF 03.5
03ED: BCF 06.6
03EE: BCF 03.5
03EF: BCF 06.6
03F0: BSF 03.5
03F1: BCF 06.7
03F2: BCF 03.5
03F3: BSF 06.7
03F4: GOTO 3FD
03F5: BSF 03.5
03F6: BCF 06.6
03F7: BCF 03.5
03F8: BCF 06.6
03F9: BSF 03.5
03FA: BCF 06.7
03FB: BCF 03.5
03FC: BCF 06.7
03FD: MOVLW 01
03FE: MOVWF 75
03FF: CALL 088
0400: MOVF 71,W
0401: BTFSC 03.2
0402: DECF 72,F
0403: DECF 71,F
0404: GOTO 3E2
.................... STOPL;STOPR;
0405: BSF 03.5
0406: BCF 06.6
0407: BCF 03.5
0408: BCF 06.6
0409: BSF 03.5
040A: BCF 06.7
040B: BCF 03.5
040C: BCF 06.7
040D: BSF 03.5
040E: BCF 06.4
040F: BCF 03.5
0410: BCF 06.4
0411: BSF 03.5
0412: BCF 06.5
0413: BCF 03.5
0414: BCF 06.5
.................... break;
0415: GOTO 418
.................... case S:
.................... goto sem;
0416: GOTO 4D2
.................... break;
0417: GOTO 418
.................... }
.................... beep(800,500);
0418: MOVLW 03
0419: MOVWF 75
041A: MOVLW 20
041B: MOVWF 74
041C: MOVLW 01
041D: MOVWF 7D
041E: MOVLW F4
041F: MOVWF 7C
0420: CALL 05C
....................
.................... line=0;
0421: CLRF 41
.................... FR; BL; Delay_ms(300); // otoc se na caru
0422: BSF 03.5
0423: BCF 06.5
0424: BCF 03.5
0425: BCF 06.5
0426: BSF 03.5
0427: BCF 06.4
0428: BCF 03.5
0429: BSF 06.4
042A: BSF 03.5
042B: BCF 06.6
042C: BCF 03.5
042D: BCF 06.6
042E: BSF 03.5
042F: BCF 06.7
0430: BCF 03.5
0431: BSF 06.7
0432: MOVLW 02
0433: MOVWF 74
0434: MOVLW 96
0435: MOVWF 75
0436: CALL 088
0437: DECFSZ 74,F
0438: GOTO 434
.................... while(line==0)
.................... {
0439: MOVF 41,F
043A: BTFSS 03.2
043B: GOTO 44D
.................... line = RSENSOR; // cteni senzoru na caru
043C: CLRF 41
043D: BSF 03.5
043E: BTFSS 1C.7
043F: GOTO 443
0440: BCF 03.5
0441: INCF 41,F
0442: BSF 03.5
.................... line |= LSENSOR << 1;
0443: MOVLW 00
0444: BTFSC 1C.6
0445: MOVLW 01
0446: MOVWF 77
0447: BCF 03.0
0448: RLF 77,F
0449: MOVF 77,W
044A: BCF 03.5
044B: IORWF 41,F
.................... }
044C: GOTO 439
.................... FL;BR; Delay_ms(60);
044D: BSF 03.5
044E: BCF 06.7
044F: BCF 03.5
0450: BCF 06.7
0451: BSF 03.5
0452: BCF 06.6
0453: BCF 03.5
0454: BSF 06.6
0455: BSF 03.5
0456: BCF 06.4
0457: BCF 03.5
0458: BCF 06.4
0459: BSF 03.5
045A: BCF 06.5
045B: BCF 03.5
045C: BSF 06.5
045D: MOVLW 3C
045E: MOVWF 75
045F: CALL 088
.................... STOPL; STOPR;
0460: BSF 03.5
0461: BCF 06.6
0462: BCF 03.5
0463: BCF 06.6
0464: BSF 03.5
0465: BCF 06.7
0466: BCF 03.5
0467: BCF 06.7
0468: BSF 03.5
0469: BCF 06.4
046A: BCF 03.5
046B: BCF 06.4
046C: BSF 03.5
046D: BCF 06.5
046E: BCF 03.5
046F: BCF 06.5
....................
.................... FL; BR; Delay_ms(500);
0470: BSF 03.5
0471: BCF 06.7
0472: BCF 03.5
0473: BCF 06.7
0474: BSF 03.5
0475: BCF 06.6
0476: BCF 03.5
0477: BSF 06.6
0478: BSF 03.5
0479: BCF 06.4
047A: BCF 03.5
047B: BCF 06.4
047C: BSF 03.5
047D: BCF 06.5
047E: BCF 03.5
047F: BSF 06.5
0480: MOVLW 02
0481: MOVWF 74
0482: MOVLW FA
0483: MOVWF 75
0484: CALL 088
0485: DECFSZ 74,F
0486: GOTO 482
.................... STOPL; STOPR;
0487: BSF 03.5
0488: BCF 06.6
0489: BCF 03.5
048A: BCF 06.6
048B: BSF 03.5
048C: BCF 06.7
048D: BCF 03.5
048E: BCF 06.7
048F: BSF 03.5
0490: BCF 06.4
0491: BCF 03.5
0492: BCF 06.4
0493: BSF 03.5
0494: BCF 06.5
0495: BCF 03.5
0496: BCF 06.5
....................
.................... Delay_ms(1000);
0497: MOVLW 04
0498: MOVWF 74
0499: MOVLW FA
049A: MOVWF 75
049B: CALL 088
049C: DECFSZ 74,F
049D: GOTO 499
....................
.................... FR;FL; //popojed rovne
049E: BSF 03.5
049F: BCF 06.5
04A0: BCF 03.5
04A1: BCF 06.5
04A2: BSF 03.5
04A3: BCF 06.4
04A4: BCF 03.5
04A5: BSF 06.4
04A6: BSF 03.5
04A7: BCF 06.7
04A8: BCF 03.5
04A9: BCF 06.7
04AA: BSF 03.5
04AB: BCF 06.6
04AC: BCF 03.5
04AD: BSF 06.6
.................... for(n=PRES_DIRU;n>0;n--)
04AE: CLRF 72
04AF: MOVLW FA
04B0: MOVWF 71
04B1: MOVF 71,F
04B2: BTFSS 03.2
04B3: GOTO 4B7
04B4: MOVF 72,F
04B5: BTFSC 03.2
04B6: GOTO 4D2
.................... {
.................... line = RSENSOR; // cteni senzoru na caru
04B7: CLRF 41
04B8: BSF 03.5
04B9: BTFSS 1C.7
04BA: GOTO 4BE
04BB: BCF 03.5
04BC: INCF 41,F
04BD: BSF 03.5
.................... line |= LSENSOR << 1;
04BE: MOVLW 00
04BF: BTFSC 1C.6
04C0: MOVLW 01
04C1: MOVWF 77
04C2: BCF 03.0
04C3: RLF 77,F
04C4: MOVF 77,W
04C5: BCF 03.5
04C6: IORWF 41,F
.................... if (line!=0) break;
04C7: MOVF 41,F
04C8: BTFSS 03.2
04C9: GOTO 4D2
.................... Delay_ms(1);
04CA: MOVLW 01
04CB: MOVWF 75
04CC: CALL 088
.................... }
04CD: MOVF 71,W
04CE: BTFSC 03.2
04CF: DECF 72,F
04D0: DECF 71,F
04D1: GOTO 4B1
.................... sem:
.................... STOPL; STOPR;
04D2: BSF 03.5
04D3: BCF 06.6
04D4: BCF 03.5
04D5: BCF 06.6
04D6: BSF 03.5
04D7: BCF 06.7
04D8: BCF 03.5
04D9: BCF 06.7
04DA: BSF 03.5
04DB: BCF 06.4
04DC: BCF 03.5
04DD: BCF 06.4
04DE: BSF 03.5
04DF: BCF 06.5
04E0: BCF 03.5
04E1: BCF 06.5
.................... movement=S;
04E2: MOVLW 03
04E3: MOVWF 45
.................... cikcak(); // najdi caru
04E4: CALL 1FD
.................... dira=0;
04E5: CLRF 46
.................... }
04E6: BCF 0A.3
04E7: GOTO 65C (RETURN)
.................... ///////////////////////////////////////////////////////////////////////////////
.................... void main()
.................... {
04E8: CLRF 04
04E9: MOVLW 1F
04EA: ANDWF 03,F
04EB: BSF 03.5
04EC: BCF 1F.4
04ED: BCF 1F.5
04EE: MOVF 1B,W
04EF: ANDLW 80
04F0: MOVWF 1B
04F1: MOVLW 07
04F2: MOVWF 1C
04F3: MOVF 1C,W
04F4: BCF 03.5
04F5: BCF 0D.6
04F6: MOVLW 60
04F7: BSF 03.5
04F8: MOVWF 0F
.................... unsigned int16 n; // pro FOR
....................
.................... STOPL; STOPR; // prepne vystupy na ovladani motoru na output a zastavi
*
0515: BSF 03.5
0516: BCF 06.6
0517: BCF 03.5
0518: BCF 06.6
0519: BSF 03.5
051A: BCF 06.7
051B: BCF 03.5
051C: BCF 06.7
051D: BSF 03.5
051E: BCF 06.4
051F: BCF 03.5
0520: BCF 06.4
0521: BSF 03.5
0522: BCF 06.5
0523: BCF 03.5
0524: BCF 06.5
....................
.................... setup_oscillator(OSC_4MHZ|OSC_INTRC); // 4 MHz interni RC oscilator
0525: MOVLW 62
0526: BSF 03.5
0527: MOVWF 0F
....................
.................... port_b_pullups(TRUE); // pullups pro piano na diagnostiku
0528: BCF 01.7
.................... setup_spi(FALSE);
0529: BCF 03.5
052A: BCF 14.5
052B: BSF 03.5
052C: BCF 06.2
052D: BSF 06.1
052E: BCF 06.4
052F: MOVLW 00
0530: BCF 03.5
0531: MOVWF 14
0532: BSF 03.5
0533: MOVWF 14
.................... setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); // Casovac pro PWM
0534: MOVF 01,W
0535: ANDLW C7
0536: IORLW 08
0537: MOVWF 01
....................
.................... setup_timer_2(T2_DIV_BY_4,255,10); // Casovac pro regulaci
0538: MOVLW 48
0539: MOVWF 78
053A: IORLW 05
053B: BCF 03.5
053C: MOVWF 12
053D: MOVLW FF
053E: BSF 03.5
053F: MOVWF 12
.................... // preruseni kazdych 10ms
.................... setup_adc_ports(sAN2|VSS_VDD); // nastaveni A/D prevodniku pro naraznik
0540: BCF 1F.4
0541: BCF 1F.5
0542: MOVF 1B,W
0543: ANDLW 80
0544: IORLW 04
0545: MOVWF 1B
.................... setup_adc(ADC_CLOCK_INTERNAL);
0546: BCF 1F.6
0547: BCF 03.5
0548: BSF 1F.6
0549: BSF 1F.7
054A: BSF 03.5
054B: BCF 1F.7
054C: BCF 03.5
054D: BSF 1F.0
.................... set_adc_channel(2);
054E: MOVLW 10
054F: MOVWF 78
0550: MOVF 1F,W
0551: ANDLW C7
0552: IORWF 78,W
0553: MOVWF 1F
.................... setup_timer_1(T1_INTERNAL|T1_DIV_BY_1); // Casovac pro naraznik
0554: MOVLW 85
0555: MOVWF 10
.................... setup_ccp1(CCP_COMPARE_RESET_TIMER);
0556: BSF 03.5
0557: BSF 06.3
0558: MOVLW 0B
0559: BCF 03.5
055A: MOVWF 17
.................... CCP_1=(2^10)-1; // prevod kazdou 1ms
055B: CLRF 16
055C: MOVLW 07
055D: MOVWF 15
....................
.................... setup_comparator(A0_VR_A1_VR); // inicializace komparatoru pro cidla cary
055E: MOVLW 02
055F: BSF 03.5
0560: MOVWF 1C
0561: MOVF 05,W
0562: IORLW 03
0563: MOVWF 05
0564: MOVLW 03
0565: MOVWF 77
0566: DECFSZ 77,F
0567: GOTO 566
0568: MOVF 1C,W
0569: BCF 03.5
056A: BCF 0D.6
.................... setup_vref(VREF_HIGH|TRESHOLD); // 32 kroku od 0.25 do 0.75 Vdd
056B: MOVLW 8A
056C: BSF 03.5
056D: MOVWF 1D
....................
.................... Beep(1000,200); //double beep
056E: MOVLW 03
056F: MOVWF 75
0570: MOVLW E8
0571: MOVWF 74
0572: CLRF 7D
0573: MOVLW C8
0574: MOVWF 7C
0575: BCF 03.5
0576: CALL 05C
.................... Delay_ms(50);
0577: MOVLW 32
0578: MOVWF 75
0579: CALL 088
.................... Beep(1000,200);
057A: MOVLW 03
057B: MOVWF 75
057C: MOVLW E8
057D: MOVWF 74
057E: CLRF 7D
057F: MOVLW C8
0580: MOVWF 7C
0581: CALL 05C
.................... Delay_ms(1000); // 1s
0582: MOVLW 04
0583: MOVWF 71
0584: MOVLW FA
0585: MOVWF 75
0586: CALL 088
0587: DECFSZ 71,F
0588: GOTO 584
....................
.................... // povoleni rizeni rychlosti zataceni pres preruseni
.................... enable_interrupts(INT_TIMER2);
0589: BSF 03.5
058A: BSF 0C.1
.................... enable_interrupts(GLOBAL);
058B: MOVLW C0
058C: BCF 03.5
058D: IORWF 0B,F
....................
.................... /*---------------------------------------------------------------------------*/
.................... sensors=S;
058E: MOVLW 03
058F: MOVWF 40
.................... line=S;
0590: MOVWF 41
.................... last=S;
0591: MOVWF 44
.................... movement=S;
0592: MOVWF 45
.................... speed=FW_POMALU;
0593: MOVLW E6
0594: MOVWF 42
....................
.................... diagnostika();
0595: GOTO 09D
.................... // cikcak(); // toc se, abys nasel caru
.................... Delay_ms(500);
0596: MOVLW 02
0597: MOVWF 71
0598: MOVLW FA
0599: MOVWF 75
059A: CALL 088
059B: DECFSZ 71,F
059C: GOTO 598
.................... Beep(1000,200);
059D: MOVLW 03
059E: MOVWF 75
059F: MOVLW E8
05A0: MOVWF 74
05A1: CLRF 7D
05A2: MOVLW C8
05A3: MOVWF 7C
05A4: CALL 05C
.................... Delay_ms(500);
05A5: MOVLW 02
05A6: MOVWF 71
05A7: MOVLW FA
05A8: MOVWF 75
05A9: CALL 088
05AA: DECFSZ 71,F
05AB: GOTO 5A7
....................
.................... while(true) // hlavni smycka (jizda podle cary)
.................... {
.................... sensors = RSENSOR; // cteni senzoru na caru
05AC: CLRF 40
05AD: BSF 03.5
05AE: BTFSS 1C.7
05AF: GOTO 5B3
05B0: BCF 03.5
05B1: INCF 40,F
05B2: BSF 03.5
.................... sensors |= LSENSOR << 1;
05B3: MOVLW 00
05B4: BTFSC 1C.6
05B5: MOVLW 01
05B6: MOVWF 77
05B7: BCF 03.0
05B8: RLF 77,F
05B9: MOVF 77,W
05BA: BCF 03.5
05BB: IORWF 40,F
....................
.................... if ((read_adc(ADC_READ_ONLY)<BUMPER_TRESHOLD) && (dira<=T_CIHLA)) objizdka();
05BC: BTFSC 1F.2
05BD: GOTO 5BC
05BE: MOVF 1E,W
05BF: SUBLW 7F
05C0: BTFSS 03.0
05C1: GOTO 5C6
05C2: MOVF 46,W
05C3: SUBLW 32
05C4: BTFSC 03.0
05C5: GOTO 289
....................
.................... switch (sensors) // zatacej podle toho, kde vidis caru
.................... {
05C6: MOVF 40,W
05C7: XORLW 03
05C8: BTFSC 03.2
05C9: GOTO 5D1
05CA: XORLW 01
05CB: BTFSC 03.2
05CC: GOTO 5E5
05CD: XORLW 03
05CE: BTFSC 03.2
05CF: GOTO 61E
05D0: GOTO 657
.................... case S: // rovne
.................... FL; FR; // pokud se jede dlouho rovne, tak pridej
05D1: BSF 03.5
05D2: BCF 06.7
05D3: BCF 03.5
05D4: BCF 06.7
05D5: BSF 03.5
05D6: BCF 06.6
05D7: BCF 03.5
05D8: BSF 06.6
05D9: BSF 03.5
05DA: BCF 06.5
05DB: BCF 03.5
05DC: BCF 06.5
05DD: BSF 03.5
05DE: BCF 06.4
05DF: BCF 03.5
05E0: BSF 06.4
.................... dira=0;
05E1: CLRF 46
.................... movement=S;
05E2: MOVLW 03
05E3: MOVWF 45
.................... continue;
05E4: GOTO 5AC
.................... case L: // trochu vlevo
.................... GO(L, F, FW_POMALU+rovinka); GO(R, F, FW_STREDNE+rovinka);
05E5: MOVF 01,W
05E6: MOVWF 71
05E7: MOVLW E6
05E8: ADDWF 43,W
05E9: SUBWF 71,W
05EA: BTFSC 03.2
05EB: GOTO 5EE
05EC: BTFSC 03.0
05ED: GOTO 5F7
05EE: BSF 03.5
05EF: BCF 06.7
05F0: BCF 03.5
05F1: BCF 06.7
05F2: BSF 03.5
05F3: BCF 06.6
05F4: BCF 03.5
05F5: BSF 06.6
05F6: GOTO 5FF
05F7: BSF 03.5
05F8: BCF 06.6
05F9: BCF 03.5
05FA: BCF 06.6
05FB: BSF 03.5
05FC: BCF 06.7
05FD: BCF 03.5
05FE: BCF 06.7
05FF: MOVF 01,W
0600: MOVWF 71
0601: MOVLW F0
0602: ADDWF 43,W
0603: SUBWF 71,W
0604: BTFSC 03.2
0605: GOTO 608
0606: BTFSC 03.0
0607: GOTO 611
0608: BSF 03.5
0609: BCF 06.5
060A: BCF 03.5
060B: BCF 06.5
060C: BSF 03.5
060D: BCF 06.4
060E: BCF 03.5
060F: BSF 06.4
0610: GOTO 619
0611: BSF 03.5
0612: BCF 06.4
0613: BCF 03.5
0614: BCF 06.4
0615: BSF 03.5
0616: BCF 06.5
0617: BCF 03.5
0618: BCF 06.5
.................... line=L;
0619: MOVLW 02
061A: MOVWF 41
.................... dira=0;
061B: CLRF 46
.................... movement=L;
061C: MOVWF 45
.................... continue;
061D: GOTO 5AC
.................... case R: // trochu vpravo
.................... GO(R, F, FW_POMALU+rovinka); GO(L, F, FW_STREDNE+rovinka);
061E: MOVF 01,W
061F: MOVWF 71
0620: MOVLW E6
0621: ADDWF 43,W
0622: SUBWF 71,W
0623: BTFSC 03.2
0624: GOTO 627
0625: BTFSC 03.0
0626: GOTO 630
0627: BSF 03.5
0628: BCF 06.5
0629: BCF 03.5
062A: BCF 06.5
062B: BSF 03.5
062C: BCF 06.4
062D: BCF 03.5
062E: BSF 06.4
062F: GOTO 638
0630: BSF 03.5
0631: BCF 06.4
0632: BCF 03.5
0633: BCF 06.4
0634: BSF 03.5
0635: BCF 06.5
0636: BCF 03.5
0637: BCF 06.5
0638: MOVF 01,W
0639: MOVWF 71
063A: MOVLW F0
063B: ADDWF 43,W
063C: SUBWF 71,W
063D: BTFSC 03.2
063E: GOTO 641
063F: BTFSC 03.0
0640: GOTO 64A
0641: BSF 03.5
0642: BCF 06.7
0643: BCF 03.5
0644: BCF 06.7
0645: BSF 03.5
0646: BCF 06.6
0647: BCF 03.5
0648: BSF 06.6
0649: GOTO 652
064A: BSF 03.5
064B: BCF 06.6
064C: BCF 03.5
064D: BCF 06.6
064E: BSF 03.5
064F: BCF 06.7
0650: BCF 03.5
0651: BCF 06.7
.................... line=R;
0652: MOVLW 01
0653: MOVWF 41
.................... dira=0;
0654: CLRF 46
.................... movement=R;
0655: MOVWF 45
.................... continue;
0656: GOTO 5AC
.................... default: // kdyz jsou obe cidla mimo caru, tak pokracuj dal
.................... }
.................... rovinka=0;
0657: CLRF 43
.................... if (dira>=T_DIRA) prejeddiru();
0658: MOVF 46,W
0659: SUBLW 56
065A: BTFSS 03.0
065B: GOTO 380
.................... if (last!=line) // pokud si prejel caru z jedne strany na druhou stranu, tak zabrzdi
065C: MOVF 41,W
065D: SUBWF 44,W
065E: BTFSC 03.2
065F: GOTO 664
.................... {
.................... last=line;
0660: MOVF 41,W
0661: MOVWF 44
.................... speed=FW_ZATACKA;
0662: MOVLW C8
0663: MOVWF 42
.................... }
.................... if (L==line) // kdyz jsou obe cidla mimo caru, zatoc na caru
0664: MOVF 41,W
0665: SUBLW 02
0666: BTFSS 03.2
0667: GOTO 688
.................... {
.................... STOPL;
0668: BSF 03.5
0669: BCF 06.6
066A: BCF 03.5
066B: BCF 06.6
066C: BSF 03.5
066D: BCF 06.7
066E: BCF 03.5
066F: BCF 06.7
.................... GO(R, F, speed);
0670: MOVF 01,W
0671: SUBWF 42,W
0672: BTFSS 03.0
0673: GOTO 67D
0674: BSF 03.5
0675: BCF 06.5
0676: BCF 03.5
0677: BCF 06.5
0678: BSF 03.5
0679: BCF 06.4
067A: BCF 03.5
067B: BSF 06.4
067C: GOTO 685
067D: BSF 03.5
067E: BCF 06.4
067F: BCF 03.5
0680: BCF 06.4
0681: BSF 03.5
0682: BCF 06.5
0683: BCF 03.5
0684: BCF 06.5
.................... movement=L;
0685: MOVLW 02
0686: MOVWF 45
.................... }
.................... else
0687: GOTO 6A7
.................... {
.................... STOPR;
0688: BSF 03.5
0689: BCF 06.4
068A: BCF 03.5
068B: BCF 06.4
068C: BSF 03.5
068D: BCF 06.5
068E: BCF 03.5
068F: BCF 06.5
.................... GO(L, F, speed);
0690: MOVF 01,W
0691: SUBWF 42,W
0692: BTFSS 03.0
0693: GOTO 69D
0694: BSF 03.5
0695: BCF 06.7
0696: BCF 03.5
0697: BCF 06.7
0698: BSF 03.5
0699: BCF 06.6
069A: BCF 03.5
069B: BSF 06.6
069C: GOTO 6A5
069D: BSF 03.5
069E: BCF 06.6
069F: BCF 03.5
06A0: BCF 06.6
06A1: BSF 03.5
06A2: BCF 06.7
06A3: BCF 03.5
06A4: BCF 06.7
.................... movement=R;
06A5: MOVLW 01
06A6: MOVWF 45
.................... }
.................... } // while(true)
06A7: GOTO 5AC
.................... }
....................
....................
06A8: SLEEP
Configuration Fuses:
Word 1: 3F38 NOWDT NOPUT MCLR NOBROWNOUT NOLVP NOCPD NOWRT NODEBUG CCPB0 NOPROTECT INTRC_IO
Word 2: 3FFC NOFCMEN NOIESO