Go to most recent revision | Blame | Last modification | View Log | Download
CCS PCW C Compiler, Version 3.110, 15448
Filename: d:\kaklik\programy\pic_c\roboti\merkur\main.LST
ROM used: 1572 (38%)
Largest free fragment is 2048
RAM used: 79 (41%) at main() level
90 (47%) worst case
Stack: 3 locations
*
0000: MOVLW 00
0001: MOVWF 0A
0002: GOTO 41D
0003: NOP
.................... #include "main.h"
.................... #include <16F873.h>
.................... //////// Standard Header file for the PIC16F873 device ////////////////
.................... #device PIC16F873
.................... #list
....................
.................... #device adc=8
.................... #use delay(clock=4000000)
*
0016: MOVLW 78
0017: MOVWF 04
0018: MOVLW FC
0019: ANDWF 00,F
001A: RRF 00,F
001B: RRF 00,F
001C: MOVF 00,W
001D: BTFSC 03.2
001E: GOTO 023
001F: GOTO 021
0020: NOP
0021: DECFSZ 00,F
0022: GOTO 020
0023: RETLW 00
*
004A: MOVLW 73
004B: MOVWF 04
004C: MOVF 00,W
004D: BTFSC 03.2
004E: GOTO 05E
004F: MOVLW 01
0050: MOVWF 21
0051: CLRF 20
0052: DECFSZ 20,F
0053: GOTO 052
0054: DECFSZ 21,F
0055: GOTO 051
0056: MOVLW 4A
0057: MOVWF 20
0058: DECFSZ 20,F
0059: GOTO 058
005A: NOP
005B: NOP
005C: DECFSZ 00,F
005D: GOTO 04F
005E: RETLW 00
.................... #fuses XT,NOWDT,NOLVP
....................
....................
....................
.................... #define TXo PIN_C3 // To the transmitter modulator
.................... #include "AX25.c" // podprogram pro prenos telemetrie
.................... //#define PTT PIN_A2 // PTT control
.................... //#define TXo PIN_C0 // To the transmitter modulator
.................... #define PERIODAH delay_us(222) // Halfperiod H 222;78/1200 500;430/500
.................... #define TAILH delay_us(78)
.................... #define PERIODAL delay_us(412) // Halfperiod L 412;345/1200 1000;880/500
.................... #define TAILL delay_us(345)
.................... #byte STATUS = 3 // CPUs status register
....................
.................... byte SendData[16] = {'A'<<1, 'L'<<1, 'L'<<1, ' '<<1, ' '<<1, ' '<<1, 0x60,
.................... 'C'<<1, 'Z'<<1, '0'<<1, 'R'<<1, 'R'<<1, 'R'<<1, 0x61,
.................... 0x03, 0xF0};
....................
.................... boolean bit;
.................... int fcslo, fcshi; // variabloes for calculating FCS (CRC)
.................... int stuff; // stuff counter for extra 0
.................... int flag_flag; // if it is sending flag (7E)
.................... int fcs_flag; // if it is sending Frame Check Sequence
.................... int i; // for for
....................
.................... void flipout() //flips the state of output pin a_1
.................... {
.................... stuff = 0; //since this is a 0, reset the stuff counter
*
00AE: CLRF 38
.................... if (bit)
00AF: BTFSS 35.0
00B0: GOTO 0B3
.................... {
.................... bit=FALSE; //if the state of the pin was low, make it high.
00B1: BCF 35.0
.................... }
.................... else
00B2: GOTO 0B4
.................... {
.................... bit=TRUE; //if the state of the pin was high make it low
00B3: BSF 35.0
.................... }
00B4: RETLW 00
.................... }
....................
.................... void fcsbit(byte tbyte)
.................... {
.................... #asm
.................... BCF STATUS,0
*
011A: BCF 03.0
.................... RRF fcshi,F // rotates the entire 16 bits
011B: RRF 37,F
.................... RRF fcslo,F // to the right
.................... #endasm
011C: RRF 36,F
.................... if (((STATUS & 0x01)^(tbyte)) ==0x01)
011D: MOVF 03,W
011E: ANDLW 01
011F: XORWF 77,W
0120: SUBLW 01
0121: BTFSS 03.2
0122: GOTO 127
.................... {
.................... fcshi = fcshi^0x84;
0123: MOVLW 84
0124: XORWF 37,F
.................... fcslo = fcslo^0x08;
0125: MOVLW 08
0126: XORWF 36,F
.................... }
.................... }
....................
.................... void SendBit ()
.................... {
.................... if (bit)
*
00B5: BTFSS 35.0
00B6: GOTO 0E8
.................... {
.................... output_high(TXo);
00B7: BCF 3C.3
00B8: MOVF 3C,W
00B9: BSF 03.5
00BA: MOVWF 07
00BB: BCF 03.5
00BC: BSF 07.3
.................... PERIODAH;
00BD: MOVLW 49
00BE: MOVWF 20
00BF: DECFSZ 20,F
00C0: GOTO 0BF
00C1: NOP
00C2: NOP
.................... output_low(TXo);
00C3: BCF 3C.3
00C4: MOVF 3C,W
00C5: BSF 03.5
00C6: MOVWF 07
00C7: BCF 03.5
00C8: BCF 07.3
.................... PERIODAH;
00C9: MOVLW 49
00CA: MOVWF 20
00CB: DECFSZ 20,F
00CC: GOTO 0CB
00CD: NOP
00CE: NOP
.................... output_high(TXo);
00CF: BCF 3C.3
00D0: MOVF 3C,W
00D1: BSF 03.5
00D2: MOVWF 07
00D3: BCF 03.5
00D4: BSF 07.3
.................... PERIODAH;
00D5: MOVLW 49
00D6: MOVWF 20
00D7: DECFSZ 20,F
00D8: GOTO 0D7
00D9: NOP
00DA: NOP
.................... output_low(TXo);
00DB: BCF 3C.3
00DC: MOVF 3C,W
00DD: BSF 03.5
00DE: MOVWF 07
00DF: BCF 03.5
00E0: BCF 07.3
.................... TAILH;
00E1: MOVLW 19
00E2: MOVWF 20
00E3: DECFSZ 20,F
00E4: GOTO 0E3
00E5: NOP
00E6: NOP
.................... }
.................... else
00E7: GOTO 0FE
.................... {
.................... output_high(TXo);
00E8: BCF 3C.3
00E9: MOVF 3C,W
00EA: BSF 03.5
00EB: MOVWF 07
00EC: BCF 03.5
00ED: BSF 07.3
.................... PERIODAL;
00EE: MOVLW 89
00EF: MOVWF 20
00F0: DECFSZ 20,F
00F1: GOTO 0F0
.................... output_low(TXo);
00F2: BCF 3C.3
00F3: MOVF 3C,W
00F4: BSF 03.5
00F5: MOVWF 07
00F6: BCF 03.5
00F7: BCF 07.3
.................... TAILL;
00F8: MOVLW 72
00F9: MOVWF 20
00FA: DECFSZ 20,F
00FB: GOTO 0FA
00FC: NOP
00FD: NOP
.................... };
00FE: RETLW 00
.................... }
....................
.................... void SendByte (byte inbyte)
.................... {
.................... int k, bt;
....................
.................... for (k=0;k<8;k++) //do the following for each of the 8 bits in the byte
00FF: CLRF 75
0100: MOVF 75,W
0101: SUBLW 07
0102: BTFSS 03.0
0103: GOTO 149
.................... {
.................... bt = inbyte & 0x01; //strip off the rightmost bit of the byte to be sent (inbyte)
0104: MOVF 74,W
0105: ANDLW 01
0106: MOVWF 76
.................... if ((fcs_flag == FALSE) & (flag_flag == FALSE)) fcsbit(bt); //do FCS calc, but only if this
0107: MOVF 3A,F
0108: BTFSC 03.2
0109: GOTO 10C
010A: MOVLW 00
010B: GOTO 10D
010C: MOVLW 01
010D: MOVWF 77
010E: MOVF 39,F
010F: BTFSC 03.2
0110: GOTO 113
0111: MOVLW 00
0112: GOTO 114
0113: MOVLW 01
0114: ANDWF 77,W
0115: XORLW 00
0116: BTFSC 03.2
0117: GOTO 127
0118: MOVF 76,W
0119: MOVWF 77
.................... //is not a flag or fcs byte
.................... if (bt == 0)
*
0127: MOVF 76,F
0128: BTFSS 03.2
0129: GOTO 12C
.................... {
.................... flipout();
012A: CALL 0AE
.................... } // if this bit is a zero, flip the output state
.................... else
012B: GOTO 144
.................... { //otherwise if it is a 1, do the following:
.................... if (flag_flag == FALSE) stuff++; //increment the count of consequtive 1's
012C: MOVF 39,F
012D: BTFSS 03.2
012E: GOTO 130
012F: INCF 38,F
.................... if ((flag_flag == FALSE) & (stuff == 5))
0130: MOVF 39,F
0131: BTFSC 03.2
0132: GOTO 135
0133: MOVLW 00
0134: GOTO 136
0135: MOVLW 01
0136: MOVWF 77
0137: MOVF 38,W
0138: SUBLW 05
0139: BTFSC 03.2
013A: GOTO 13D
013B: MOVLW 00
013C: GOTO 13E
013D: MOVLW 01
013E: ANDWF 77,W
013F: XORLW 00
0140: BTFSC 03.2
0141: GOTO 144
.................... { //stuff an extra 0, if 5 1's in a row
.................... SendBit();
0142: CALL 0B5
.................... flipout(); //flip the output state to stuff a 0
0143: CALL 0AE
.................... }//end of if
.................... }//end of else
.................... // delay_us(850); //introduces a delay that creates 1200 baud
.................... SendBit();
0144: CALL 0B5
.................... inbyte = inbyte>>1; //go to the next bit in the byte
0145: BCF 03.0
0146: RRF 74,F
.................... }//end of for
0147: INCF 75,F
0148: GOTO 100
0149: RETLW 00
.................... }//end of SendByte
....................
.................... void SendPacket(char *data)
.................... {
.................... bit=FALSE;
*
02CF: BCF 35.0
....................
.................... fcslo=fcshi=0xFF; //The 2 FCS Bytes are initialized to FF
02D0: MOVLW FF
02D1: MOVWF 37
02D2: MOVWF 36
.................... stuff = 0; //The variable stuff counts the number of 1's in a row. When it gets to 5
02D3: CLRF 38
.................... // it is time to stuff a 0.
....................
.................... // output_low(PTT); // Blinking LED
.................... // delay_ms(1000);
.................... // output_high(PTT);
....................
.................... flag_flag = TRUE; //The variable flag is true if you are transmitted flags (7E's) false otherwise.
02D4: MOVLW 01
02D5: MOVWF 39
.................... fcs_flag = FALSE; //The variable fcsflag is true if you are transmitting FCS bytes, false otherwise.
02D6: CLRF 3A
....................
.................... for(i=0; i<10; i++) SendByte(0x7E); //Sends flag bytes. Adjust length for txdelay
02D7: CLRF 3B
02D8: MOVF 3B,W
02D9: SUBLW 09
02DA: BTFSS 03.0
02DB: GOTO 2E1
02DC: MOVLW 7E
02DD: MOVWF 74
02DE: CALL 0FF
02DF: INCF 3B,F
02E0: GOTO 2D8
.................... //each flag takes approx 6.7 ms
.................... flag_flag = FALSE; //done sending flags
02E1: CLRF 39
....................
.................... for(i=0; i<16; i++) SendByte(SendData[i]); //send the packet bytes
02E2: CLRF 3B
02E3: MOVF 3B,W
02E4: SUBLW 0F
02E5: BTFSS 03.0
02E6: GOTO 2F0
02E7: MOVLW 25
02E8: ADDWF 3B,W
02E9: MOVWF 04
02EA: MOVF 00,W
02EB: MOVWF 73
02EC: MOVWF 74
02ED: CALL 0FF
02EE: INCF 3B,F
02EF: GOTO 2E3
....................
.................... for(i=0; 0 != *data; i++)
02F0: CLRF 3B
02F1: MOVF 72,W
02F2: MOVWF 04
02F3: MOVF 00,W
02F4: XORLW 00
02F5: BTFSC 03.2
02F6: GOTO 300
.................... {
.................... SendByte(*data); //send the packet bytes
02F7: MOVF 72,W
02F8: MOVWF 04
02F9: MOVF 00,W
02FA: MOVWF 73
02FB: MOVWF 74
02FC: CALL 0FF
.................... data++;
02FD: INCF 72,F
.................... };
02FE: INCF 3B,F
02FF: GOTO 2F1
....................
.................... fcs_flag = TRUE; //about to send the FCS bytes
0300: MOVLW 01
0301: MOVWF 3A
.................... fcslo =fcslo^0xff; //must XOR them with FF before sending
0302: MOVLW FF
0303: XORWF 36,F
.................... fcshi = fcshi^0xff;
0304: XORWF 37,F
.................... SendByte(fcslo); //send the low byte of fcs
0305: MOVF 36,W
0306: MOVWF 74
0307: CALL 0FF
.................... SendByte(fcshi); //send the high byte of fcs
0308: MOVF 37,W
0309: MOVWF 74
030A: CALL 0FF
.................... fcs_flag = FALSE; //done sending FCS
030B: CLRF 3A
.................... flag_flag = TRUE; //about to send flags
030C: MOVLW 01
030D: MOVWF 39
.................... SendByte(0x7e); // Send a flag to end packet
030E: MOVLW 7E
030F: MOVWF 74
0310: CALL 0FF
.................... }
....................
....................
....................
....................
....................
.................... //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)
.................... #define STOPL output_low(PIN_B6);output_low(PIN_B7)
....................
.................... #define L 0b10 // left
.................... #define R 0b01 // right
.................... #define S 0b11 // straight
....................
.................... #define COUVANI 1600 // couvnuti po zjisteni diry
.................... #define MEZERA 5400 // za jak dlouho bude ztracena cara
.................... #define PRES_DIRU 400 // velikost mezery v care
.................... #define ODEZVA 1 // za jak dlouho po opusteni cary se ma zacit zatacet
.................... #define BRZDENI 100 // doba (v ms) ptrebna k zastaveni jednoho motoru
....................
.................... //cidla
.................... #define RSENSOR 1 // Senzory na caru
.................... #define LSENSOR 0
.................... #define BUMPER PIN_C4 // sensor na cihlu
....................
.................... #define DIAG_SERVO PIN_B0 // Propojka pro diagnosticky mod
.................... #define DIAG_SENSORS PIN_B1 // Propojka pro diagnosticky mod
....................
.................... #DEFINE SOUND_HI PIN_B3
.................... #DEFINE SOUND_LO PIN_B2
....................
.................... char AXstring[40]; // Buffer pro prenos telemetrie
....................
.................... int tresholdL; // rozhodovaci uroven pro prave cidlo
.................... int tresholdR; // rozhodovaci uroven pro prave cidlo
.................... int movement; // smer minuleho pohybu
.................... int line; // na ktere strane byla detekovana cara
.................... unsigned int16 dira; // pocitadlo pro nalezeni preruseni cary
....................
.................... // Primitivni Pipani
.................... void beep(unsigned int16 period, unsigned int16 length)
.................... {
.................... unsigned int16 nn;
....................
.................... for(nn=length; nn>0; nn--)
*
0024: MOVF 75,W
0025: MOVWF 77
0026: MOVF 74,W
0027: MOVWF 76
0028: MOVF 76,F
0029: BTFSS 03.2
002A: GOTO 02E
002B: MOVF 77,F
002C: BTFSC 03.2
002D: GOTO 049
.................... {
.................... output_high(SOUND_HI);output_low(SOUND_LO);
002E: BSF 03.5
002F: BCF 06.3
0030: BCF 03.5
0031: BSF 06.3
0032: BSF 03.5
0033: BCF 06.2
0034: BCF 03.5
0035: BCF 06.2
.................... delay_us(period);
0036: MOVF 72,W
0037: MOVWF 78
0038: CALL 016
.................... output_high(SOUND_LO);output_low(SOUND_HI);
0039: BSF 03.5
003A: BCF 06.2
003B: BCF 03.5
003C: BSF 06.2
003D: BSF 03.5
003E: BCF 06.3
003F: BCF 03.5
0040: BCF 06.3
.................... delay_us(period);
0041: MOVF 72,W
0042: MOVWF 78
0043: CALL 016
.................... }
0044: MOVF 76,W
0045: BTFSC 03.2
0046: DECF 77,F
0047: DECF 76,F
0048: GOTO 028
0049: RETLW 00
.................... }
....................
.................... // Diagnostika pohonu, hejbne vsema motorama ve vsech smerech
.................... void diagnostika()
.................... {
.................... unsigned int16 n;
....................
.................... while (input(DIAG_SERVO)) // Propojka, ktera spousti diagnostiku
*
014A: BSF 03.5
014B: BSF 06.0
014C: BCF 03.5
014D: BTFSS 06.0
014E: GOTO 275
.................... {
.................... for (n=500; n<800; n+=100)
014F: MOVLW 01
0150: MOVWF 6F
0151: MOVLW F4
0152: MOVWF 6E
0153: MOVF 6F,W
0154: SUBLW 03
0155: BTFSS 03.0
0156: GOTO 16B
0157: BTFSS 03.2
0158: GOTO 15D
0159: MOVF 6E,W
015A: SUBLW 1F
015B: BTFSS 03.0
015C: GOTO 16B
.................... {
.................... beep(n,n); //beep UP
015D: MOVF 6F,W
015E: MOVWF 73
015F: MOVF 6E,W
0160: MOVWF 72
0161: MOVF 6F,W
0162: MOVWF 75
0163: MOVF 6E,W
0164: MOVWF 74
0165: CALL 024
.................... };
0166: MOVLW 64
0167: ADDWF 6E,F
0168: BTFSC 03.0
0169: INCF 6F,F
016A: GOTO 153
.................... Delay_ms(1000);
016B: MOVLW 04
016C: MOVWF 72
016D: MOVLW FA
016E: MOVWF 73
016F: CALL 04A
0170: DECFSZ 72,F
0171: GOTO 16D
.................... //zastav vse
.................... STOPL; STOPR;
0172: BSF 03.5
0173: BCF 06.6
0174: BCF 03.5
0175: BCF 06.6
0176: BSF 03.5
0177: BCF 06.7
0178: BCF 03.5
0179: BCF 06.7
017A: BSF 03.5
017B: BCF 06.4
017C: BCF 03.5
017D: BCF 06.4
017E: BSF 03.5
017F: BCF 06.5
0180: BCF 03.5
0181: BCF 06.5
.................... //pravy pas
.................... FR; Delay_ms(1000); STOPR; Delay_ms(1000);
0182: BSF 03.5
0183: BCF 06.5
0184: BCF 03.5
0185: BCF 06.5
0186: BSF 03.5
0187: BCF 06.4
0188: BCF 03.5
0189: BSF 06.4
018A: MOVLW 04
018B: MOVWF 72
018C: MOVLW FA
018D: MOVWF 73
018E: CALL 04A
018F: DECFSZ 72,F
0190: GOTO 18C
0191: BSF 03.5
0192: BCF 06.4
0193: BCF 03.5
0194: BCF 06.4
0195: BSF 03.5
0196: BCF 06.5
0197: BCF 03.5
0198: BCF 06.5
0199: MOVLW 04
019A: MOVWF 72
019B: MOVLW FA
019C: MOVWF 73
019D: CALL 04A
019E: DECFSZ 72,F
019F: GOTO 19B
.................... BR; Delay_ms(1000); STOPR; Delay_ms(1000);
01A0: BSF 03.5
01A1: BCF 06.4
01A2: BCF 03.5
01A3: BCF 06.4
01A4: BSF 03.5
01A5: BCF 06.5
01A6: BCF 03.5
01A7: BSF 06.5
01A8: MOVLW 04
01A9: MOVWF 72
01AA: MOVLW FA
01AB: MOVWF 73
01AC: CALL 04A
01AD: DECFSZ 72,F
01AE: GOTO 1AA
01AF: BSF 03.5
01B0: BCF 06.4
01B1: BCF 03.5
01B2: BCF 06.4
01B3: BSF 03.5
01B4: BCF 06.5
01B5: BCF 03.5
01B6: BCF 06.5
01B7: MOVLW 04
01B8: MOVWF 72
01B9: MOVLW FA
01BA: MOVWF 73
01BB: CALL 04A
01BC: DECFSZ 72,F
01BD: GOTO 1B9
.................... Beep(880,100); Delay_ms(1000);
01BE: MOVLW 03
01BF: MOVWF 73
01C0: MOVLW 70
01C1: MOVWF 72
01C2: CLRF 75
01C3: MOVLW 64
01C4: MOVWF 74
01C5: CALL 024
01C6: MOVLW 04
01C7: MOVWF 72
01C8: MOVLW FA
01C9: MOVWF 73
01CA: CALL 04A
01CB: DECFSZ 72,F
01CC: GOTO 1C8
.................... //levy pas
.................... FL; Delay_ms(1000); STOPL; Delay_ms(1000);
01CD: BSF 03.5
01CE: BCF 06.7
01CF: BCF 03.5
01D0: BCF 06.7
01D1: BSF 03.5
01D2: BCF 06.6
01D3: BCF 03.5
01D4: BSF 06.6
01D5: MOVLW 04
01D6: MOVWF 72
01D7: MOVLW FA
01D8: MOVWF 73
01D9: CALL 04A
01DA: DECFSZ 72,F
01DB: GOTO 1D7
01DC: BSF 03.5
01DD: BCF 06.6
01DE: BCF 03.5
01DF: BCF 06.6
01E0: BSF 03.5
01E1: BCF 06.7
01E2: BCF 03.5
01E3: BCF 06.7
01E4: MOVLW 04
01E5: MOVWF 72
01E6: MOVLW FA
01E7: MOVWF 73
01E8: CALL 04A
01E9: DECFSZ 72,F
01EA: GOTO 1E6
.................... BL; Delay_ms(1000); STOPL; Delay_ms(1000);
01EB: BSF 03.5
01EC: BCF 06.6
01ED: BCF 03.5
01EE: BCF 06.6
01EF: BSF 03.5
01F0: BCF 06.7
01F1: BCF 03.5
01F2: BSF 06.7
01F3: MOVLW 04
01F4: MOVWF 72
01F5: MOVLW FA
01F6: MOVWF 73
01F7: CALL 04A
01F8: DECFSZ 72,F
01F9: GOTO 1F5
01FA: BSF 03.5
01FB: BCF 06.6
01FC: BCF 03.5
01FD: BCF 06.6
01FE: BSF 03.5
01FF: BCF 06.7
0200: BCF 03.5
0201: BCF 06.7
0202: MOVLW 04
0203: MOVWF 72
0204: MOVLW FA
0205: MOVWF 73
0206: CALL 04A
0207: DECFSZ 72,F
0208: GOTO 204
.................... Beep(880,100); Delay_ms(1000);
0209: MOVLW 03
020A: MOVWF 73
020B: MOVLW 70
020C: MOVWF 72
020D: CLRF 75
020E: MOVLW 64
020F: MOVWF 74
0210: CALL 024
0211: MOVLW 04
0212: MOVWF 72
0213: MOVLW FA
0214: MOVWF 73
0215: CALL 04A
0216: DECFSZ 72,F
0217: GOTO 213
.................... //oba pasy
.................... FL; FR; Delay_ms(1000); STOPL; STOPR; Delay_ms(1000);
0218: BSF 03.5
0219: BCF 06.7
021A: BCF 03.5
021B: BCF 06.7
021C: BSF 03.5
021D: BCF 06.6
021E: BCF 03.5
021F: BSF 06.6
0220: BSF 03.5
0221: BCF 06.5
0222: BCF 03.5
0223: BCF 06.5
0224: BSF 03.5
0225: BCF 06.4
0226: BCF 03.5
0227: BSF 06.4
0228: MOVLW 04
0229: MOVWF 72
022A: MOVLW FA
022B: MOVWF 73
022C: CALL 04A
022D: DECFSZ 72,F
022E: GOTO 22A
022F: BSF 03.5
0230: BCF 06.6
0231: BCF 03.5
0232: BCF 06.6
0233: BSF 03.5
0234: BCF 06.7
0235: BCF 03.5
0236: BCF 06.7
0237: BSF 03.5
0238: BCF 06.4
0239: BCF 03.5
023A: BCF 06.4
023B: BSF 03.5
023C: BCF 06.5
023D: BCF 03.5
023E: BCF 06.5
023F: MOVLW 04
0240: MOVWF 72
0241: MOVLW FA
0242: MOVWF 73
0243: CALL 04A
0244: DECFSZ 72,F
0245: GOTO 241
.................... BL; BR; Delay_ms(1000); STOPL; STOPR; Delay_ms(1000);
0246: BSF 03.5
0247: BCF 06.6
0248: BCF 03.5
0249: BCF 06.6
024A: BSF 03.5
024B: BCF 06.7
024C: BCF 03.5
024D: BSF 06.7
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
0256: MOVLW 04
0257: MOVWF 72
0258: MOVLW FA
0259: MOVWF 73
025A: CALL 04A
025B: DECFSZ 72,F
025C: GOTO 258
025D: BSF 03.5
025E: BCF 06.6
025F: BCF 03.5
0260: BCF 06.6
0261: BSF 03.5
0262: BCF 06.7
0263: BCF 03.5
0264: BCF 06.7
0265: BSF 03.5
0266: BCF 06.4
0267: BCF 03.5
0268: BCF 06.4
0269: BSF 03.5
026A: BCF 06.5
026B: BCF 03.5
026C: BCF 06.5
026D: MOVLW 04
026E: MOVWF 72
026F: MOVLW FA
0270: MOVWF 73
0271: CALL 04A
0272: DECFSZ 72,F
0273: GOTO 26F
.................... };
0274: GOTO 14A
....................
.................... while (input(DIAG_SENSORS))
0275: BSF 03.5
0276: BSF 06.1
0277: BCF 03.5
0278: BTFSS 06.1
0279: GOTO 319
.................... {
.................... int ls, rs;
.................... while(!input(BUMPER)){beep(1100,100); Delay_ms(50);}
027A: BSF 3C.4
027B: MOVF 3C,W
027C: BSF 03.5
027D: MOVWF 07
027E: BCF 03.5
027F: BTFSC 07.4
0280: GOTO 28D
0281: MOVLW 04
0282: MOVWF 73
0283: MOVLW 4C
0284: MOVWF 72
0285: CLRF 75
0286: MOVLW 64
0287: MOVWF 74
0288: CALL 024
0289: MOVLW 32
028A: MOVWF 73
028B: CALL 04A
028C: GOTO 27A
.................... set_adc_channel(RSENSOR);
028D: MOVLW 08
028E: MOVWF 21
028F: MOVF 1F,W
0290: ANDLW C7
0291: IORWF 21,W
0292: MOVWF 1F
.................... Delay_us(20);
0293: MOVLW 06
0294: MOVWF 20
0295: DECFSZ 20,F
0296: GOTO 295
0297: NOP
.................... rs=read_adc();
0298: BSF 1F.2
0299: BTFSC 1F.2
029A: GOTO 299
029B: MOVF 1E,W
029C: MOVWF 71
.................... set_adc_channel(LSENSOR);
029D: MOVLW 00
029E: MOVWF 21
029F: MOVF 1F,W
02A0: ANDLW C7
02A1: IORWF 21,W
02A2: MOVWF 1F
.................... Delay_us(20);
02A3: MOVLW 06
02A4: MOVWF 20
02A5: DECFSZ 20,F
02A6: GOTO 2A5
02A7: NOP
.................... ls=read_adc();
02A8: BSF 1F.2
02A9: BTFSC 1F.2
02AA: GOTO 2A9
02AB: MOVF 1E,W
02AC: MOVWF 70
.................... sprintf(AXstring,"L: %U R: %U\0", ls, rs); // Convert DATA to String.
*
0004: BCF 0A.0
0005: BCF 0A.1
0006: BCF 0A.2
0007: ADDWF 02,F
0008: RETLW 4C
0009: RETLW 3A
000A: RETLW 20
000B: RETLW 25
000C: RETLW 55
000D: RETLW 20
000E: RETLW 20
000F: RETLW 52
0010: RETLW 3A
0011: RETLW 20
0012: RETLW 25
0013: RETLW 55
0014: RETLW 00
0015: RETLW 00
*
007C: MOVF 21,W
007D: MOVF 73,W
007E: MOVWF 75
007F: MOVLW 64
0080: MOVWF 76
0081: CALL 067
0082: MOVF 20,W
0083: MOVWF 73
0084: MOVF 21,W
0085: MOVLW 30
0086: BTFSS 03.2
0087: GOTO 08F
0088: BTFSC 74.0
0089: BSF 74.3
008A: BTFSC 74.3
008B: GOTO 095
008C: BTFSC 74.4
008D: MOVLW 20
008E: GOTO 091
008F: BCF 74.3
0090: BCF 74.4
0091: ADDWF 21,F
0092: MOVF 21,W
0093: MOVWF 75
0094: CALL 05F
0095: MOVF 73,W
0096: MOVWF 75
0097: MOVLW 0A
0098: MOVWF 76
0099: CALL 067
009A: MOVF 20,W
009B: MOVWF 73
009C: MOVF 21,W
009D: MOVLW 30
009E: BTFSS 03.2
009F: GOTO 0A4
00A0: BTFSC 74.3
00A1: GOTO 0A8
00A2: BTFSC 74.4
00A3: MOVLW 20
00A4: ADDWF 21,F
00A5: MOVF 21,W
00A6: MOVWF 75
00A7: CALL 05F
00A8: MOVLW 30
00A9: ADDWF 73,F
00AA: MOVF 73,W
00AB: MOVWF 75
00AC: CALL 05F
00AD: RETLW 00
*
02AD: MOVLW 3D
02AE: MOVWF 6B
02AF: MOVLW 4C
02B0: MOVWF 75
02B1: CALL 05F
02B2: MOVLW 3A
02B3: MOVWF 75
02B4: CALL 05F
02B5: MOVLW 20
02B6: MOVWF 75
02B7: CALL 05F
02B8: MOVF 70,W
02B9: MOVWF 73
02BA: MOVLW 18
02BB: MOVWF 74
02BC: CALL 07C
02BD: MOVLW 05
02BE: MOVWF 72
02BF: MOVF 72,W
02C0: CALL 004
02C1: INCF 72,F
02C2: MOVWF 75
02C3: CALL 05F
02C4: MOVLW 0A
02C5: SUBWF 72,W
02C6: BTFSS 03.2
02C7: GOTO 2BF
02C8: MOVF 71,W
02C9: MOVWF 73
02CA: MOVLW 18
02CB: MOVWF 74
02CC: CALL 07C
.................... SendPacket(&AXstring[0]);
02CD: MOVLW 3D
02CE: MOVWF 72
.................... delay_ms(1000);
*
0311: MOVLW 04
0312: MOVWF 72
0313: MOVLW FA
0314: MOVWF 73
0315: CALL 04A
0316: DECFSZ 72,F
0317: GOTO 313
.................... };
0318: GOTO 275
0319: BCF 0A.3
031A: GOTO 45E (RETURN)
.................... }
....................
.................... void cikcak()
.................... {
.................... int n;
.................... switch(movement) // podivej se na jednu stranu
*
0364: MOVLW 01
0365: SUBWF 67,W
0366: ADDLW FD
0367: BTFSC 03.0
0368: GOTO 3A4
0369: ADDLW 03
036A: GOTO 410
.................... {
.................... case L:
.................... FL;BR;
036B: BSF 03.5
036C: BCF 06.7
036D: BCF 03.5
036E: BCF 06.7
036F: BSF 03.5
0370: BCF 06.6
0371: BCF 03.5
0372: BSF 06.6
0373: BSF 03.5
0374: BCF 06.4
0375: BCF 03.5
0376: BCF 06.4
0377: BSF 03.5
0378: BCF 06.5
0379: BCF 03.5
037A: BSF 06.5
.................... movement=R;
037B: MOVLW 01
037C: MOVWF 67
.................... break;
037D: GOTO 3A4
.................... case R:
.................... FR;BL;
037E: BSF 03.5
037F: BCF 06.5
0380: BCF 03.5
0381: BCF 06.5
0382: BSF 03.5
0383: BCF 06.4
0384: BCF 03.5
0385: BSF 06.4
0386: BSF 03.5
0387: BCF 06.6
0388: BCF 03.5
0389: BCF 06.6
038A: BSF 03.5
038B: BCF 06.7
038C: BCF 03.5
038D: BSF 06.7
.................... movement=L;
038E: MOVLW 02
038F: MOVWF 67
.................... break;
0390: GOTO 3A4
.................... case S:
.................... FR;BL;
0391: BSF 03.5
0392: BCF 06.5
0393: BCF 03.5
0394: BCF 06.5
0395: BSF 03.5
0396: BCF 06.4
0397: BCF 03.5
0398: BSF 06.4
0399: BSF 03.5
039A: BCF 06.6
039B: BCF 03.5
039C: BCF 06.6
039D: BSF 03.5
039E: BCF 06.7
039F: BCF 03.5
03A0: BSF 06.7
.................... movement=L;
03A1: MOVLW 02
03A2: MOVWF 67
.................... break;
03A3: GOTO 3A4
.................... }
*
0410: BCF 0A.0
0411: BCF 0A.1
0412: BSF 0A.2
0413: ADDWF 02,F
0414: GOTO 37E
0415: GOTO 36B
0416: GOTO 391
.................... set_adc_channel(LSENSOR);
*
03A4: MOVLW 00
03A5: MOVWF 21
03A6: MOVF 1F,W
03A7: ANDLW C7
03A8: IORWF 21,W
03A9: MOVWF 1F
.................... Delay_us(10);
03AA: MOVLW 03
03AB: MOVWF 20
03AC: DECFSZ 20,F
03AD: GOTO 3AC
.................... while (tresholdL < read_adc()) // je tam cara??
03AE: BSF 1F.2
03AF: BTFSC 1F.2
03B0: GOTO 3AF
03B1: MOVF 1E,W
03B2: SUBWF 65,W
03B3: BTFSC 03.0
03B4: GOTO 3FC
.................... {
.................... if (n==50) // asi bude na druhe strane
03B5: MOVF 6E,W
03B6: SUBLW 32
03B7: BTFSS 03.2
03B8: GOTO 3F7
.................... {
.................... STOPR;STOPL;
03B9: BSF 03.5
03BA: BCF 06.4
03BB: BCF 03.5
03BC: BCF 06.4
03BD: BSF 03.5
03BE: BCF 06.5
03BF: BCF 03.5
03C0: BCF 06.5
03C1: BSF 03.5
03C2: BCF 06.6
03C3: BCF 03.5
03C4: BCF 06.6
03C5: BSF 03.5
03C6: BCF 06.7
03C7: BCF 03.5
03C8: BCF 06.7
.................... n=0;
03C9: CLRF 6E
.................... switch(movement)
03CA: MOVLW 01
03CB: SUBWF 67,W
03CC: ADDLW FE
03CD: BTFSC 03.0
03CE: GOTO 3F7
03CF: ADDLW 02
03D0: GOTO 417
.................... {
.................... case L:
.................... FL;BR;
03D1: BSF 03.5
03D2: BCF 06.7
03D3: BCF 03.5
03D4: BCF 06.7
03D5: BSF 03.5
03D6: BCF 06.6
03D7: BCF 03.5
03D8: BSF 06.6
03D9: BSF 03.5
03DA: BCF 06.4
03DB: BCF 03.5
03DC: BCF 06.4
03DD: BSF 03.5
03DE: BCF 06.5
03DF: BCF 03.5
03E0: BSF 06.5
.................... movement=R;
03E1: MOVLW 01
03E2: MOVWF 67
.................... break;
03E3: GOTO 3F7
.................... case R:
.................... FR;BL;
03E4: BSF 03.5
03E5: BCF 06.5
03E6: BCF 03.5
03E7: BCF 06.5
03E8: BSF 03.5
03E9: BCF 06.4
03EA: BCF 03.5
03EB: BSF 06.4
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
.................... movement=L;
03F4: MOVLW 02
03F5: MOVWF 67
.................... break;
03F6: GOTO 3F7
.................... }
*
0417: BCF 0A.0
0418: BCF 0A.1
0419: BSF 0A.2
041A: ADDWF 02,F
041B: GOTO 3E4
041C: GOTO 3D1
.................... }
.................... Delay_ms(5);
*
03F7: MOVLW 05
03F8: MOVWF 73
03F9: CALL 04A
.................... n++;
03FA: INCF 6E,F
.................... }
03FB: GOTO 3AE
.................... STOPL;STOPR; // nasli jsme caru
03FC: BSF 03.5
03FD: BCF 06.6
03FE: BCF 03.5
03FF: BCF 06.6
0400: BSF 03.5
0401: BCF 06.7
0402: BCF 03.5
0403: BCF 06.7
0404: BSF 03.5
0405: BCF 06.4
0406: BCF 03.5
0407: BCF 06.4
0408: BSF 03.5
0409: BCF 06.5
040A: BCF 03.5
040B: BCF 06.5
.................... line=S;
040C: MOVLW 03
040D: MOVWF 68
040E: BCF 0A.3
040F: GOTO 610 (RETURN)
.................... }
.................... void objizdka()
.................... {
.................... BL;BR;Delay_ms(300);
*
031B: BSF 03.5
031C: BCF 06.6
031D: BCF 03.5
031E: BCF 06.6
031F: BSF 03.5
0320: BCF 06.7
0321: BCF 03.5
0322: BSF 06.7
0323: BSF 03.5
0324: BCF 06.4
0325: BCF 03.5
0326: BCF 06.4
0327: BSF 03.5
0328: BCF 06.5
0329: BCF 03.5
032A: BSF 06.5
032B: MOVLW 02
032C: MOVWF 6E
032D: MOVLW 96
032E: MOVWF 73
032F: CALL 04A
0330: DECFSZ 6E,F
0331: GOTO 32D
.................... STOPR;STOPL;
0332: BSF 03.5
0333: BCF 06.4
0334: BCF 03.5
0335: BCF 06.4
0336: BSF 03.5
0337: BCF 06.5
0338: BCF 03.5
0339: BCF 06.5
033A: BSF 03.5
033B: BCF 06.6
033C: BCF 03.5
033D: BCF 06.6
033E: BSF 03.5
033F: BCF 06.7
0340: BCF 03.5
0341: BCF 06.7
.................... beep(1000,1000);
0342: MOVLW 03
0343: MOVWF 73
0344: MOVLW E8
0345: MOVWF 72
0346: MOVLW 03
0347: MOVWF 75
0348: MOVLW E8
0349: MOVWF 74
034A: CALL 024
.................... Delay_ms(500);
034B: MOVLW 02
034C: MOVWF 6E
034D: MOVLW FA
034E: MOVWF 73
034F: CALL 04A
0350: DECFSZ 6E,F
0351: GOTO 34D
.................... beep(1000,1000);
0352: MOVLW 03
0353: MOVWF 73
0354: MOVLW E8
0355: MOVWF 72
0356: MOVLW 03
0357: MOVWF 75
0358: MOVLW E8
0359: MOVWF 74
035A: CALL 024
.................... Delay_ms(1000);
035B: MOVLW 04
035C: MOVWF 6E
035D: MOVLW FA
035E: MOVWF 73
035F: CALL 04A
0360: DECFSZ 6E,F
0361: GOTO 35D
0362: BCF 0A.3
0363: GOTO 48A (RETURN)
....................
.................... }
.................... void kalibrace()
.................... {
.................... unsigned int16 i;
.................... int min;
.................... int max;
.................... int current;
.................... int treshold;
....................
.................... FL; BR; Delay_ms(130);
.................... chyba1:
.................... FR; BL; //kalibrace leveho cidla
.................... set_adc_channel(LSENSOR);
.................... Delay_us(20);
.................... min=max=read_adc();
.................... for (i=1;i<=500;i++)
.................... {
.................... current=read_adc();
.................... if (max < current) max=current;
.................... if (min > current) min=current;
.................... Delay_us(500);
.................... }
.................... FL; BR;
.................... for (i=1;i<=500;i++)
.................... {
.................... current=read_adc();
.................... if (max < current) max=current;
.................... if (min > current) min=current;
.................... Delay_us(500);
.................... }
.................... STOPL; STOPR; Delay_ms(200);
.................... if((max-min)<50) {Beep(1000,300); GOTO chyba1;}
.................... treshold=(max-min)>>1;
.................... tresholdL=treshold+min;
....................
.................... chyba2:
.................... FR; BL;
.................... set_adc_channel(RSENSOR);
.................... Delay_us(20);
.................... min=max=read_adc(); //naplneni min a max nejakou rozumnou hodnotou
.................... for (i=1;i<=500 ;i++)
.................... {
.................... current=read_adc();
.................... if (max < current) max=current; //zmereni minima a maxima
.................... if (min > current) min=current;
.................... Delay_us(500);
.................... }
.................... FL; BR;
.................... for (i=1;i<=500 ;i++)
.................... {
.................... current=read_adc();
.................... if (max < current) max=current; //zmereni minima a maxima
.................... if (min > current) min=current;
.................... Delay_us(500);
.................... }
.................... STOPL; STOPR; Delay_ms(200);
.................... if((max-min)<50) {Beep(1000,300); GOTO chyba2;}
.................... treshold=(max-min)>>1;
.................... tresholdR=treshold+min;
....................
.................... FR; BL;
.................... movement=L;
.................... set_adc_channel(LSENSOR);
.................... Delay_us(20);
.................... while (tresholdL < read_adc()) Delay_us(100);
.................... FL; BR; Delay_ms(50);
.................... STOPL; STOPR; Delay_ms(500);
.................... Beep(780,200);
.................... }
....................
.................... void main()
.................... {
.................... unsigned int16 rovne; // pocita delku rovne cary
*
041D: CLRF 04
041E: MOVLW 1F
041F: ANDWF 03,F
0420: MOVLW 07
0421: BSF 03.5
0422: MOVWF 1F
0423: MOVLW 82
0424: BCF 03.5
0425: MOVWF 25
0426: MOVLW 98
0427: MOVWF 26
0428: MOVWF 27
0429: MOVLW 40
042A: MOVWF 28
042B: MOVWF 29
042C: MOVWF 2A
042D: MOVLW 60
042E: MOVWF 2B
042F: MOVLW 86
0430: MOVWF 2C
0431: MOVLW B4
0432: MOVWF 2D
0433: MOVLW 60
0434: MOVWF 2E
0435: MOVLW A4
0436: MOVWF 2F
0437: MOVWF 30
0438: MOVWF 31
0439: MOVLW 61
043A: MOVWF 32
043B: MOVLW 03
043C: MOVWF 33
043D: MOVLW F0
043E: MOVWF 34
043F: MOVLW FF
0440: MOVWF 3C
0441: CLRF 6B
....................
.................... STOPL; STOPR;
0442: BSF 03.5
0443: BCF 06.6
0444: BCF 03.5
0445: BCF 06.6
0446: BSF 03.5
0447: BCF 06.7
0448: BCF 03.5
0449: BCF 06.7
044A: BSF 03.5
044B: BCF 06.4
044C: BCF 03.5
044D: BCF 06.4
044E: BSF 03.5
044F: BCF 06.5
0450: BCF 03.5
0451: BCF 06.5
....................
.................... setup_adc_ports(RA0_RA1_RA3_ANALOG);
0452: MOVLW 04
0453: BSF 03.5
0454: MOVWF 1F
.................... setup_adc(ADC_CLOCK_DIV_2);
0455: BCF 03.5
0456: MOVF 1F,W
0457: ANDLW 38
0458: IORLW 01
0459: MOVWF 1F
....................
.................... port_b_pullups(false);
045A: BSF 03.5
045B: BSF 01.7
....................
.................... diagnostika();
045C: BCF 03.5
045D: GOTO 14A
....................
.................... Beep(1000,200); //double beep
045E: MOVLW 03
045F: MOVWF 73
0460: MOVLW E8
0461: MOVWF 72
0462: CLRF 75
0463: MOVLW C8
0464: MOVWF 74
0465: CALL 024
.................... Delay_ms(50);
0466: MOVLW 32
0467: MOVWF 73
0468: CALL 04A
.................... Beep(1000,200);
0469: MOVLW 03
046A: MOVWF 73
046B: MOVLW E8
046C: MOVWF 72
046D: CLRF 75
046E: MOVLW C8
046F: MOVWF 74
0470: CALL 024
.................... Delay_ms(1000); // 1s
0471: MOVLW 04
0472: MOVWF 6E
0473: MOVLW FA
0474: MOVWF 73
0475: CALL 04A
0476: DECFSZ 6E,F
0477: GOTO 473
....................
.................... // kalibrace();
.................... tresholdl=tresholdr=80;
0478: MOVLW 50
0479: MOVWF 66
047A: MOVWF 65
.................... // FL; FR;
.................... movement=S;
047B: MOVLW 03
047C: MOVWF 67
.................... line=S;
047D: MOVWF 68
.................... dira=0;
047E: CLRF 6A
047F: CLRF 69
.................... rovne=0;
0480: CLRF 6D
0481: CLRF 6C
....................
.................... while(true)
.................... {
.................... if(!input(BUMPER)) objizdka();
0482: BSF 3C.4
0483: MOVF 3C,W
0484: BSF 03.5
0485: MOVWF 07
0486: BCF 03.5
0487: BTFSC 07.4
0488: GOTO 48A
0489: GOTO 31B
.................... line=0;
048A: CLRF 68
.................... set_adc_channel(RSENSOR); // podivej se jestli neni cara pod pravym cidlem
048B: MOVLW 08
048C: MOVWF 21
048D: MOVF 1F,W
048E: ANDLW C7
048F: IORWF 21,W
0490: MOVWF 1F
.................... Delay_us(10);
0491: MOVLW 03
0492: MOVWF 20
0493: DECFSZ 20,F
0494: GOTO 493
.................... if(tresholdR > read_adc())
0495: BSF 1F.2
0496: BTFSC 1F.2
0497: GOTO 496
0498: MOVF 1E,W
0499: SUBWF 66,W
049A: BTFSC 03.2
049B: GOTO 4A2
049C: BTFSS 03.0
049D: GOTO 4A2
.................... {
.................... dira=0;
049E: CLRF 6A
049F: CLRF 69
.................... line=R;
04A0: MOVLW 01
04A1: MOVWF 68
.................... }
.................... set_adc_channel(LSENSOR); // kdyz cara nebyla pod pravym cidlem, mozna bude pod levym
04A2: MOVLW 00
04A3: MOVWF 21
04A4: MOVF 1F,W
04A5: ANDLW C7
04A6: IORWF 21,W
04A7: MOVWF 1F
.................... Delay_us(10);
04A8: MOVLW 03
04A9: MOVWF 20
04AA: DECFSZ 20,F
04AB: GOTO 4AA
.................... if(tresholdL > read_adc())
04AC: BSF 1F.2
04AD: BTFSC 1F.2
04AE: GOTO 4AD
04AF: MOVF 1E,W
04B0: SUBWF 65,W
04B1: BTFSC 03.2
04B2: GOTO 4B8
04B3: BTFSS 03.0
04B4: GOTO 4B8
.................... {
.................... dira=0;
04B5: CLRF 6A
04B6: CLRF 69
.................... line=line | L;
04B7: BSF 68.1
.................... }
....................
.................... switch(line)
04B8: MOVF 68,W
04B9: MOVWF 20
04BA: MOVLW 03
04BB: SUBWF 20,W
04BC: BTFSC 03.2
04BD: GOTO 4C7
04BE: MOVLW 02
04BF: SUBWF 20,W
04C0: BTFSC 03.2
04C1: GOTO 4DA
04C2: MOVLW 01
04C3: SUBWF 20,W
04C4: BTFSC 03.2
04C5: GOTO 4ED
04C6: GOTO 500
.................... {
.................... case S:
.................... FR;FL;
04C7: BSF 03.5
04C8: BCF 06.5
04C9: BCF 03.5
04CA: BCF 06.5
04CB: BSF 03.5
04CC: BCF 06.4
04CD: BCF 03.5
04CE: BSF 06.4
04CF: BSF 03.5
04D0: BCF 06.7
04D1: BCF 03.5
04D2: BCF 06.7
04D3: BSF 03.5
04D4: BCF 06.6
04D5: BCF 03.5
04D6: BSF 06.6
.................... movement=S;
04D7: MOVLW 03
04D8: MOVWF 67
.................... continue;
04D9: GOTO 482
.................... case L:
.................... STOPL;
04DA: BSF 03.5
04DB: BCF 06.6
04DC: BCF 03.5
04DD: BCF 06.6
04DE: BSF 03.5
04DF: BCF 06.7
04E0: BCF 03.5
04E1: BCF 06.7
.................... FR;movement=L;
04E2: BSF 03.5
04E3: BCF 06.5
04E4: BCF 03.5
04E5: BCF 06.5
04E6: BSF 03.5
04E7: BCF 06.4
04E8: BCF 03.5
04E9: BSF 06.4
04EA: MOVLW 02
04EB: MOVWF 67
.................... continue;
04EC: GOTO 482
.................... case R:
.................... STOPR;
04ED: BSF 03.5
04EE: BCF 06.4
04EF: BCF 03.5
04F0: BCF 06.4
04F1: BSF 03.5
04F2: BCF 06.5
04F3: BCF 03.5
04F4: BCF 06.5
.................... FL;movement=R;
04F5: BSF 03.5
04F6: BCF 06.7
04F7: BCF 03.5
04F8: BCF 06.7
04F9: BSF 03.5
04FA: BCF 06.6
04FB: BCF 03.5
04FC: BSF 06.6
04FD: MOVLW 01
04FE: MOVWF 67
.................... continue;
04FF: GOTO 482
.................... default:
.................... }
....................
.................... if (dira==ODEZVA) // kdyz uz chvili jedeme po bile plose
0500: DECFSZ 69,W
0501: GOTO 54A
0502: MOVF 6A,F
0503: BTFSS 03.2
0504: GOTO 54A
.................... {
.................... //BR;BL;Delay_us(rovne >>= 5);
.................... rovne=0; //kdyz sme museli zatocit, uz neni rovna cara
0505: CLRF 6D
0506: CLRF 6C
....................
.................... switch (line) // musime zatocit
0507: MOVLW 01
0508: SUBWF 68,W
0509: ADDLW FE
050A: BTFSC 03.0
050B: GOTO 54A
050C: ADDLW 02
050D: GOTO 617
.................... {
.................... case L:
.................... BL;Delay_ms(BRZDENI);STOPL;
050E: BSF 03.5
050F: BCF 06.6
0510: BCF 03.5
0511: BCF 06.6
0512: BSF 03.5
0513: BCF 06.7
0514: BCF 03.5
0515: BSF 06.7
0516: MOVLW 64
0517: MOVWF 73
0518: CALL 04A
0519: BSF 03.5
051A: BCF 06.6
051B: BCF 03.5
051C: BCF 06.6
051D: BSF 03.5
051E: BCF 06.7
051F: BCF 03.5
0520: BCF 06.7
.................... FR;
0521: BSF 03.5
0522: BCF 06.5
0523: BCF 03.5
0524: BCF 06.5
0525: BSF 03.5
0526: BCF 06.4
0527: BCF 03.5
0528: BSF 06.4
.................... movement=L;
0529: MOVLW 02
052A: MOVWF 67
.................... break;
052B: GOTO 54A
.................... case R:
.................... BR;Delay_ms(BRZDENI);STOPR;
052C: BSF 03.5
052D: BCF 06.4
052E: BCF 03.5
052F: BCF 06.4
0530: BSF 03.5
0531: BCF 06.5
0532: BCF 03.5
0533: BSF 06.5
0534: MOVLW 64
0535: MOVWF 73
0536: CALL 04A
0537: BSF 03.5
0538: BCF 06.4
0539: BCF 03.5
053A: BCF 06.4
053B: BSF 03.5
053C: BCF 06.5
053D: BCF 03.5
053E: BCF 06.5
.................... FL;
053F: BSF 03.5
0540: BCF 06.7
0541: BCF 03.5
0542: BCF 06.7
0543: BSF 03.5
0544: BCF 06.6
0545: BCF 03.5
0546: BSF 06.6
.................... movement=R;
0547: MOVLW 01
0548: MOVWF 67
.................... break;
0549: GOTO 54A
.................... }
*
0617: BCF 0A.0
0618: BSF 0A.1
0619: BSF 0A.2
061A: ADDWF 02,F
061B: GOTO 52C
061C: GOTO 50E
.................... }
.................... if (dira==MEZERA) // kdyz zkoncila cara
*
054A: MOVF 69,W
054B: SUBLW 18
054C: BTFSS 03.2
054D: GOTO 612
054E: MOVF 6A,W
054F: SUBLW 15
0550: BTFSS 03.2
0551: GOTO 612
.................... {
.................... beep(800,500);
0552: MOVLW 03
0553: MOVWF 73
0554: MOVLW 20
0555: MOVWF 72
0556: MOVLW 01
0557: MOVWF 75
0558: MOVLW F4
0559: MOVWF 74
055A: CALL 024
.................... Delay_ms(50);
055B: MOVLW 32
055C: MOVWF 73
055D: CALL 04A
.................... beep(800,500);
055E: MOVLW 03
055F: MOVWF 73
0560: MOVLW 20
0561: MOVWF 72
0562: MOVLW 01
0563: MOVWF 75
0564: MOVLW F4
0565: MOVWF 74
0566: CALL 024
.................... switch (movement) //vrat se zpet na caru
0567: MOVLW 01
0568: SUBWF 67,W
0569: ADDLW FD
056A: BTFSC 03.0
056B: GOTO 5E6
056C: ADDLW 03
056D: GOTO 61D
.................... {
.................... case L:
.................... STOPL;STOPR;
056E: BSF 03.5
056F: BCF 06.6
0570: BCF 03.5
0571: BCF 06.6
0572: BSF 03.5
0573: BCF 06.7
0574: BCF 03.5
0575: BCF 06.7
0576: BSF 03.5
0577: BCF 06.4
0578: BCF 03.5
0579: BCF 06.4
057A: BSF 03.5
057B: BCF 06.5
057C: BCF 03.5
057D: BCF 06.5
.................... BR;Delay_ms(COUVANI);STOPR;
057E: BSF 03.5
057F: BCF 06.4
0580: BCF 03.5
0581: BCF 06.4
0582: BSF 03.5
0583: BCF 06.5
0584: BCF 03.5
0585: BSF 06.5
0586: MOVLW 08
0587: MOVWF 6E
0588: MOVLW C8
0589: MOVWF 73
058A: CALL 04A
058B: DECFSZ 6E,F
058C: GOTO 588
058D: BSF 03.5
058E: BCF 06.4
058F: BCF 03.5
0590: BCF 06.4
0591: BSF 03.5
0592: BCF 06.5
0593: BCF 03.5
0594: BCF 06.5
.................... break;
0595: GOTO 5E6
.................... case R:
.................... STOPL;STOPR;
0596: BSF 03.5
0597: BCF 06.6
0598: BCF 03.5
0599: BCF 06.6
059A: BSF 03.5
059B: BCF 06.7
059C: BCF 03.5
059D: BCF 06.7
059E: BSF 03.5
059F: BCF 06.4
05A0: BCF 03.5
05A1: BCF 06.4
05A2: BSF 03.5
05A3: BCF 06.5
05A4: BCF 03.5
05A5: BCF 06.5
.................... BL;Delay_ms(COUVANI);STOPL;
05A6: BSF 03.5
05A7: BCF 06.6
05A8: BCF 03.5
05A9: BCF 06.6
05AA: BSF 03.5
05AB: BCF 06.7
05AC: BCF 03.5
05AD: BSF 06.7
05AE: MOVLW 08
05AF: MOVWF 6E
05B0: MOVLW C8
05B1: MOVWF 73
05B2: CALL 04A
05B3: DECFSZ 6E,F
05B4: GOTO 5B0
05B5: BSF 03.5
05B6: BCF 06.6
05B7: BCF 03.5
05B8: BCF 06.6
05B9: BSF 03.5
05BA: BCF 06.7
05BB: BCF 03.5
05BC: BCF 06.7
.................... break;
05BD: GOTO 5E6
.................... case S:
.................... BL; BR; Delay_ms(COUVANI);
05BE: BSF 03.5
05BF: BCF 06.6
05C0: BCF 03.5
05C1: BCF 06.6
05C2: BSF 03.5
05C3: BCF 06.7
05C4: BCF 03.5
05C5: BSF 06.7
05C6: BSF 03.5
05C7: BCF 06.4
05C8: BCF 03.5
05C9: BCF 06.4
05CA: BSF 03.5
05CB: BCF 06.5
05CC: BCF 03.5
05CD: BSF 06.5
05CE: MOVLW 08
05CF: MOVWF 6E
05D0: MOVLW C8
05D1: MOVWF 73
05D2: CALL 04A
05D3: DECFSZ 6E,F
05D4: GOTO 5D0
.................... STOPL; STOPR;
05D5: BSF 03.5
05D6: BCF 06.6
05D7: BCF 03.5
05D8: BCF 06.6
05D9: BSF 03.5
05DA: BCF 06.7
05DB: BCF 03.5
05DC: BCF 06.7
05DD: BSF 03.5
05DE: BCF 06.4
05DF: BCF 03.5
05E0: BCF 06.4
05E1: BSF 03.5
05E2: BCF 06.5
05E3: BCF 03.5
05E4: BCF 06.5
.................... break;
05E5: GOTO 5E6
.................... }
*
061D: BCF 0A.0
061E: BSF 0A.1
061F: BSF 0A.2
0620: ADDWF 02,F
0621: GOTO 596
0622: GOTO 56E
0623: GOTO 5BE
....................
.................... FR;FL; Delay_ms(PRES_DIRU); // popojedem dopredu mozna tam bude cara
*
05E6: BSF 03.5
05E7: BCF 06.5
05E8: BCF 03.5
05E9: BCF 06.5
05EA: BSF 03.5
05EB: BCF 06.4
05EC: BCF 03.5
05ED: BSF 06.4
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: MOVLW 02
05F7: MOVWF 6E
05F8: MOVLW C8
05F9: MOVWF 73
05FA: CALL 04A
05FB: DECFSZ 6E,F
05FC: GOTO 5F8
.................... STOPL; STOPR; movement=S;
05FD: BSF 03.5
05FE: BCF 06.6
05FF: BCF 03.5
0600: BCF 06.6
0601: BSF 03.5
0602: BCF 06.7
0603: BCF 03.5
0604: BCF 06.7
0605: BSF 03.5
0606: BCF 06.4
0607: BCF 03.5
0608: BCF 06.4
0609: BSF 03.5
060A: BCF 06.5
060B: BCF 03.5
060C: BCF 06.5
060D: MOVLW 03
060E: MOVWF 67
.................... cikcak(); // najdi caru
060F: GOTO 364
.................... dira=0;
0610: CLRF 6A
0611: CLRF 69
.................... }
.................... dira++;
0612: INCF 69,F
0613: BTFSC 03.2
0614: INCF 6A,F
.................... } // while(true)
0615: GOTO 482
.................... }
....................
0616: SLEEP