Blame | Last modification | View Log | Download
CCS PCW C Compiler, Version 3.110, 15448
Filename: d:\@kaklik\programy\pic_c\robot\auto\main.LST
ROM used: 188 (18%)
Largest free fragment is 836
RAM used: 4 (11%) at main() level
5 (14%) worst case
Stack: 2 locations
*
0000: MOVLW 00
0001: MOVWF 0A
0002: GOTO 071
0003: NOP
.................... #include "D:\@Kaklik\programy\PIC_C\robot\auto\main.h"
.................... #include <16C84.h>
.................... //////// Standard Header file for the PIC16C84 device ////////////////
.................... #device PIC16C84
.................... #list
....................
.................... #use delay(clock=4000000)
0004: MOVLW 10
0005: MOVWF 04
0006: MOVF 00,W
0007: BTFSC 03.2
0008: GOTO 018
0009: MOVLW 01
000A: MOVWF 0D
000B: CLRF 0C
000C: DECFSZ 0C,F
000D: GOTO 00C
000E: DECFSZ 0D,F
000F: GOTO 00B
0010: MOVLW 4A
0011: MOVWF 0C
0012: DECFSZ 0C,F
0013: GOTO 012
0014: NOP
0015: NOP
0016: DECFSZ 00,F
0017: GOTO 009
0018: RETLW 00
.................... #fuses XT,NOWDT
....................
....................
....................
.................... #DEFINE CIDLO1L PIN_B0
.................... #DEFINE CIDLO1R PIN_B1
.................... #DEFINE CIDLO2L PIN_B2
.................... #DEFINE CIDLO2R PIN_B3
....................
.................... #DEFINE RELE1 PIN_B5
.................... #DEFINE RELE2 PIN_B6
.................... #DEFINE MOTOR1 PIN_B4
.................... #DEFINE MOTOR2 PIN_A0
.................... #DEFINE MOTOR2a PIN_A1
....................
.................... #DEFINE LASER PIN_A2
....................
.................... #DEFINE L 0
.................... #DEFINE R 1
....................
.................... int cara;
.................... int movement;
....................
.................... void left()
.................... {
.................... output_high(RELE1);
*
0041: BSF 03.5
0042: BCF 06.5
0043: BCF 03.5
0044: BSF 06.5
.................... output_high(RELE2);
0045: BSF 03.5
0046: BCF 06.6
0047: BCF 03.5
0048: BSF 06.6
.................... delay_ms(100);
0049: MOVLW 64
004A: MOVWF 10
004B: CALL 004
.................... output_high(MOTOR1);
004C: BSF 03.5
004D: BCF 06.4
004E: BCF 03.5
004F: BSF 06.4
.................... output_high(MOTOR2);
0050: BSF 03.5
0051: BCF 05.0
0052: BCF 03.5
0053: BSF 05.0
.................... output_high(MOTOR2a);
0054: BSF 03.5
0055: BCF 05.1
0056: BCF 03.5
0057: BSF 05.1
0058: GOTO 0A4 (RETURN)
.................... }
....................
.................... void right()
.................... {
.................... output_low(RELE1);
0059: BSF 03.5
005A: BCF 06.5
005B: BCF 03.5
005C: BCF 06.5
.................... output_low(RELE2);
005D: BSF 03.5
005E: BCF 06.6
005F: BCF 03.5
0060: BCF 06.6
.................... delay_ms(100);
0061: MOVLW 64
0062: MOVWF 10
0063: CALL 004
.................... output_high(MOTOR1);
0064: BSF 03.5
0065: BCF 06.4
0066: BCF 03.5
0067: BSF 06.4
.................... output_high(MOTOR2);
0068: BSF 03.5
0069: BCF 05.0
006A: BCF 03.5
006B: BSF 05.0
.................... output_high(MOTOR2a);
006C: BSF 03.5
006D: BCF 05.1
006E: BCF 03.5
006F: BSF 05.1
0070: GOTO 0B1 (RETURN)
.................... }
....................
.................... void rovne()
.................... {
.................... output_low(RELE1); // oba motory vpred
*
0029: BSF 03.5
002A: BCF 06.5
002B: BCF 03.5
002C: BCF 06.5
.................... output_high(RELE2);
002D: BSF 03.5
002E: BCF 06.6
002F: BCF 03.5
0030: BSF 06.6
.................... delay_ms(100);
0031: MOVLW 64
0032: MOVWF 10
0033: CALL 004
.................... output_high(MOTOR1);
0034: BSF 03.5
0035: BCF 06.4
0036: BCF 03.5
0037: BSF 06.4
.................... output_high(MOTOR2);
0038: BSF 03.5
0039: BCF 05.0
003A: BCF 03.5
003B: BSF 05.0
.................... output_high(MOTOR2a);
003C: BSF 03.5
003D: BCF 05.1
003E: BCF 03.5
003F: BSF 05.1
0040: RETLW 00
.................... }
....................
.................... void stop()
.................... {
.................... output_low(MOTOR1);
*
0019: BSF 03.5
001A: BCF 06.4
001B: BCF 03.5
001C: BCF 06.4
.................... output_low(MOTOR2);
001D: BSF 03.5
001E: BCF 05.0
001F: BCF 03.5
0020: BCF 05.0
.................... output_low(MOTOR2a);
0021: BSF 03.5
0022: BCF 05.1
0023: BCF 03.5
0024: BCF 05.1
.................... delay_ms(100);
0025: MOVLW 64
0026: MOVWF 10
0027: CALL 004
0028: RETLW 00
.................... }
....................
....................
.................... void main()
.................... {
*
0071: CLRF 04
0072: MOVLW 1F
0073: ANDWF 03,F
.................... cara=L;
0074: CLRF 0E
.................... movement=R;
0075: MOVLW 01
0076: MOVWF 0F
.................... output_low(RELE1); // oba motory vpred
0077: BSF 03.5
0078: BCF 06.5
0079: BCF 03.5
007A: BCF 06.5
.................... output_high(RELE2);
007B: BSF 03.5
007C: BCF 06.6
007D: BCF 03.5
007E: BSF 06.6
.................... delay_ms(100);
007F: MOVLW 64
0080: MOVWF 10
0081: CALL 004
.................... while (true)
.................... {
.................... if (!input(CIDLO1R)) cara=R; // cara vpravo
0082: BSF 03.5
0083: BSF 06.1
0084: BCF 03.5
0085: BTFSC 06.1
0086: GOTO 089
0087: MOVLW 01
0088: MOVWF 0E
.................... if (!input(CIDLO1L)) cara=L; // cara vlevo
0089: BSF 03.5
008A: BSF 06.0
008B: BCF 03.5
008C: BTFSC 06.0
008D: GOTO 08F
008E: CLRF 0E
....................
....................
.................... if (cara != movement)
008F: MOVF 0F,W
0090: SUBWF 0E,W
0091: BTFSC 03.2
0092: GOTO 0B4
.................... {
.................... switch(cara)
0093: MOVF 0E,W
0094: ADDLW FE
0095: BTFSC 03.0
0096: GOTO 0B4
0097: ADDLW 02
0098: GOTO 0B6
.................... {
.................... case L:
.................... output_high(LASER);
0099: BSF 03.5
009A: BCF 05.2
009B: BCF 03.5
009C: BSF 05.2
.................... stop();
009D: CALL 019
.................... rovne();
009E: CALL 029
.................... delay_ms(100);
009F: MOVLW 64
00A0: MOVWF 10
00A1: CALL 004
.................... stop();
00A2: CALL 019
.................... left();
00A3: GOTO 041
.................... movement=L;
00A4: CLRF 0F
.................... break;
00A5: GOTO 0B4
....................
.................... case R:
.................... stop();
00A6: CALL 019
.................... rovne();
00A7: CALL 029
.................... delay_ms(100);
00A8: MOVLW 64
00A9: MOVWF 10
00AA: CALL 004
.................... output_low(LASER);
00AB: BSF 03.5
00AC: BCF 05.2
00AD: BCF 03.5
00AE: BCF 05.2
.................... stop();
00AF: CALL 019
.................... right();
00B0: GOTO 059
.................... movement=R;
00B1: MOVLW 01
00B2: MOVWF 0F
.................... break;
00B3: GOTO 0B4
.................... }
*
00B6: BCF 0A.0
00B7: BCF 0A.1
00B8: BCF 0A.2
00B9: ADDWF 02,F
00BA: GOTO 099
00BB: GOTO 0A6
.................... }
.................... }
*
00B4: GOTO 082
.................... }
....................
00B5: SLEEP