/Designs/Measuring_instruments/GM_counter/SW/counter/main.lst
0,0 → 1,2119
CCS PCM C Compiler, Version 4.106, 47914 22-5-13 12:34
 
Filename: D:\Honza\MLAB\Designs\Measuring_instruments\GM_counter\SW\counter\main.lst
 
ROM used: 2825 words (34%)
Largest free fragment is 2048
RAM used: 36 (10%) at main() level
55 (15%) worst case
Stack: 6 worst case (5 in main + 1 for interrupts)
 
*
0000: MOVLW 08
0001: MOVWF 0A
0002: GOTO 000
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: BCF 03.7
0016: BCF 03.5
0017: BTFSS 0B.5
0018: GOTO 01B
0019: BTFSC 0B.2
001A: GOTO 032
001B: MOVLW 8C
001C: MOVWF 04
001D: BTFSS 00.0
001E: GOTO 021
001F: BTFSC 0C.0
0020: GOTO 035
0021: MOVF 22,W
0022: MOVWF 04
0023: MOVF 23,W
0024: MOVWF 77
0025: MOVF 24,W
0026: MOVWF 78
0027: MOVF 25,W
0028: MOVWF 79
0029: MOVF 26,W
002A: MOVWF 7A
002B: MOVF 20,W
002C: MOVWF 0A
002D: SWAPF 21,W
002E: MOVWF 03
002F: SWAPF 7F,F
0030: SWAPF 7F,W
0031: RETFIE
0032: BCF 0A.3
0033: BCF 0A.4
0034: GOTO 040
0035: BCF 0A.3
0036: BCF 0A.4
0037: GOTO 047
.................... #include ".\main.h"
.................... #include <16F887.h>
.................... //////// Standard Header file for the PIC16F887 device ////////////////
.................... #device PIC16F887
.................... #list
....................
.................... #device adc=10
....................
.................... #FUSES NOWDT //No Watch Dog Timer
.................... #FUSES INTRC //Internal RC Osc
.................... #FUSES NOPUT //No Power Up Timer
.................... #FUSES MCLR //Master Clear pin enabled
.................... #FUSES NOPROTECT //Code not protected from reading
.................... #FUSES NOCPD //No EE protection
.................... #FUSES NOBROWNOUT //No brownout reset
.................... #FUSES IESO //Internal External Switch Over mode enabled
.................... #FUSES FCMEN //Fail-safe clock monitor enabled
.................... #FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
.................... #FUSES NODEBUG //No Debug mode for ICD
.................... #FUSES NOWRT //Program memory not write protected
.................... #FUSES BORV40 //Brownout reset at 4.0V
....................
.................... #use delay(clock=8000000)
*
00A9: MOVLW 46
00AA: MOVWF 04
00AB: BCF 03.7
00AC: MOVF 00,W
00AD: BTFSC 03.2
00AE: GOTO 0BC
00AF: MOVLW 02
00B0: MOVWF 78
00B1: CLRF 77
00B2: DECFSZ 77,F
00B3: GOTO 0B2
00B4: DECFSZ 78,F
00B5: GOTO 0B1
00B6: MOVLW 97
00B7: MOVWF 77
00B8: DECFSZ 77,F
00B9: GOTO 0B8
00BA: DECFSZ 00,F
00BB: GOTO 0AF
00BC: RETURN
*
05FC: MOVLW 08
05FD: SUBWF 40,F
05FE: BTFSS 03.0
05FF: GOTO 60C
0600: MOVLW 40
0601: MOVWF 04
0602: BCF 03.7
0603: BCF 03.0
0604: RRF 00,F
0605: MOVF 00,W
0606: BTFSC 03.2
0607: GOTO 60C
0608: GOTO 60A
0609: NOP
060A: DECFSZ 00,F
060B: GOTO 609
060C: RETURN
.................... #use rs232(baud=9600,parity=N,xmit=PIN_B7,rcv=PIN_B6,bits=8)
*
0235: BSF 03.5
0236: BCF 06.7
0237: BCF 03.5
0238: BCF 06.7
0239: MOVLW 08
023A: MOVWF 78
023B: GOTO 23C
023C: NOP
023D: BSF 78.7
023E: GOTO 24D
023F: BCF 78.7
0240: RRF 45,F
0241: BTFSC 03.0
0242: BSF 06.7
0243: BTFSS 03.0
0244: BCF 06.7
0245: BSF 78.6
0246: GOTO 24D
0247: BCF 78.6
0248: DECFSZ 78,F
0249: GOTO 240
024A: GOTO 24B
024B: NOP
024C: BSF 06.7
024D: MOVLW 3F
024E: MOVWF 04
024F: DECFSZ 04,F
0250: GOTO 24F
0251: NOP
0252: BTFSC 78.7
0253: GOTO 23F
0254: BTFSC 78.6
0255: GOTO 247
0256: RETURN
....................
....................
....................
.................... #define LED1 PIN_C6 //CHANGE PIN_XX TO YOUR LED PIN NUMBER, EX: PIN_A5
.................... #define LED2 PIN_C5 //CHANGE PIN_XX TO YOUR LED PIN NUMBER, EX: PIN_A5
.................... #define LED3 PIN_C4 // pulse detect
.................... #define LED4 PIN_D3 //CHANGE PIN_XX TO YOUR LED PIN NUMBER
....................
.................... #define S1 PIN_C2 // raw up
.................... #define S2 PIN_C3 // raw down
.................... #define S3 PIN_D0 // fine up
.................... #define S4 PIN_D1 // fine down
.................... #define S5 PIN_B1 // time setup
.................... #define S6 PIN_B2 // treshold setup
....................
.................... #define BEEP PIN_D2 //piezo beeper
....................
.................... #define LCD_ENABLE_PIN PIN_E0 ////
.................... #define LCD_RS_PIN PIN_E1 ////
.................... #define LCD_RW_PIN PIN_E2 ////
.................... #define LCD_DATA4 PIN_D4 ////
.................... #define LCD_DATA5 PIN_D5 ////
.................... #define LCD_DATA6 PIN_D6 ////
.................... #define LCD_DATA7 PIN_D7
.................... #include <lcd.c>
.................... ///////////////////////////////////////////////////////////////////////////////
.................... //// LCD.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. ////
.................... //// \a Set cursor position to upper left ////
.................... //// \f Clear display, set cursor to upper left ////
.................... //// \n Go to start of second line ////
.................... //// \b Move back one position ////
.................... //// If LCD_EXTENDED_NEWLINE is defined, the \n character ////
.................... //// will erase all remanining characters on the current ////
.................... //// line, and move the cursor to the beginning of the next ////
.................... //// line. ////
.................... //// If LCD_EXTENDED_NEWLINE is defined, the \r character ////
.................... //// will move the cursor to the start of the current ////
.................... //// line. ////
.................... //// ////
.................... //// 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 ////
.................... //// ////
.................... //// CONFIGURATION ////
.................... //// The LCD can be configured in one of two ways: a.) port access or ////
.................... //// b.) pin access. Port access requires the entire 7 bit interface ////
.................... //// connected to one GPIO port, and the data bits (D4:D7 of the LCD) ////
.................... //// connected to sequential pins on the GPIO. Pin access ////
.................... //// has no requirements, all 7 bits of the control interface can ////
.................... //// can be connected to any GPIO using several ports. ////
.................... //// ////
.................... //// To use port access, #define LCD_DATA_PORT to the SFR location of ////
.................... //// of the GPIO port that holds the interface, -AND- edit LCD_PIN_MAP ////
.................... //// of this file to configure the pin order. If you are using a ////
.................... //// baseline PIC (PCB), then LCD_OUTPUT_MAP and LCD_INPUT_MAP also must ////
.................... //// be defined. ////
.................... //// ////
.................... //// Example of port access: ////
.................... //// #define LCD_DATA_PORT getenv("SFR:PORTD") ////
.................... //// ////
.................... //// To use pin access, the following pins must be defined: ////
.................... //// LCD_ENABLE_PIN ////
.................... //// LCD_RS_PIN ////
.................... //// LCD_RW_PIN ////
.................... //// LCD_DATA4 ////
.................... //// LCD_DATA5 ////
.................... //// LCD_DATA6 ////
.................... //// LCD_DATA7 ////
.................... //// ////
.................... //// Example of pin access: ////
.................... //// #define LCD_ENABLE_PIN PIN_E0 ////
.................... //// #define LCD_RS_PIN PIN_E1 ////
.................... //// #define LCD_RW_PIN PIN_E2 ////
.................... //// #define LCD_DATA4 PIN_D4 ////
.................... //// #define LCD_DATA5 PIN_D5 ////
.................... //// #define LCD_DATA6 PIN_D6 ////
.................... //// #define LCD_DATA7 PIN_D7 ////
.................... //// ////
.................... ///////////////////////////////////////////////////////////////////////////////
.................... //// (C) Copyright 1996,2010 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. ////
.................... ///////////////////////////////////////////////////////////////////////////
....................
.................... // define the pinout.
.................... // only required if port access is being used.
.................... typedef struct
.................... { // 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 LSB pin of that port.
.................... #if defined(__PCD__) // The port used will be LCD_DATA_PORT.
.................... int reserved: 8;
.................... #endif
.................... } LCD_PIN_MAP;
....................
.................... // this is to improve compatability with previous LCD drivers that accepted
.................... // a define labeled 'use_portb_lcd' that configured the LCD onto port B.
.................... #if ((defined(use_portb_lcd)) && (use_portb_lcd==TRUE))
.................... #define LCD_DATA_PORT getenv("SFR:PORTB")
.................... #endif
....................
.................... #if defined(__PCB__)
.................... // these definitions only need to be modified for baseline PICs.
.................... // all other PICs use LCD_PIN_MAP or individual LCD_xxx pin definitions.
.................... /* EN, RS, RW, UNUSED, DATA */
.................... const LCD_PIN_MAP LCD_OUTPUT_MAP = {0, 0, 0, 0, 0};
.................... const LCD_PIN_MAP LCD_INPUT_MAP = {0, 0, 0, 0, 0xF};
.................... #endif
....................
.................... ////////////////////// END CONFIGURATION ///////////////////////////////////
....................
.................... #ifndef LCD_ENABLE_PIN
.................... #define lcd_output_enable(x) lcdlat.enable=x
.................... #define lcd_enable_tris() lcdtris.enable=0
.................... #else
.................... #define lcd_output_enable(x) output_bit(LCD_ENABLE_PIN, x)
.................... #define lcd_enable_tris() output_drive(LCD_ENABLE_PIN)
.................... #endif
....................
.................... #ifndef LCD_RS_PIN
.................... #define lcd_output_rs(x) lcdlat.rs=x
.................... #define lcd_rs_tris() lcdtris.rs=0
.................... #else
.................... #define lcd_output_rs(x) output_bit(LCD_RS_PIN, x)
.................... #define lcd_rs_tris() output_drive(LCD_RS_PIN)
.................... #endif
....................
.................... #ifndef LCD_RW_PIN
.................... #define lcd_output_rw(x) lcdlat.rw=x
.................... #define lcd_rw_tris() lcdtris.rw=0
.................... #else
.................... #define lcd_output_rw(x) output_bit(LCD_RW_PIN, x)
.................... #define lcd_rw_tris() output_drive(LCD_RW_PIN)
.................... #endif
....................
.................... // original version of this library incorrectly labeled LCD_DATA0 as LCD_DATA4,
.................... // LCD_DATA1 as LCD_DATA5, and so on. this block of code makes the driver
.................... // compatible with any code written for the original library
.................... #if (defined(LCD_DATA0) && defined(LCD_DATA1) && defined(LCD_DATA2) && defined(LCD_DATA3) && !defined(LCD_DATA4) && !defined(LCD_DATA5) && !defined(LCD_DATA6) && !defined(LCD_DATA7))
.................... #define LCD_DATA4 LCD_DATA0
.................... #define LCD_DATA5 LCD_DATA1
.................... #define LCD_DATA6 LCD_DATA2
.................... #define LCD_DATA7 LCD_DATA3
.................... #endif
....................
.................... #ifndef LCD_DATA4
.................... #ifndef LCD_DATA_PORT
.................... #if defined(__PCB__)
.................... #define LCD_DATA_PORT 0x06 //portb
.................... #define set_tris_lcd(x) set_tris_b(x)
.................... #else
.................... #if defined(PIN_D0)
.................... #define LCD_DATA_PORT getenv("SFR:PORTD") //portd
.................... #else
.................... #define LCD_DATA_PORT getenv("SFR:PORTB") //portb
.................... #endif
.................... #endif
.................... #endif
....................
.................... #if defined(__PCB__)
.................... LCD_PIN_MAP lcd, lcdlat;
.................... #byte lcd = LCD_DATA_PORT
.................... #byte lcdlat = LCD_DATA_PORT
.................... #elif defined(__PCM__)
.................... LCD_PIN_MAP lcd, lcdlat, lcdtris;
.................... #byte lcd = LCD_DATA_PORT
.................... #byte lcdlat = LCD_DATA_PORT
.................... #byte lcdtris = LCD_DATA_PORT+0x80
.................... #elif defined(__PCH__)
.................... LCD_PIN_MAP lcd, lcdlat, lcdtris;
.................... #byte lcd = LCD_DATA_PORT
.................... #byte lcdlat = LCD_DATA_PORT+9
.................... #byte lcdtris = LCD_DATA_PORT+0x12
.................... #elif defined(__PCD__)
.................... LCD_PIN_MAP lcd, lcdlat, lcdtris;
.................... #word lcd = LCD_DATA_PORT
.................... #word lcdlat = LCD_DATA_PORT+2
.................... #word lcdtris = LCD_DATA_PORT-0x02
.................... #endif
.................... #endif //LCD_DATA4 not defined
....................
.................... #ifndef LCD_TYPE
.................... #define LCD_TYPE 2 // 0=5x7, 1=5x10, 2=2 lines
.................... #endif
....................
.................... #ifndef LCD_LINE_TWO
.................... #define LCD_LINE_TWO 0x40 // LCD RAM address for the second line
.................... #endif
....................
.................... #ifndef LCD_LINE_LENGTH
.................... #define LCD_LINE_LENGTH 20
.................... #endif
....................
.................... 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.
....................
.................... BYTE lcd_read_nibble(void);
....................
.................... BYTE lcd_read_byte(void)
.................... {
.................... BYTE low,high;
....................
.................... #if defined(__PCB__)
.................... set_tris_lcd(LCD_INPUT_MAP);
.................... #else
.................... #if (defined(LCD_DATA4) && defined(LCD_DATA5) && defined(LCD_DATA6) && defined(LCD_DATA7))
.................... output_float(LCD_DATA4);
*
0122: BSF 08.4
.................... output_float(LCD_DATA5);
0123: BSF 08.5
.................... output_float(LCD_DATA6);
0124: BSF 08.6
.................... output_float(LCD_DATA7);
0125: BSF 08.7
.................... #else
.................... lcdtris.data = 0xF;
.................... #endif
.................... #endif
....................
.................... lcd_output_rw(1);
0126: BCF 03.5
0127: BSF 09.2
0128: BSF 03.5
0129: BCF 09.2
.................... delay_cycles(1);
012A: NOP
.................... lcd_output_enable(1);
012B: BCF 03.5
012C: BSF 09.0
012D: BSF 03.5
012E: BCF 09.0
.................... delay_cycles(1);
012F: NOP
.................... high = lcd_read_nibble();
0130: BCF 03.5
0131: CALL 0E9
0132: MOVF 78,W
0133: MOVWF 4D
....................
.................... lcd_output_enable(0);
0134: BCF 09.0
0135: BSF 03.5
0136: BCF 09.0
.................... delay_cycles(1);
0137: NOP
.................... lcd_output_enable(1);
0138: BCF 03.5
0139: BSF 09.0
013A: BSF 03.5
013B: BCF 09.0
.................... delay_us(1);
013C: GOTO 13D
.................... low = lcd_read_nibble();
013D: BCF 03.5
013E: CALL 0E9
013F: MOVF 78,W
0140: MOVWF 4C
....................
.................... lcd_output_enable(0);
0141: BCF 09.0
0142: BSF 03.5
0143: BCF 09.0
....................
.................... #if defined(__PCB__)
.................... set_tris_lcd(LCD_OUTPUT_MAP);
.................... #else
.................... #if (defined(LCD_DATA4) && defined(LCD_DATA5) && defined(LCD_DATA6) && defined(LCD_DATA7))
.................... output_drive(LCD_DATA4);
0144: BCF 08.4
.................... output_drive(LCD_DATA5);
0145: BCF 08.5
.................... output_drive(LCD_DATA6);
0146: BCF 08.6
.................... output_drive(LCD_DATA7);
0147: BCF 08.7
.................... #else
.................... lcdtris.data = 0x0;
.................... #endif
.................... #endif
....................
.................... return( (high<<4) | low);
0148: BCF 03.5
0149: SWAPF 4D,W
014A: MOVWF 77
014B: MOVLW F0
014C: ANDWF 77,F
014D: MOVF 77,W
014E: IORWF 4C,W
014F: MOVWF 78
.................... }
....................
.................... BYTE lcd_read_nibble(void)
.................... {
.................... #if (defined(LCD_DATA4) && defined(LCD_DATA5) && defined(LCD_DATA6) && defined(LCD_DATA7))
*
00E9: CLRF 4E
.................... BYTE n = 0x00;
....................
.................... /* Read the data port */
.................... n |= input(LCD_DATA4);
00EA: BSF 03.5
00EB: BSF 08.4
00EC: MOVLW 00
00ED: BCF 03.5
00EE: BTFSC 08.4
00EF: MOVLW 01
00F0: IORWF 4E,F
.................... n |= input(LCD_DATA5) << 1;
00F1: BSF 03.5
00F2: BSF 08.5
00F3: MOVLW 00
00F4: BCF 03.5
00F5: BTFSC 08.5
00F6: MOVLW 01
00F7: MOVWF 77
00F8: BCF 03.0
00F9: RLF 77,F
00FA: MOVF 77,W
00FB: IORWF 4E,F
.................... n |= input(LCD_DATA6) << 2;
00FC: BSF 03.5
00FD: BSF 08.6
00FE: MOVLW 00
00FF: BCF 03.5
0100: BTFSC 08.6
0101: MOVLW 01
0102: MOVWF 77
0103: RLF 77,F
0104: RLF 77,F
0105: MOVLW FC
0106: ANDWF 77,F
0107: MOVF 77,W
0108: IORWF 4E,F
.................... n |= input(LCD_DATA7) << 3;
0109: BSF 03.5
010A: BSF 08.7
010B: MOVLW 00
010C: BCF 03.5
010D: BTFSC 08.7
010E: MOVLW 01
010F: MOVWF 77
0110: RLF 77,F
0111: RLF 77,F
0112: RLF 77,F
0113: MOVLW F8
0114: ANDWF 77,F
0115: MOVF 77,W
0116: IORWF 4E,F
....................
.................... return(n);
0117: MOVF 4E,W
0118: MOVWF 78
.................... #else
.................... return(lcd.data);
.................... #endif
.................... }
0119: RETURN
....................
.................... void lcd_send_nibble(BYTE n)
.................... {
.................... #if (defined(LCD_DATA4) && defined(LCD_DATA5) && defined(LCD_DATA6) && defined(LCD_DATA7))
.................... /* Write to the data port */
.................... output_bit(LCD_DATA4, bit_test(n, 0));
*
00BD: BTFSC 4D.0
00BE: GOTO 0C1
00BF: BCF 08.4
00C0: GOTO 0C2
00C1: BSF 08.4
00C2: BSF 03.5
00C3: BCF 08.4
.................... output_bit(LCD_DATA5, bit_test(n, 1));
00C4: BCF 03.5
00C5: BTFSC 4D.1
00C6: GOTO 0C9
00C7: BCF 08.5
00C8: GOTO 0CA
00C9: BSF 08.5
00CA: BSF 03.5
00CB: BCF 08.5
.................... output_bit(LCD_DATA6, bit_test(n, 2));
00CC: BCF 03.5
00CD: BTFSC 4D.2
00CE: GOTO 0D1
00CF: BCF 08.6
00D0: GOTO 0D2
00D1: BSF 08.6
00D2: BSF 03.5
00D3: BCF 08.6
.................... output_bit(LCD_DATA7, bit_test(n, 3));
00D4: BCF 03.5
00D5: BTFSC 4D.3
00D6: GOTO 0D9
00D7: BCF 08.7
00D8: GOTO 0DA
00D9: BSF 08.7
00DA: BSF 03.5
00DB: BCF 08.7
.................... #else
.................... lcdlat.data = n;
.................... #endif
....................
.................... delay_cycles(1);
00DC: NOP
.................... lcd_output_enable(1);
00DD: BCF 03.5
00DE: BSF 09.0
00DF: BSF 03.5
00E0: BCF 09.0
.................... delay_us(2);
00E1: GOTO 0E2
00E2: GOTO 0E3
.................... lcd_output_enable(0);
00E3: BCF 03.5
00E4: BCF 09.0
00E5: BSF 03.5
00E6: BCF 09.0
.................... }
00E7: BCF 03.5
00E8: RETURN
....................
.................... void lcd_send_byte(BYTE address, BYTE n)
.................... {
.................... #if defined(__PCB__)
.................... set_tris_lcd(LCD_OUTPUT_MAP);
.................... #else
.................... lcd_enable_tris();
*
011A: BSF 03.5
011B: BCF 09.0
.................... lcd_rs_tris();
011C: BCF 09.1
.................... lcd_rw_tris();
011D: BCF 09.2
.................... #endif
....................
.................... lcd_output_rs(0);
011E: BCF 03.5
011F: BCF 09.1
0120: BSF 03.5
0121: BCF 09.1
.................... while ( bit_test(lcd_read_byte(),7) ) ;
*
0150: MOVF 78,W
0151: MOVWF 4C
0152: BTFSS 4C.7
0153: GOTO 156
0154: BSF 03.5
0155: GOTO 122
.................... lcd_output_rs(address);
0156: MOVF 4A,F
0157: BTFSS 03.2
0158: GOTO 15B
0159: BCF 09.1
015A: GOTO 15C
015B: BSF 09.1
015C: BSF 03.5
015D: BCF 09.1
.................... delay_cycles(1);
015E: NOP
.................... lcd_output_rw(0);
015F: BCF 03.5
0160: BCF 09.2
0161: BSF 03.5
0162: BCF 09.2
.................... delay_cycles(1);
0163: NOP
.................... lcd_output_enable(0);
0164: BCF 03.5
0165: BCF 09.0
0166: BSF 03.5
0167: BCF 09.0
.................... lcd_send_nibble(n >> 4);
0168: BCF 03.5
0169: SWAPF 4B,W
016A: MOVWF 4C
016B: MOVLW 0F
016C: ANDWF 4C,F
016D: MOVF 4C,W
016E: MOVWF 4D
016F: CALL 0BD
.................... lcd_send_nibble(n & 0xf);
0170: MOVF 4B,W
0171: ANDLW 0F
0172: MOVWF 4C
0173: MOVWF 4D
0174: CALL 0BD
.................... }
0175: RETURN
....................
.................... #if defined(LCD_EXTENDED_NEWLINE)
.................... unsigned int8 g_LcdX, g_LcdY;
.................... #endif
....................
.................... void lcd_init(void)
.................... {
.................... BYTE i;
....................
.................... #if defined(__PCB__)
.................... set_tris_lcd(LCD_OUTPUT_MAP);
.................... #else
.................... #if (defined(LCD_DATA4) && defined(LCD_DATA5) && defined(LCD_DATA6) && defined(LCD_DATA7))
.................... output_drive(LCD_DATA4);
0176: BSF 03.5
0177: BCF 08.4
.................... output_drive(LCD_DATA5);
0178: BCF 08.5
.................... output_drive(LCD_DATA6);
0179: BCF 08.6
.................... output_drive(LCD_DATA7);
017A: BCF 08.7
.................... #else
.................... lcdtris.data = 0x0;
.................... #endif
.................... lcd_enable_tris();
017B: BCF 09.0
.................... lcd_rs_tris();
017C: BCF 09.1
.................... lcd_rw_tris();
017D: BCF 09.2
.................... #endif
....................
.................... lcd_output_rs(0);
017E: BCF 03.5
017F: BCF 09.1
0180: BSF 03.5
0181: BCF 09.1
.................... lcd_output_rw(0);
0182: BCF 03.5
0183: BCF 09.2
0184: BSF 03.5
0185: BCF 09.2
.................... lcd_output_enable(0);
0186: BCF 03.5
0187: BCF 09.0
0188: BSF 03.5
0189: BCF 09.0
....................
.................... delay_ms(15);
018A: MOVLW 0F
018B: BCF 03.5
018C: MOVWF 46
018D: CALL 0A9
.................... for(i=1;i<=3;++i)
018E: MOVLW 01
018F: MOVWF 39
0190: MOVF 39,W
0191: SUBLW 03
0192: BTFSS 03.0
0193: GOTO 19C
.................... {
.................... lcd_send_nibble(3);
0194: MOVLW 03
0195: MOVWF 4D
0196: CALL 0BD
.................... delay_ms(5);
0197: MOVLW 05
0198: MOVWF 46
0199: CALL 0A9
.................... }
019A: INCF 39,F
019B: GOTO 190
....................
.................... lcd_send_nibble(2);
019C: MOVLW 02
019D: MOVWF 4D
019E: CALL 0BD
.................... for(i=0;i<=3;++i)
019F: CLRF 39
01A0: MOVF 39,W
01A1: SUBLW 03
01A2: BTFSS 03.0
01A3: GOTO 1AD
.................... lcd_send_byte(0,LCD_INIT_STRING[i]);
01A4: MOVF 39,W
01A5: CALL 038
01A6: MOVWF 3A
01A7: CLRF 4A
01A8: MOVF 3A,W
01A9: MOVWF 4B
01AA: CALL 11A
....................
.................... #if defined(LCD_EXTENDED_NEWLINE)
01AB: INCF 39,F
01AC: GOTO 1A0
.................... g_LcdX = 0;
.................... g_LcdY = 0;
.................... #endif
.................... }
01AD: BSF 0A.3
01AE: BCF 0A.4
01AF: GOTO 0B3 (RETURN)
....................
.................... void lcd_gotoxy(BYTE x, BYTE y)
.................... {
.................... BYTE address;
....................
.................... if(y!=1)
01B0: DECFSZ 47,W
01B1: GOTO 1B3
01B2: GOTO 1B6
.................... address=LCD_LINE_TWO;
01B3: MOVLW 40
01B4: MOVWF 48
.................... else
01B5: GOTO 1B7
.................... address=0;
01B6: CLRF 48
....................
.................... address+=x-1;
01B7: MOVLW 01
01B8: SUBWF 46,W
01B9: ADDWF 48,F
.................... lcd_send_byte(0,0x80|address);
01BA: MOVF 48,W
01BB: IORLW 80
01BC: MOVWF 49
01BD: CLRF 4A
01BE: MOVF 49,W
01BF: MOVWF 4B
01C0: CALL 11A
....................
.................... #if defined(LCD_EXTENDED_NEWLINE)
.................... g_LcdX = x - 1;
.................... g_LcdY = y - 1;
.................... #endif
.................... }
01C1: RETURN
....................
.................... void lcd_putc(char c)
.................... {
.................... switch (c)
.................... {
01C2: MOVF 45,W
01C3: XORLW 07
01C4: BTFSC 03.2
01C5: GOTO 1D0
01C6: XORLW 0B
01C7: BTFSC 03.2
01C8: GOTO 1D5
01C9: XORLW 06
01CA: BTFSC 03.2
01CB: GOTO 1DD
01CC: XORLW 02
01CD: BTFSC 03.2
01CE: GOTO 1E3
01CF: GOTO 1E8
.................... case '\a' : lcd_gotoxy(1,1); break;
01D0: MOVLW 01
01D1: MOVWF 46
01D2: MOVWF 47
01D3: CALL 1B0
01D4: GOTO 1EE
....................
.................... case '\f' : lcd_send_byte(0,1);
01D5: CLRF 4A
01D6: MOVLW 01
01D7: MOVWF 4B
01D8: CALL 11A
.................... delay_ms(2);
01D9: MOVLW 02
01DA: MOVWF 46
01DB: CALL 0A9
.................... #if defined(LCD_EXTENDED_NEWLINE)
.................... g_LcdX = 0;
.................... g_LcdY = 0;
.................... #endif
.................... break;
01DC: GOTO 1EE
....................
.................... #if defined(LCD_EXTENDED_NEWLINE)
.................... case '\r' : lcd_gotoxy(1, g_LcdY+1); break;
.................... case '\n' :
.................... while (g_LcdX++ < LCD_LINE_LENGTH)
.................... {
.................... lcd_send_byte(1, ' ');
.................... }
.................... lcd_gotoxy(1, g_LcdY+2);
.................... break;
.................... #else
.................... case '\n' : lcd_gotoxy(1,2); break;
01DD: MOVLW 01
01DE: MOVWF 46
01DF: MOVLW 02
01E0: MOVWF 47
01E1: CALL 1B0
01E2: GOTO 1EE
.................... #endif
....................
.................... case '\b' : lcd_send_byte(0,0x10); break;
01E3: CLRF 4A
01E4: MOVLW 10
01E5: MOVWF 4B
01E6: CALL 11A
01E7: GOTO 1EE
....................
.................... #if defined(LCD_EXTENDED_NEWLINE)
.................... default :
.................... if (g_LcdX < LCD_LINE_LENGTH)
.................... {
.................... lcd_send_byte(1, c);
.................... g_LcdX++;
.................... }
.................... break;
.................... #else
.................... default : lcd_send_byte(1,c); break;
01E8: MOVLW 01
01E9: MOVWF 4A
01EA: MOVF 45,W
01EB: MOVWF 4B
01EC: CALL 11A
01ED: GOTO 1EE
.................... #endif
.................... }
.................... }
01EE: RETURN
....................
.................... char lcd_getc(BYTE x, BYTE y)
.................... {
.................... char value;
....................
.................... lcd_gotoxy(x,y);
.................... while ( bit_test(lcd_read_byte(),7) ); // wait until busy flag is low
.................... lcd_output_rs(1);
.................... value = lcd_read_byte();
.................... lcd_output_rs(0);
....................
.................... return(value);
.................... }
....................
....................
....................
.................... unsigned int32 pulse_count=0;
.................... unsigned int16 overflow_count=0;
.................... unsigned int16 time_overflow_count=0;
....................
....................
.................... #int_RTCC
.................... void RTCC_isr(void)
.................... {
.................... time_overflow_count++;
*
0040: INCF 2D,F
0041: BTFSC 03.2
0042: INCF 2E,F
.................... }
....................
0043: BCF 0B.2
0044: BCF 0A.3
0045: BCF 0A.4
0046: GOTO 021
.................... #int_TIMER1
.................... void TIMER1_isr(void)
.................... {
.................... overflow_count++;
0047: INCF 2B,F
0048: BTFSC 03.2
0049: INCF 2C,F
.................... output_toggle(LED3);
004A: BCF 2F.4
004B: MOVF 2F,W
004C: BSF 03.5
004D: MOVWF 07
004E: MOVLW 10
004F: BCF 03.5
0050: XORWF 07,F
.................... output_toggle(BEEP);
0051: BSF 03.5
0052: BCF 08.2
0053: MOVLW 04
0054: BCF 03.5
0055: XORWF 08,F
.................... }
....................
0056: BCF 0C.0
0057: BCF 0A.3
0058: BCF 0A.4
0059: GOTO 021
.................... void sound_beep( unsigned int lenght, int16 frequency)
.................... {
.................... unsigned int i;
....................
.................... for(i=0;i<=lenght;i++)
*
060D: CLRF 3C
060E: MOVF 3C,W
060F: SUBWF 39,W
0610: BTFSS 03.0
0611: GOTO 655
.................... {
.................... output_toggle(BEEP);
0612: BSF 03.5
0613: BCF 08.2
0614: MOVLW 04
0615: BCF 03.5
0616: XORWF 08,F
.................... delay_us(1/frequency);
0617: CLRF 3E
0618: MOVLW 01
0619: MOVWF 3D
061A: MOVF 3B,W
061B: MOVWF 40
061C: MOVF 3A,W
061D: MOVWF 3F
*
0642: MOVF 79,W
0643: MOVWF 3E
0644: MOVF 78,W
0645: MOVWF 3D
0646: MOVF 3E,W
0647: MOVWF 3F
0648: INCF 3F,F
0649: DECF 3F,F
064A: BTFSC 03.2
064B: GOTO 650
064C: MOVLW FF
064D: MOVWF 40
064E: CALL 5FC
064F: GOTO 649
0650: MOVF 3D,W
0651: MOVWF 40
0652: CALL 5FC
.................... }
0653: INCF 3C,F
0654: GOTO 60E
.................... }
0655: RETURN
....................
.................... void main()
.................... {
*
0800: CLRF 04
0801: BCF 03.7
0802: MOVLW 1F
0803: ANDWF 03,F
0804: MOVLW 71
0805: BSF 03.5
0806: MOVWF 0F
0807: MOVF 0F,W
0808: BCF 06.7
0809: BCF 03.5
080A: BSF 06.7
080B: CLRF 2A
080C: CLRF 29
080D: CLRF 28
080E: CLRF 27
080F: CLRF 2C
0810: CLRF 2B
0811: CLRF 2E
0812: CLRF 2D
0813: BSF 03.5
0814: BSF 03.6
0815: MOVF 09,W
0816: ANDLW C0
0817: MOVWF 09
0818: BCF 03.6
0819: BCF 1F.4
081A: BCF 1F.5
081B: MOVLW 00
081C: BSF 03.6
081D: MOVWF 08
081E: BCF 03.5
081F: CLRF 07
0820: CLRF 08
0821: CLRF 09
*
0825: CLRF 31
0826: MOVLW 3C
0827: MOVWF 30
0828: CLRF 38
0829: CLRF 37
.................... unsigned int16 integration_time=60;
.................... unsigned int16 time;
.................... unsigned int16 last_timer; // promena pro praskani
.................... unsigned int1 button_press,voltage_setup,time_setup; // semafor pro cteni tlacitek
.................... unsigned int16 measurement_number=0;
....................
.................... setup_adc_ports(sAN0|VSS_VDD);
082A: BSF 03.5
082B: BSF 03.6
082C: MOVF 09,W
082D: ANDLW C0
082E: MOVWF 09
082F: BCF 03.6
0830: BCF 1F.4
0831: BCF 1F.5
0832: MOVLW 01
0833: BSF 03.6
0834: MOVWF 08
.................... setup_adc(ADC_CLOCK_DIV_32);
0835: BCF 03.5
0836: BCF 03.6
0837: BCF 1F.6
0838: BSF 1F.7
0839: BSF 03.5
083A: BSF 1F.7
083B: BCF 03.5
083C: BSF 1F.0
.................... setup_spi(SPI_SS_DISABLED);
083D: BCF 14.5
083E: BCF 2F.5
083F: MOVF 2F,W
0840: BSF 03.5
0841: MOVWF 07
0842: BCF 03.5
0843: BSF 2F.4
0844: MOVF 2F,W
0845: BSF 03.5
0846: MOVWF 07
0847: BCF 03.5
0848: BCF 2F.3
0849: MOVF 2F,W
084A: BSF 03.5
084B: MOVWF 07
084C: MOVLW 01
084D: BCF 03.5
084E: MOVWF 14
084F: MOVLW 00
0850: BSF 03.5
0851: MOVWF 14
.................... setup_timer_0(RTCC_INTERNAL|RTCC_DIV_256);
0852: MOVF 01,W
0853: ANDLW C0
0854: IORLW 07
0855: MOVWF 01
.................... setup_timer_1(T1_EXTERNAL|T1_DIV_BY_1);
0856: MOVLW 07
0857: BCF 03.5
0858: MOVWF 10
.................... setup_timer_2(T2_DISABLED,0,1);
0859: MOVLW 00
085A: MOVWF 78
085B: MOVWF 12
085C: MOVLW 00
085D: BSF 03.5
085E: MOVWF 12
.................... setup_ccp1(CCP_PWM);
085F: BCF 03.5
0860: BCF 2F.2
0861: MOVF 2F,W
0862: BSF 03.5
0863: MOVWF 07
0864: BCF 03.5
0865: BCF 07.2
0866: BSF 03.5
0867: BCF 09.6
0868: MOVLW 0C
0869: BCF 03.5
086A: MOVWF 17
086B: BSF 03.5
086C: CLRF 1B
086D: CLRF 1C
086E: MOVLW 01
086F: MOVWF 1D
.................... setup_ccp2(CCP_PWM);
0870: BCF 03.5
0871: BCF 2F.1
0872: MOVF 2F,W
0873: BSF 03.5
0874: MOVWF 07
0875: BCF 03.5
0876: BCF 07.1
0877: MOVLW 0C
0878: MOVWF 1D
0879: MOVLW 01
087A: MOVWF 00
.................... setup_oscillator(OSC_8MHZ);
087B: MOVLW 71
087C: BSF 03.5
087D: MOVWF 0F
087E: MOVF 0F,W
....................
.................... set_pwm1_duty(0);
087F: BCF 03.5
0880: CLRF 15
.................... set_pwm2_duty(0);
0881: CLRF 1B
....................
.................... output_high(LED1);
0882: BCF 2F.6
0883: MOVF 2F,W
0884: BSF 03.5
0885: MOVWF 07
0886: BCF 03.5
0887: BSF 07.6
.................... output_high(LED2);
0888: BCF 2F.5
0889: MOVF 2F,W
088A: BSF 03.5
088B: MOVWF 07
088C: BCF 03.5
088D: BSF 07.5
.................... output_high(LED3);
088E: BCF 2F.4
088F: MOVF 2F,W
0890: BSF 03.5
0891: MOVWF 07
0892: BCF 03.5
0893: BSF 07.4
.................... output_high(LED4);
0894: BSF 03.5
0895: BCF 08.3
0896: BCF 03.5
0897: BSF 08.3
.................... output_low(BEEP);
0898: BSF 03.5
0899: BCF 08.2
089A: BCF 03.5
089B: BCF 08.2
....................
.................... setup_comparator(CP2_A0_VREF|CP2_OUT_ON_A5); // sets two comparators(A1 and VR and A2 as the output)
089C: BSF 03.6
089D: CLRF 07
089E: MOVLW A4
089F: MOVWF 08
08A0: MOVLW 10
08A1: MOVWF 09
08A2: BSF 03.5
08A3: BCF 03.6
08A4: BCF 05.5
08A5: BSF 05.0
.................... setup_vref(VREF_HIGH|6); //sets 3.6(vdd *value/32 +vdd/4) if vdd is 5.0V
08A6: MOVLW 86
08A7: MOVWF 17
.................... enable_interrupts(INT_COMP); //enables the comparator interrupt
08A8: BSF 0D.5
.................... enable_interrupts(INT_RTCC);
08A9: BCF 03.5
08AA: BSF 0B.5
.................... enable_interrupts(INT_TIMER1);
08AB: BSF 03.5
08AC: BSF 0C.0
.................... enable_interrupts(INT_TIMER2);
08AD: BSF 0C.1
.................... enable_interrupts(GLOBAL);
08AE: MOVLW C0
08AF: BCF 03.5
08B0: IORWF 0B,F
.................... lcd_init();
08B1: BCF 0A.3
08B2: GOTO 176
08B3: BSF 0A.3
....................
.................... lcd_putc("\fGM counter V1.0 \n 2013 MLAB");
08B4: MOVLW 5A
08B5: BSF 03.6
08B6: MOVWF 0D
08B7: MOVLW 00
08B8: MOVWF 0F
08B9: BCF 0A.3
08BA: BCF 03.6
08BB: CALL 1EF
08BC: BSF 0A.3
.................... printf("Geiger-Muller Counter V1.0 \r\n");
08BD: MOVLW 6A
08BE: BSF 03.6
08BF: MOVWF 0D
08C0: MOVLW 00
08C1: MOVWF 0F
08C2: BCF 0A.3
08C3: BCF 03.6
08C4: CALL 257
08C5: BSF 0A.3
.................... printf("(c) 2013 MLAB and UST.cz \r\n");
08C6: MOVLW 79
08C7: BSF 03.6
08C8: MOVWF 0D
08C9: MOVLW 00
08CA: MOVWF 0F
08CB: BCF 0A.3
08CC: BCF 03.6
08CD: CALL 257
08CE: BSF 0A.3
.................... Delay_ms(1000);
08CF: MOVLW 04
08D0: MOVWF 39
08D1: MOVLW FA
08D2: MOVWF 46
08D3: BCF 0A.3
08D4: CALL 0A9
08D5: BSF 0A.3
08D6: DECFSZ 39,F
08D7: GOTO 0D1
....................
.................... lcd_putc("\f");
08D8: MOVLW 87
08D9: BSF 03.6
08DA: MOVWF 0D
08DB: MOVLW 00
08DC: MOVWF 0F
08DD: BCF 0A.3
08DE: BCF 03.6
08DF: CALL 1EF
08E0: BSF 0A.3
.................... printf("\r\n");
08E1: MOVLW 0D
08E2: MOVWF 45
08E3: BCF 0A.3
08E4: CALL 235
08E5: BSF 0A.3
08E6: MOVLW 0A
08E7: MOVWF 45
08E8: BCF 0A.3
08E9: CALL 235
08EA: BSF 0A.3
....................
.................... set_timer1(0);
08EB: CLRF 0F
08EC: CLRF 0E
....................
.................... lcd_gotoxy(1,1); // vypsani hodnoty count, abz byla na LCD hned od zapnuti
08ED: MOVLW 01
08EE: MOVWF 46
08EF: MOVWF 47
08F0: BCF 0A.3
08F1: CALL 1B0
08F2: BSF 0A.3
.................... printf(lcd_putc,"Count:%lu ",pulse_count);
08F3: MOVLW 88
08F4: BSF 03.6
08F5: MOVWF 0D
08F6: MOVLW 00
08F7: MOVWF 0F
08F8: BCF 03.0
08F9: MOVLW 06
08FA: BCF 03.6
08FB: MOVWF 39
08FC: BCF 0A.3
08FD: CALL 29D
08FE: BSF 0A.3
08FF: MOVLW 41
0900: MOVWF 04
0901: MOVF 2A,W
0902: MOVWF 3C
0903: MOVF 29,W
0904: MOVWF 3B
0905: MOVF 28,W
0906: MOVWF 3A
0907: MOVF 27,W
0908: MOVWF 39
0909: BCF 0A.3
090A: CALL 32E
090B: BSF 0A.3
090C: MOVLW 8C
090D: BSF 03.6
090E: MOVWF 0D
090F: MOVLW 00
0910: MOVWF 0F
0911: BSF 03.0
0912: MOVLW 05
0913: BCF 03.6
0914: MOVWF 39
0915: BCF 0A.3
0916: CALL 29D
0917: BSF 0A.3
....................
.................... while(true)
.................... {
.................... pulse_count = get_timer1() + (0xffff * overflow_count); // compute pulse count
0918: MOVF 0F,W
0919: MOVWF 7A
091A: MOVF 0E,W
091B: MOVWF 77
091C: MOVF 0F,W
091D: SUBWF 7A,W
091E: BTFSS 03.2
091F: GOTO 118
0920: MOVF 77,W
0921: MOVWF 39
0922: MOVF 7A,W
0923: MOVWF 3A
0924: MOVLW FF
0925: MOVWF 3C
0926: MOVWF 3B
0927: MOVF 2C,W
0928: MOVWF 3E
0929: MOVF 2B,W
092A: MOVWF 3D
092B: BCF 0A.3
092C: GOTO 38A
092D: BSF 0A.3
092E: MOVF 79,W
092F: MOVWF 7A
0930: MOVF 78,W
0931: ADDWF 39,W
0932: MOVWF 27
0933: MOVF 3A,W
0934: MOVWF 28
0935: MOVF 7A,W
0936: BTFSC 03.0
0937: INCFSZ 7A,W
0938: ADDWF 28,F
0939: CLRF 29
093A: CLRF 2A
.................... time = integration_time + 1 - (time_overflow_count * 0.0327); // compute time interval
093B: MOVLW 01
093C: ADDWF 30,W
093D: MOVWF 39
093E: MOVF 31,W
093F: MOVWF 3A
0940: BTFSC 03.0
0941: INCF 3A,F
0942: MOVF 2E,W
0943: MOVWF 40
0944: MOVF 2D,W
0945: MOVWF 3F
0946: BCF 0A.3
0947: CALL 3A1
0948: BSF 0A.3
0949: MOVF 7A,W
094A: MOVWF 3E
094B: MOVF 79,W
094C: MOVWF 3D
094D: MOVF 78,W
094E: MOVWF 3C
094F: MOVF 77,W
0950: MOVWF 3B
0951: MOVLW 6F
0952: MOVWF 42
0953: MOVLW F0
0954: MOVWF 41
0955: MOVLW 05
0956: MOVWF 40
0957: MOVLW 7A
0958: MOVWF 3F
0959: BCF 0A.3
095A: GOTO 3BE
095B: BSF 0A.3
095C: MOVF 77,W
095D: MOVWF 3B
095E: MOVF 78,W
095F: MOVWF 3C
0960: MOVF 79,W
0961: MOVWF 3D
0962: MOVF 7A,W
0963: MOVWF 3E
0964: MOVF 3A,W
0965: MOVWF 40
0966: MOVF 39,W
0967: MOVWF 3F
0968: BCF 0A.3
0969: CALL 3A1
096A: BSF 0A.3
096B: BSF 03.1
096C: MOVF 7A,W
096D: MOVWF 42
096E: MOVF 79,W
096F: MOVWF 41
0970: MOVF 78,W
0971: MOVWF 40
0972: MOVF 77,W
0973: MOVWF 3F
0974: MOVF 3E,W
0975: MOVWF 46
0976: MOVF 3D,W
0977: MOVWF 45
0978: MOVF 3C,W
0979: MOVWF 44
097A: MOVF 3B,W
097B: MOVWF 43
097C: BCF 0A.3
097D: GOTO 435
097E: BSF 0A.3
097F: MOVF 7A,W
0980: MOVWF 42
0981: MOVF 79,W
0982: MOVWF 41
0983: MOVF 78,W
0984: MOVWF 40
0985: MOVF 77,W
0986: MOVWF 3F
0987: BCF 0A.3
0988: GOTO 578
0989: BSF 0A.3
098A: MOVF 79,W
098B: MOVWF 33
098C: MOVF 78,W
098D: MOVWF 32
....................
.................... if(get_timer1() != last_timer) // timer count increment detection
098E: MOVF 0F,W
098F: MOVWF 7A
0990: MOVF 0E,W
0991: MOVWF 77
0992: MOVF 0F,W
0993: SUBWF 7A,W
0994: BTFSS 03.2
0995: GOTO 18E
0996: MOVF 77,W
0997: MOVWF 39
0998: MOVF 7A,W
0999: MOVWF 3A
099A: MOVF 34,W
099B: SUBWF 39,W
099C: BTFSS 03.2
099D: GOTO 1A2
099E: MOVF 35,W
099F: SUBWF 3A,W
09A0: BTFSC 03.2
09A1: GOTO 1EF
.................... {
.................... output_toggle(BEEP);
09A2: BSF 03.5
09A3: BCF 08.2
09A4: MOVLW 04
09A5: BCF 03.5
09A6: XORWF 08,F
.................... delay_ms(1);
09A7: MOVLW 01
09A8: MOVWF 46
09A9: BCF 0A.3
09AA: CALL 0A9
09AB: BSF 0A.3
.................... output_toggle(BEEP);
09AC: BSF 03.5
09AD: BCF 08.2
09AE: MOVLW 04
09AF: BCF 03.5
09B0: XORWF 08,F
.................... output_toggle(LED3);
09B1: BCF 2F.4
09B2: MOVF 2F,W
09B3: BSF 03.5
09B4: MOVWF 07
09B5: MOVLW 10
09B6: BCF 03.5
09B7: XORWF 07,F
.................... last_timer=get_timer1();
09B8: MOVF 0F,W
09B9: MOVWF 7A
09BA: MOVF 0E,W
09BB: MOVWF 77
09BC: MOVF 0F,W
09BD: SUBWF 7A,W
09BE: BTFSS 03.2
09BF: GOTO 1B8
09C0: MOVF 77,W
09C1: MOVWF 34
09C2: MOVF 7A,W
09C3: MOVWF 35
.................... lcd_gotoxy(1,1); // prepsani dat na displeje
09C4: MOVLW 01
09C5: MOVWF 46
09C6: MOVWF 47
09C7: BCF 0A.3
09C8: CALL 1B0
09C9: BSF 0A.3
.................... printf(lcd_putc,"Count:%lu ",pulse_count);
09CA: MOVLW 90
09CB: BSF 03.6
09CC: MOVWF 0D
09CD: MOVLW 00
09CE: MOVWF 0F
09CF: BCF 03.0
09D0: MOVLW 06
09D1: BCF 03.6
09D2: MOVWF 39
09D3: BCF 0A.3
09D4: CALL 29D
09D5: BSF 0A.3
09D6: MOVLW 41
09D7: MOVWF 04
09D8: MOVF 2A,W
09D9: MOVWF 3C
09DA: MOVF 29,W
09DB: MOVWF 3B
09DC: MOVF 28,W
09DD: MOVWF 3A
09DE: MOVF 27,W
09DF: MOVWF 39
09E0: BCF 0A.3
09E1: CALL 32E
09E2: BSF 0A.3
09E3: MOVLW 94
09E4: BSF 03.6
09E5: MOVWF 0D
09E6: MOVLW 00
09E7: MOVWF 0F
09E8: BSF 03.0
09E9: MOVLW 05
09EA: BCF 03.6
09EB: MOVWF 39
09EC: BCF 0A.3
09ED: CALL 29D
09EE: BSF 0A.3
.................... }
....................
.................... lcd_gotoxy(1,2);
09EF: MOVLW 01
09F0: MOVWF 46
09F1: MOVLW 02
09F2: MOVWF 47
09F3: BCF 0A.3
09F4: CALL 1B0
09F5: BSF 0A.3
.................... printf(lcd_putc,"T:%lu ",time);
09F6: MOVLW 54
09F7: MOVWF 45
09F8: BCF 0A.3
09F9: CALL 1C2
09FA: BSF 0A.3
09FB: MOVLW 3A
09FC: MOVWF 45
09FD: BCF 0A.3
09FE: CALL 1C2
09FF: BSF 0A.3
0A00: MOVLW 10
0A01: MOVWF 04
0A02: MOVF 33,W
0A03: MOVWF 3A
0A04: MOVF 32,W
0A05: MOVWF 39
0A06: BCF 0A.3
0A07: CALL 599
0A08: BSF 0A.3
0A09: MOVLW 20
0A0A: MOVWF 45
0A0B: BCF 0A.3
0A0C: CALL 1C2
0A0D: BSF 0A.3
0A0E: MOVLW 20
0A0F: MOVWF 45
0A10: BCF 0A.3
0A11: CALL 1C2
0A12: BSF 0A.3
0A13: MOVLW 20
0A14: MOVWF 45
0A15: BCF 0A.3
0A16: CALL 1C2
0A17: BSF 0A.3
.................... lcd_gotoxy(9,2);
0A18: MOVLW 09
0A19: MOVWF 46
0A1A: MOVLW 02
0A1B: MOVWF 47
0A1C: BCF 0A.3
0A1D: CALL 1B0
0A1E: BSF 0A.3
.................... printf(lcd_putc,"I:%lu ", integration_time);
0A1F: MOVLW 49
0A20: MOVWF 45
0A21: BCF 0A.3
0A22: CALL 1C2
0A23: BSF 0A.3
0A24: MOVLW 3A
0A25: MOVWF 45
0A26: BCF 0A.3
0A27: CALL 1C2
0A28: BSF 0A.3
0A29: MOVLW 10
0A2A: MOVWF 04
0A2B: MOVF 31,W
0A2C: MOVWF 3A
0A2D: MOVF 30,W
0A2E: MOVWF 39
0A2F: BCF 0A.3
0A30: CALL 599
0A31: BSF 0A.3
0A32: MOVLW 9A
0A33: BSF 03.6
0A34: MOVWF 0D
0A35: MOVLW 00
0A36: MOVWF 0F
0A37: BSF 03.0
0A38: MOVLW 04
0A39: BCF 03.6
0A3A: MOVWF 39
0A3B: BCF 0A.3
0A3C: CALL 29D
0A3D: BSF 0A.3
....................
.................... if(time == 0) // po uplynuti mereneho intervalu vypis na seriovku
0A3E: MOVF 32,F
0A3F: BTFSS 03.2
0A40: GOTO 298
0A41: MOVF 33,F
0A42: BTFSS 03.2
0A43: GOTO 298
.................... {
.................... set_timer0(0);
0A44: CLRF 01
.................... time_overflow_count=0;
0A45: CLRF 2E
0A46: CLRF 2D
.................... sound_beep(1000,700);
0A47: MOVLW E8
0A48: MOVWF 39
0A49: MOVLW 02
0A4A: MOVWF 3B
0A4B: MOVLW BC
0A4C: MOVWF 3A
0A4D: BCF 0A.3
0A4E: CALL 60D
0A4F: BSF 0A.3
.................... printf("$GMC1.0 %lu %lu %lu \r\n", measurement_number, integration_time, pulse_count);
0A50: MOVLW 9D
0A51: BSF 03.6
0A52: MOVWF 0D
0A53: MOVLW 00
0A54: MOVWF 0F
0A55: BCF 03.0
0A56: MOVLW 08
0A57: BCF 03.6
0A58: MOVWF 39
0A59: BCF 0A.3
0A5A: CALL 656
0A5B: BSF 0A.3
0A5C: MOVLW 10
0A5D: MOVWF 04
0A5E: MOVF 38,W
0A5F: MOVWF 3A
0A60: MOVF 37,W
0A61: MOVWF 39
0A62: BCF 0A.3
0A63: CALL 6A5
0A64: BSF 0A.3
0A65: MOVLW 20
0A66: MOVWF 45
0A67: BCF 0A.3
0A68: CALL 235
0A69: BSF 0A.3
0A6A: MOVLW 10
0A6B: MOVWF 04
0A6C: MOVF 31,W
0A6D: MOVWF 3A
0A6E: MOVF 30,W
0A6F: MOVWF 39
0A70: BCF 0A.3
0A71: CALL 6A5
0A72: BSF 0A.3
0A73: MOVLW 20
0A74: MOVWF 45
0A75: BCF 0A.3
0A76: CALL 235
0A77: BSF 0A.3
0A78: MOVLW 41
0A79: MOVWF 04
0A7A: MOVF 2A,W
0A7B: MOVWF 3C
0A7C: MOVF 29,W
0A7D: MOVWF 3B
0A7E: MOVF 28,W
0A7F: MOVWF 3A
0A80: MOVF 27,W
0A81: MOVWF 39
0A82: BCF 0A.3
0A83: GOTO 708
0A84: BSF 0A.3
0A85: MOVLW A6
0A86: BSF 03.6
0A87: MOVWF 0D
0A88: MOVLW 00
0A89: MOVWF 0F
0A8A: BSF 03.0
0A8B: MOVLW 04
0A8C: BCF 03.6
0A8D: MOVWF 39
0A8E: BCF 0A.3
0A8F: CALL 656
0A90: BSF 0A.3
.................... set_timer1(0);
0A91: CLRF 0F
0A92: CLRF 0E
.................... overflow_count=0;
0A93: CLRF 2C
0A94: CLRF 2B
.................... measurement_number++;
0A95: INCF 37,F
0A96: BTFSC 03.2
0A97: INCF 38,F
.................... }
....................
.................... if(button_press==false ) // tlacitka se ctou znovu pouze pokud v redchozim cyklu nebyla zmacknuta.
0A98: BTFSC 36.0
0A99: GOTO 37E
.................... {
.................... if(!input(S1))
0A9A: BSF 2F.2
0A9B: MOVF 2F,W
0A9C: BSF 03.5
0A9D: MOVWF 07
0A9E: BCF 03.5
0A9F: BTFSC 07.2
0AA0: GOTO 2C7
.................... {
.................... delay_ms(20);
0AA1: MOVLW 14
0AA2: MOVWF 46
0AA3: BCF 0A.3
0AA4: CALL 0A9
0AA5: BSF 0A.3
.................... if(!input(S1))
0AA6: BSF 2F.2
0AA7: MOVF 2F,W
0AA8: BSF 03.5
0AA9: MOVWF 07
0AAA: BCF 03.5
0AAB: BTFSC 07.2
0AAC: GOTO 2C7
.................... {
.................... button_press=true;
0AAD: BSF 36.0
.................... if(time_setup==TRUE)
0AAE: BTFSS 36.2
0AAF: GOTO 2C7
.................... {
.................... sound_beep(100,700);
0AB0: MOVLW 64
0AB1: MOVWF 39
0AB2: MOVLW 02
0AB3: MOVWF 3B
0AB4: MOVLW BC
0AB5: MOVWF 3A
0AB6: BCF 0A.3
0AB7: CALL 60D
0AB8: BSF 0A.3
.................... if(integration_time < 0xfffa ) integration_time+=5;
0AB9: MOVF 31,W
0ABA: SUBLW FF
0ABB: BTFSS 03.0
0ABC: GOTO 2C7
0ABD: BTFSS 03.2
0ABE: GOTO 2C3
0ABF: MOVF 30,W
0AC0: SUBLW F9
0AC1: BTFSS 03.0
0AC2: GOTO 2C7
0AC3: MOVLW 05
0AC4: ADDWF 30,F
0AC5: BTFSC 03.0
0AC6: INCF 31,F
.................... }
.................... }
.................... }
....................
.................... if(!input(S2))
0AC7: BSF 2F.3
0AC8: MOVF 2F,W
0AC9: BSF 03.5
0ACA: MOVWF 07
0ACB: BCF 03.5
0ACC: BTFSC 07.3
0ACD: GOTO 2FA
.................... {
.................... delay_ms(20);
0ACE: MOVLW 14
0ACF: MOVWF 46
0AD0: BCF 0A.3
0AD1: CALL 0A9
0AD2: BSF 0A.3
.................... if(!input(S2))
0AD3: BSF 2F.3
0AD4: MOVF 2F,W
0AD5: BSF 03.5
0AD6: MOVWF 07
0AD7: BCF 03.5
0AD8: BTFSC 07.3
0AD9: GOTO 2FA
.................... {
.................... button_press=true;
0ADA: BSF 36.0
.................... if(time_setup==TRUE)
0ADB: BTFSS 36.2
0ADC: GOTO 2FA
.................... {
.................... sound_beep(100,600);
0ADD: MOVLW 64
0ADE: MOVWF 39
0ADF: MOVLW 02
0AE0: MOVWF 3B
0AE1: MOVLW 58
0AE2: MOVWF 3A
0AE3: BCF 0A.3
0AE4: CALL 60D
0AE5: BSF 0A.3
.................... if(integration_time > 0x0005 ) integration_time-=5;
0AE6: MOVF 31,F
0AE7: BTFSS 03.2
0AE8: GOTO 2ED
0AE9: MOVF 30,W
0AEA: SUBLW 05
0AEB: BTFSC 03.0
0AEC: GOTO 2F3
0AED: MOVLW 05
0AEE: SUBWF 30,F
0AEF: MOVLW 00
0AF0: BTFSS 03.0
0AF1: MOVLW 01
0AF2: SUBWF 31,F
....................
.................... set_timer0(0); // vynulovani pocitadel, kdyz uzivatel sahne na tlacitka
0AF3: CLRF 01
.................... time_overflow_count=0;
0AF4: CLRF 2E
0AF5: CLRF 2D
.................... set_timer1(0);
0AF6: CLRF 0F
0AF7: CLRF 0E
.................... overflow_count=0;
0AF8: CLRF 2C
0AF9: CLRF 2B
.................... }
.................... }
.................... }
....................
.................... if(!input(S3))
0AFA: BSF 03.5
0AFB: BSF 08.0
0AFC: BCF 03.5
0AFD: BTFSC 08.0
0AFE: GOTO 31D
.................... {
.................... delay_ms(20);
0AFF: MOVLW 14
0B00: MOVWF 46
0B01: BCF 0A.3
0B02: CALL 0A9
0B03: BSF 0A.3
.................... if(!input(S3))
0B04: BSF 03.5
0B05: BSF 08.0
0B06: BCF 03.5
0B07: BTFSC 08.0
0B08: GOTO 31D
.................... {
.................... button_press=true;
0B09: BSF 36.0
.................... if(time_setup==TRUE)
0B0A: BTFSS 36.2
0B0B: GOTO 31D
.................... {
.................... sound_beep(100,500);
0B0C: MOVLW 64
0B0D: MOVWF 39
0B0E: MOVLW 01
0B0F: MOVWF 3B
0B10: MOVLW F4
0B11: MOVWF 3A
0B12: BCF 0A.3
0B13: CALL 60D
0B14: BSF 0A.3
.................... if(integration_time < 0xffff ) integration_time++;
0B15: INCFSZ 30,W
0B16: GOTO 31A
0B17: INCFSZ 31,W
0B18: GOTO 31A
0B19: GOTO 31D
0B1A: INCF 30,F
0B1B: BTFSC 03.2
0B1C: INCF 31,F
.................... }
.................... }
.................... }
....................
.................... if(!input(S4))
0B1D: BSF 03.5
0B1E: BSF 08.1
0B1F: BCF 03.5
0B20: BTFSC 08.1
0B21: GOTO 34A
.................... {
.................... delay_ms(20);
0B22: MOVLW 14
0B23: MOVWF 46
0B24: BCF 0A.3
0B25: CALL 0A9
0B26: BSF 0A.3
.................... if(!input(S4))
0B27: BSF 03.5
0B28: BSF 08.1
0B29: BCF 03.5
0B2A: BTFSC 08.1
0B2B: GOTO 34A
.................... {
.................... button_press=true;
0B2C: BSF 36.0
.................... if(time_setup==TRUE)
0B2D: BTFSS 36.2
0B2E: GOTO 34A
.................... {
.................... sound_beep(100,400);
0B2F: MOVLW 64
0B30: MOVWF 39
0B31: MOVLW 01
0B32: MOVWF 3B
0B33: MOVLW 90
0B34: MOVWF 3A
0B35: BCF 0A.3
0B36: CALL 60D
0B37: BSF 0A.3
.................... if(integration_time > 0x0001 ) integration_time--;
0B38: MOVF 31,F
0B39: BTFSS 03.2
0B3A: GOTO 33F
0B3B: MOVF 30,W
0B3C: SUBLW 01
0B3D: BTFSC 03.0
0B3E: GOTO 343
0B3F: MOVF 30,W
0B40: BTFSC 03.2
0B41: DECF 31,F
0B42: DECF 30,F
....................
.................... set_timer0(0); // vynulovani pocitadel, kdyz uzivatel sahne na tlacitka
0B43: CLRF 01
.................... time_overflow_count=0;
0B44: CLRF 2E
0B45: CLRF 2D
.................... set_timer1(0);
0B46: CLRF 0F
0B47: CLRF 0E
.................... overflow_count=0;
0B48: CLRF 2C
0B49: CLRF 2B
.................... }
.................... }
.................... }
....................
.................... if(!input(S5)) // prepnuti na nastavovani casu
0B4A: BSF 03.5
0B4B: BSF 06.1
0B4C: BCF 03.5
0B4D: BTFSC 06.1
0B4E: GOTO 364
.................... {
.................... delay_ms(20);
0B4F: MOVLW 14
0B50: MOVWF 46
0B51: BCF 0A.3
0B52: CALL 0A9
0B53: BSF 0A.3
.................... if(!input(S5))
0B54: BSF 03.5
0B55: BSF 06.1
0B56: BCF 03.5
0B57: BTFSC 06.1
0B58: GOTO 364
.................... {
.................... sound_beep(100,800);
0B59: MOVLW 64
0B5A: MOVWF 39
0B5B: MOVLW 03
0B5C: MOVWF 3B
0B5D: MOVLW 20
0B5E: MOVWF 3A
0B5F: BCF 0A.3
0B60: CALL 60D
0B61: BSF 0A.3
.................... voltage_setup=FALSE;
0B62: BCF 36.1
.................... time_setup=TRUE;
0B63: BSF 36.2
.................... }
.................... }
....................
.................... if(!input(S6)) // prepnuti na nastavovani napeti
0B64: BSF 03.5
0B65: BSF 06.2
0B66: BCF 03.5
0B67: BTFSC 06.2
0B68: GOTO 37E
.................... {
.................... delay_ms(20);
0B69: MOVLW 14
0B6A: MOVWF 46
0B6B: BCF 0A.3
0B6C: CALL 0A9
0B6D: BSF 0A.3
.................... if(!input(S6))
0B6E: BSF 03.5
0B6F: BSF 06.2
0B70: BCF 03.5
0B71: BTFSC 06.2
0B72: GOTO 37E
.................... {
.................... sound_beep(100,800);
0B73: MOVLW 64
0B74: MOVWF 39
0B75: MOVLW 03
0B76: MOVWF 3B
0B77: MOVLW 20
0B78: MOVWF 3A
0B79: BCF 0A.3
0B7A: CALL 60D
0B7B: BSF 0A.3
.................... voltage_setup=TRUE;
0B7C: BSF 36.1
.................... time_setup=FALSE;
0B7D: BCF 36.2
.................... }
.................... }
.................... }
....................
.................... if ( input(S1) && input(S2) && input(S3) && input(S4) && input(S5) && input(S6)) // detekce pustenych tlacitek
0B7E: BSF 2F.2
0B7F: MOVF 2F,W
0B80: BSF 03.5
0B81: MOVWF 07
0B82: BCF 03.5
0B83: BTFSS 07.2
0B84: GOTO 3A1
0B85: BSF 2F.3
0B86: MOVF 2F,W
0B87: BSF 03.5
0B88: MOVWF 07
0B89: BCF 03.5
0B8A: BTFSS 07.3
0B8B: GOTO 3A1
0B8C: BSF 03.5
0B8D: BSF 08.0
0B8E: BCF 03.5
0B8F: BTFSS 08.0
0B90: GOTO 3A1
0B91: BSF 03.5
0B92: BSF 08.1
0B93: BCF 03.5
0B94: BTFSS 08.1
0B95: GOTO 3A1
0B96: BSF 03.5
0B97: BSF 06.1
0B98: BCF 03.5
0B99: BTFSS 06.1
0B9A: GOTO 3A1
0B9B: BSF 03.5
0B9C: BSF 06.2
0B9D: BCF 03.5
0B9E: BTFSS 06.2
0B9F: GOTO 3A1
.................... {
.................... button_press=false;
0BA0: BCF 36.0
.................... }
.................... }
0BA1: GOTO 118
.................... }
0BA2: SLEEP
 
Configuration Fuses:
Word 1: 2CF5 INTRC NOWDT NOPUT MCLR NOPROTECT NOCPD NOBROWNOUT IESO FCMEN NOLVP NODEBUG
Word 2: 3FFF NOWRT BORV40