📄 taximetro1.lst
字号:
CCS PCM C Compiler, Version 4.023, 25097 30-mar-09 00:02
Filename: C:\Documents and Settings\Andersen\Mis documentos\practicas micros 1\taximetro1.lst
ROM used: 1021 words (12%)
Largest free fragment is 2048
RAM used: 21 (6%) at main() level
46 (12%) worst case
Stack: 6 worst case (5 in main + 1 for interrupts)
*
0000: MOVLW 00
0001: MOVWF 0A
0002: GOTO 347
0003: NOP
0004: MOVWF 7F
0005: SWAPF 03,W
0006: CLRF 03
0007: MOVWF 21
0008: MOVF 0A,W
0009: MOVWF 20
000A: CLRF 0A
000B: MOVF 04,W
000C: MOVWF 22
000D: MOVF 77,W
000E: MOVWF 23
000F: MOVF 78,W
0010: MOVWF 24
0011: MOVF 79,W
0012: MOVWF 25
0013: MOVF 7A,W
0014: MOVWF 26
0015: MOVF 7B,W
0016: MOVWF 27
0017: BCF 03.7
0018: BCF 03.5
0019: BTFSS 0B.5
001A: GOTO 01D
001B: BTFSC 0B.2
001C: GOTO 030
001D: MOVF 22,W
001E: MOVWF 04
001F: MOVF 23,W
0020: MOVWF 77
0021: MOVF 24,W
0022: MOVWF 78
0023: MOVF 25,W
0024: MOVWF 79
0025: MOVF 26,W
0026: MOVWF 7A
0027: MOVF 27,W
0028: MOVWF 7B
0029: MOVF 20,W
002A: MOVWF 0A
002B: SWAPF 21,W
002C: MOVWF 03
002D: SWAPF 7F,F
002E: SWAPF 7F,W
002F: RETFIE
0030: BCF 0A.3
0031: BCF 0A.4
0032: GOTO 05B
.................... #include "C:\Documents and Settings\Andersen\Mis documentos\practicas micros 1\taximetro1.h"
.................... #include <16F877A.h>
.................... //////// Standard Header file for the PIC16F877A device ////////////////
.................... #device PIC16F877A
.................... #list
....................
....................
.................... #FUSES NOWDT //No Watch Dog Timer
.................... #FUSES HS //High speed Osc (> 4mhz)
.................... #FUSES NOPUT //No Power Up Timer
.................... #FUSES NOPROTECT //Code not protected from reading
.................... #FUSES NODEBUG //No Debug mode for ICD
.................... #FUSES NOBROWNOUT //No brownout reset
.................... #FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
.................... #FUSES NOCPD //No EE protection
.................... #FUSES NOWRT //Program memory not write protected
....................
.................... #use delay(clock=4000000)
*
0067: MOVLW 3C
0068: MOVWF 04
0069: BCF 03.7
006A: MOVF 00,W
006B: BTFSC 03.2
006C: GOTO 07B
006D: MOVLW 01
006E: MOVWF 78
006F: CLRF 77
0070: DECFSZ 77,F
0071: GOTO 070
0072: DECFSZ 78,F
0073: GOTO 06F
0074: MOVLW 4A
0075: MOVWF 77
0076: DECFSZ 77,F
0077: GOTO 076
0078: GOTO 079
0079: DECFSZ 00,F
007A: GOTO 06D
007B: RETLW 00
....................
....................
.................... #define LCD_TYPE 2
.................... #include <lcd.c>
.................... ///////////////////////////////////////////////////////////////////////////
.................... //// LCDD.C ////
.................... //// Driver for common LCD modules ////
.................... //// ////
.................... //// lcd_init() Must be called before any other function. ////
.................... //// ////
.................... //// lcd_putc(c) Will display c on the next position of the LCD. ////
.................... //// The following have special meaning: ////
.................... //// \f Clear display ////
.................... //// \n Go to start of second line ////
.................... //// \b Move back one position ////
.................... //// ////
.................... //// lcd_gotoxy(x,y) Set write position on LCD (upper left is 1,1) ////
.................... //// ////
.................... //// lcd_getc(x,y) Returns character at position x,y on LCD ////
.................... //// ////
.................... ///////////////////////////////////////////////////////////////////////////
.................... //// (C) Copyright 1996,2003 Custom Computer Services ////
.................... //// This source code may only be used by licensed users of the CCS C ////
.................... //// compiler. This source code may only be distributed to other ////
.................... //// licensed users of the CCS C compiler. No other use, reproduction ////
.................... //// or distribution is permitted without written permission. ////
.................... //// Derivative programs created using this software in object code ////
.................... //// form are not restricted in any way. ////
.................... ///////////////////////////////////////////////////////////////////////////
....................
.................... // As defined in the following structure the pin connection is as follows:
.................... // D0 enable
.................... // D1 rs
.................... // D2 rw
.................... // D4 D4
.................... // D5 D5
.................... // D6 D6
.................... // D7 D7
.................... //
.................... // LCD pins D0-D3 are not used and PIC D3 is not used.
....................
.................... // Un-comment the following define to use port B
.................... // #define use_portb_lcd TRUE
....................
....................
.................... struct lcd_pin_map { // This structure is overlayed
.................... BOOLEAN enable; // on to an I/O port to gain
.................... BOOLEAN rs; // access to the LCD pins.
.................... BOOLEAN rw; // The bits are allocated from
.................... BOOLEAN unused; // low order up. ENABLE will
.................... int data : 4; // be pin B0.
.................... } lcd;
....................
....................
.................... #if defined use_portb_lcd
.................... #locate lcd = getenv("sfr:PORTB") // This puts the entire structure over the port
.................... #define set_tris_lcd(x) set_tris_b(x)
.................... #else
.................... #locate lcd = getenv("sfr:PORTD") // This puts the entire structure over the port
.................... #define set_tris_lcd(x) set_tris_d(x)
.................... #endif
....................
....................
.................... #define lcd_type 2 // 0=5x7, 1=5x10, 2=2 lines
.................... #define lcd_line_two 0x40 // LCD RAM address for the second line
....................
....................
.................... BYTE const LCD_INIT_STRING[4] = {0x20 | (lcd_type << 2), 0xc, 1, 6};
.................... // These bytes need to be sent to the LCD
.................... // to start it up.
....................
....................
.................... // The following are used for setting
.................... // the I/O port direction register.
....................
.................... struct lcd_pin_map const LCD_WRITE = {0,0,0,0,0}; // For write mode all pins are out
.................... struct lcd_pin_map const LCD_READ = {0,0,0,0,15}; // For read mode data pins are in
....................
....................
....................
.................... BYTE lcd_read_byte() {
.................... BYTE low,high;
.................... set_tris_lcd(LCD_READ);
*
0089: MOVLW F0
008A: BSF 03.5
008B: MOVWF 08
.................... lcd.rw = 1;
008C: BCF 03.5
008D: BSF 08.2
.................... delay_cycles(1);
008E: NOP
.................... lcd.enable = 1;
008F: BSF 08.0
.................... delay_cycles(1);
0090: NOP
.................... high = lcd.data;
0091: MOVF 08,W
0092: SWAPF 08,W
0093: ANDLW 0F
0094: MOVWF 43
.................... lcd.enable = 0;
0095: BCF 08.0
.................... delay_cycles(1);
0096: NOP
.................... lcd.enable = 1;
0097: BSF 08.0
.................... delay_us(1);
0098: NOP
.................... low = lcd.data;
0099: MOVF 08,W
009A: SWAPF 08,W
009B: ANDLW 0F
009C: MOVWF 42
.................... lcd.enable = 0;
009D: BCF 08.0
.................... set_tris_lcd(LCD_WRITE);
009E: MOVLW 00
009F: BSF 03.5
00A0: MOVWF 08
.................... return( (high<<4) | low);
00A1: BCF 03.5
00A2: SWAPF 43,W
00A3: MOVWF 77
00A4: MOVLW F0
00A5: ANDWF 77,F
00A6: MOVF 77,W
00A7: IORWF 42,W
00A8: MOVWF 78
.................... }
....................
....................
.................... void lcd_send_nibble( BYTE n ) {
.................... lcd.data = n;
*
007C: SWAPF 43,W
007D: ANDLW F0
007E: MOVWF 77
007F: MOVLW 0F
0080: ANDWF 08,W
0081: IORWF 77,W
0082: MOVWF 08
.................... delay_cycles(1);
0083: NOP
.................... lcd.enable = 1;
0084: BSF 08.0
.................... delay_us(2);
0085: GOTO 086
.................... lcd.enable = 0;
0086: BCF 08.0
.................... }
0087: RETLW 00
....................
....................
.................... void lcd_send_byte( BYTE address, BYTE n ) {
....................
.................... lcd.rs = 0;
0088: BCF 08.1
.................... while ( bit_test(lcd_read_byte(),7) ) ;
*
00A9: MOVF 78,W
00AA: MOVWF 42
00AB: BTFSC 42.7
00AC: GOTO 089
.................... lcd.rs = address;
00AD: BTFSS 40.0
00AE: BCF 08.1
00AF: BTFSC 40.0
00B0: BSF 08.1
.................... delay_cycles(1);
00B1: NOP
.................... lcd.rw = 0;
00B2: BCF 08.2
.................... delay_cycles(1);
00B3: NOP
.................... lcd.enable = 0;
00B4: BCF 08.0
.................... lcd_send_nibble(n >> 4);
00B5: SWAPF 41,W
00B6: MOVWF 42
00B7: MOVLW 0F
00B8: ANDWF 42,F
00B9: MOVF 42,W
00BA: MOVWF 43
00BB: CALL 07C
.................... lcd_send_nibble(n & 0xf);
00BC: MOVF 41,W
00BD: ANDLW 0F
00BE: MOVWF 42
00BF: MOVWF 43
00C0: CALL 07C
.................... }
00C1: RETLW 00
....................
....................
.................... void lcd_init() {
.................... BYTE i;
.................... set_tris_lcd(LCD_WRITE);
00C2: MOVLW 00
00C3: BSF 03.5
00C4: MOVWF 08
.................... lcd.rs = 0;
00C5: BCF 03.5
00C6: BCF 08.1
.................... lcd.rw = 0;
00C7: BCF 08.2
.................... lcd.enable = 0;
00C8: BCF 08.0
.................... delay_ms(15);
00C9: MOVLW 0F
00CA: MOVWF 3C
00CB: CALL 067
.................... for(i=1;i<=3;++i) {
00CC: MOVLW 01
00CD: MOVWF 2E
00CE: MOVF 2E,W
00CF: SUBLW 03
00D0: BTFSS 03.0
00D1: GOTO 0DA
.................... lcd_send_nibble(3);
00D2: MOVLW 03
00D3: MOVWF 43
00D4: CALL 07C
.................... delay_ms(5);
00D5: MOVLW 05
00D6: MOVWF 3C
00D7: CALL 067
.................... }
00D8: INCF 2E,F
00D9: GOTO 0CE
.................... lcd_send_nibble(2);
00DA: MOVLW 02
00DB: MOVWF 43
00DC: CALL 07C
.................... for(i=0;i<=3;++i)
00DD: CLRF 2E
00DE: MOVF 2E,W
00DF: SUBLW 03
00E0: BTFSS 03.0
00E1: GOTO 0EB
.................... lcd_send_byte(0,LCD_INIT_STRING[i]);
00E2: MOVF 2E,W
00E3: CALL 033
00E4: MOVWF 2F
00E5: CLRF 40
00E6: MOVF 2F,W
00E7: MOVWF 41
00E8: CALL 088
00E9: INCF 2E,F
00EA: GOTO 0DE
.................... }
00EB: BCF 0A.3
00EC: BCF 0A.4
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -