CCS PCH C Compiler, Version 5.103, 56135               17-May-24 12:48

               Filename:   D:\owncloud8.2\2023-24 assignments\embedded C\Embedded C EES\practical\Versy Cerys\Embedded C Practical\proteus\PIC18F25K22_1\Debug.lst

               ROM used:   1398 bytes (4%)
                           Largest free fragment is 31370
               RAM used:   11 (1%) at main() level
                           25 (2%) worst case
               Stack used: 5 locations
               Stack size: 31

*
0000:  GOTO   0526
.................... #import(file="main.o")
.................... 
.................... 
.................... #include <main.h>
.................... #include <18F25K22.h>
.................... //////////// Standard Header file for the PIC18F25K22 device ////////////////
.................... ///////////////////////////////////////////////////////////////////////////
.................... ////        (C) Copyright 1996, 2020 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.                               ////
.................... ///////////////////////////////////////////////////////////////////////////
.................... #device PIC18F25K22
0004:  DATA 20,20
0006:  DATA 70,6F
0008:  DATA 74,20
000A:  DATA 56,61
000C:  DATA 6C,75
000E:  DATA 65,20
0010:  DATA 31,25
0012:  DATA 34,75
0014:  DATA 00,00
0016:  DATA 70,6F
0018:  DATA 74,20
001A:  DATA 76,61
001C:  DATA 6C,75
001E:  DATA 65,20
0020:  DATA 32,25
0022:  DATA 34,75
0024:  DATA 00,00
0026:  DATA 70,6F
0028:  DATA 74,20
002A:  DATA 76,61
002C:  DATA 6C,75
002E:  DATA 65,20
0030:  DATA 33,25
0032:  DATA 34,55
0034:  DATA 00,00
0036:  DATA 20,20
0038:  DATA 20,20
003A:  DATA 20,20
003C:  DATA 00,00
003E:  DATA 0C,20
0040:  DATA 50,4F
0042:  DATA 54,20
0044:  DATA 4F,4E
0046:  DATA 20,4C
0048:  DATA 45,44
004A:  DATA 53,00
004C:  DATA 0C,20
004E:  DATA 20,61
0050:  DATA 6E,74
0052:  DATA 69,2D
0054:  DATA 63,6C
0056:  DATA 6F,63
0058:  DATA 6B,77
005A:  DATA 69,73
005C:  DATA 65,00
*
02C6:  TBLRD*+
02C8:  MOVFF  FF6,0C
02CC:  MOVFF  FF7,0D
02D0:  MOVFF  FF5,0E
02D4:  RCALL  0276
02D6:  MOVFF  0C,FF6
02DA:  MOVFF  0D,FF7
02DE:  DECFSZ 0B,F
02E0:  BRA    02C6
02E2:  RETURN 0
02E4:  MOVF   0E,W
02E6:  CLRF   01
02E8:  SUBWF  0D,W
02EA:  BC    02F2
02EC:  MOVFF  0D,00
02F0:  BRA    030A
02F2:  CLRF   00
02F4:  MOVLW  08
02F6:  MOVWF  0F
02F8:  RLCF   0D,F
02FA:  RLCF   00,F
02FC:  MOVF   0E,W
02FE:  SUBWF  00,W
0300:  BTFSC  FD8.0
0302:  MOVWF  00
0304:  RLCF   01,F
0306:  DECFSZ 0F,F
0308:  BRA    02F8
030A:  RETURN 0
030C:  MOVF   01,W
030E:  MOVFF  0B,0D
0312:  MOVLW  64
0314:  MOVWF  0E
0316:  RCALL  02E4
0318:  MOVFF  00,0B
031C:  MOVF   01,W
031E:  MOVLW  30
0320:  BNZ   0330
0322:  BTFSS  0C.1
0324:  BRA    033E
0326:  BTFSC  0C.3
0328:  BRA    033E
032A:  BTFSC  0C.4
032C:  MOVLW  20
032E:  BRA    0336
0330:  BCF    0C.3
0332:  BCF    0C.4
0334:  BSF    0C.0
0336:  ADDWF  01,F
0338:  MOVFF  01,0E
033C:  RCALL  0276
033E:  MOVFF  0B,0D
0342:  MOVLW  0A
0344:  MOVWF  0E
0346:  RCALL  02E4
0348:  MOVFF  00,0B
034C:  MOVF   01,W
034E:  MOVLW  30
0350:  BNZ   035E
0352:  BTFSC  0C.3
0354:  BRA    0366
0356:  BTFSS  0C.0
0358:  BRA    0366
035A:  BTFSC  0C.4
035C:  MOVLW  20
035E:  ADDWF  01,F
0360:  MOVFF  01,0E
0364:  RCALL  0276
0366:  MOVLW  30
0368:  ADDWF  0B,F
036A:  MOVFF  0B,0E
036E:  RCALL  0276
0370:  RETURN 0
*
03C2:  TBLRD*+
03C4:  MOVF   FF5,F
03C6:  BZ    03E0
03C8:  MOVFF  FF6,0B
03CC:  MOVFF  FF7,0C
03D0:  MOVFF  FF5,0E
03D4:  RCALL  0276
03D6:  MOVFF  0B,FF6
03DA:  MOVFF  0C,FF7
03DE:  BRA    03C2
03E0:  RETURN 0
.................... 
.................... #list
.................... 
.................... #device ADC=8
.................... 
.................... #FUSES NOWDT                 	//No Watch Dog Timer
.................... #FUSES PRIMARY               	//Primary clock is system clock when scs=00
.................... #FUSES FCMEN                 	//Fail-safe clock monitor enabled
.................... #FUSES IESO                  	//Internal External Switch Over mode enabled
.................... #FUSES PUT                   	//Power Up Timer
.................... #FUSES BROWNOUT              	//Reset when brownout detected
.................... #FUSES BORV19                	//Brownout reset at 1.9V
.................... #FUSES CCP3B5                	//CCP3 input/output multiplexed with RB5
.................... #FUSES HFOFST                	//High Frequency INTRC starts clocking CPU immediately
.................... #FUSES TIMER3C0              	//Timer3 Clock In is on pin C0
.................... #FUSES CCP2B5                	//CCP2 input/output multiplexed with RB5
.................... #FUSES NOPROTECT             	//Code not protected from reading
.................... #FUSES NOWRT                 	//Program memory not write protected
.................... #FUSES NOEBTR                	//Memory not protected from table reads
.................... #FUSES NOMCLR
.................... 
.................... #use delay(internal=16MHz)
*
005E:  CLRF   FEA
0060:  MOVLW  10
0062:  MOVWF  FE9
0064:  MOVF   FEF,W
0066:  BZ    0084
0068:  MOVLW  05
006A:  MOVWF  01
006C:  CLRF   00
006E:  DECFSZ 00,F
0070:  BRA    006E
0072:  DECFSZ 01,F
0074:  BRA    006C
0076:  MOVLW  2E
0078:  MOVWF  00
007A:  DECFSZ 00,F
007C:  BRA    007A
007E:  BRA    0080
0080:  DECFSZ FEF,F
0082:  BRA    0068
0084:  RETURN 0
.................... 
.................... #define LED PIN_C3
.................... #define DELAY 500
.................... 
.................... 
.................... 
.................... #define LCD_ENABLE_PIN PIN_C0
.................... #define LCD_RS_PIN PIN_C2
.................... #define LCD_RW_PIN PIN_C1
.................... #define LCD_DATA4 PIN_C4
.................... #define LCD_DATA5 PIN_C5
.................... #define LCD_DATA6 PIN_C6
.................... #define LCD_DATA7 PIN_C7
.................... 
.................... 
.................... void welcome (void);
.................... unsigned int value1;
.................... unsigned int value2;
.................... unsigned int value3;
.................... unsigned int read_pot1(void);
.................... unsigned int read_pot2(void);
.................... unsigned int read_pot3(void);
.................... unsigned long press=0;
.................... #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             ////
.................... ////                                                                       ////
.................... ////  lcd_cursor_on(int1 on)   Turn the cursor on (on=TRUE) or off         ////
.................... ////              (on=FALSE).                                              ////
.................... ////                                                                       ////
.................... ////  lcd_set_cgram_char(w, *p)   Write a custom character to the CGRAM.   ////
.................... ////                                                                       ////
.................... ////                                                                       ////
.................... ////  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.                               ////
.................... ///////////////////////////////////////////////////////////////////////////
.................... 
.................... #ifndef __LCD_C__
.................... #define __LCD_C__
.................... 
.................... // define the pinout.
.................... // only required if port access is being used.
.................... typedef struct  
.................... {                            // This structure is overlayed
....................    int1 enable;           // on to an I/O port to gain
....................    int1 rs;               // access to the LCD pins.
....................    int1 rw;               // The bits are allocated from
....................    int1 unused;           // low order up.  ENABLE will
....................    unsigned int     data : 4;         // be LSB pin of that port.
....................   #if defined(__PCD__)       // The port used will be LCD_DATA_PORT.
....................    unsigned 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
.................... 
.................... unsigned int8 lcd_read_nibble(void);
.................... 
.................... unsigned int8 lcd_read_byte(void)
.................... {
....................    unsigned int8 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);
*
011E:  BSF    F94.4
....................    output_float(LCD_DATA5);
0120:  BSF    F94.5
....................    output_float(LCD_DATA6);
0122:  BSF    F94.6
....................    output_float(LCD_DATA7);
0124:  BSF    F94.7
....................   #else
....................    lcdtris.data = 0xF;
....................   #endif
....................  #endif
....................         
....................    lcd_output_rw(1);
0126:  BSF    F8B.1
0128:  BCF    F94.1
....................    delay_cycles(1);
012A:  NOP   
....................    lcd_output_enable(1);
012C:  BSF    F8B.0
012E:  BCF    F94.0
....................    delay_cycles(1);
0130:  NOP   
....................    high = lcd_read_nibble();
0132:  RCALL  00CC
0134:  MOVFF  01,16
....................       
....................    lcd_output_enable(0);
0138:  BCF    F8B.0
013A:  BCF    F94.0
....................    delay_cycles(1);
013C:  NOP   
....................    lcd_output_enable(1);
013E:  BSF    F8B.0
0140:  BCF    F94.0
....................    delay_us(1);
0142:  BRA    0144
0144:  BRA    0146
....................    low = lcd_read_nibble();
0146:  RCALL  00CC
0148:  MOVFF  01,15
....................       
....................    lcd_output_enable(0);
014C:  BCF    F8B.0
014E:  BCF    F94.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);
0150:  BCF    F94.4
....................    output_drive(LCD_DATA5);
0152:  BCF    F94.5
....................    output_drive(LCD_DATA6);
0154:  BCF    F94.6
....................    output_drive(LCD_DATA7);
0156:  BCF    F94.7
....................   #else
....................    lcdtris.data = 0x0;
....................   #endif
....................  #endif
.................... 
....................    return( (high<<4) | low);
0158:  SWAPF  16,W
015A:  MOVWF  00
015C:  MOVLW  F0
015E:  ANDWF  00,F
0160:  MOVF   00,W
0162:  IORWF  15,W
0164:  MOVWF  01
0166:  GOTO   0176 (RETURN)
.................... }
.................... 
.................... unsigned int8 lcd_read_nibble(void)
.................... {
....................   #if (defined(LCD_DATA4) && defined(LCD_DATA5) && defined(LCD_DATA6) && defined(LCD_DATA7))
*
00CC:  CLRF   17
....................    unsigned int8 n = 0x00;
.................... 
....................    /* Read the data port */
....................    n |= input(LCD_DATA4);
00CE:  BSF    F94.4
00D0:  MOVLW  00
00D2:  BTFSC  F82.4
00D4:  MOVLW  01
00D6:  IORWF  17,F
....................    n |= input(LCD_DATA5) << 1;
00D8:  BSF    F94.5
00DA:  MOVLW  00
00DC:  BTFSC  F82.5
00DE:  MOVLW  01
00E0:  MOVWF  00
00E2:  BCF    FD8.0
00E4:  RLCF   00,F
00E6:  MOVF   00,W
00E8:  IORWF  17,F
....................    n |= input(LCD_DATA6) << 2;
00EA:  BSF    F94.6
00EC:  MOVLW  00
00EE:  BTFSC  F82.6
00F0:  MOVLW  01
00F2:  MOVWF  00
00F4:  RLCF   00,F
00F6:  RLCF   00,F
00F8:  MOVLW  FC
00FA:  ANDWF  00,F
00FC:  MOVF   00,W
00FE:  IORWF  17,F
....................    n |= input(LCD_DATA7) << 3;
0100:  BSF    F94.7
0102:  MOVLW  00
0104:  BTFSC  F82.7
0106:  MOVLW  01
0108:  MOVWF  00
010A:  RLCF   00,F
010C:  RLCF   00,F
010E:  RLCF   00,F
0110:  MOVLW  F8
0112:  ANDWF  00,F
0114:  MOVF   00,W
0116:  IORWF  17,F
....................    
....................    return(n);
0118:  MOVFF  17,01
....................   #else
011C:  RETURN 0
....................    return(lcd.data);
....................   #endif
.................... }
.................... 
.................... void lcd_send_nibble(unsigned int8 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));
*
0086:  BTFSC  16.0
0088:  BRA    008E
008A:  BCF    F8B.4
008C:  BRA    0090
008E:  BSF    F8B.4
0090:  BCF    F94.4
....................    output_bit(LCD_DATA5, bit_test(n, 1));
0092:  BTFSC  16.1
0094:  BRA    009A
0096:  BCF    F8B.5
0098:  BRA    009C
009A:  BSF    F8B.5
009C:  BCF    F94.5
....................    output_bit(LCD_DATA6, bit_test(n, 2));
009E:  BTFSC  16.2
00A0:  BRA    00A6
00A2:  BCF    F8B.6
00A4:  BRA    00A8
00A6:  BSF    F8B.6
00A8:  BCF    F94.6
....................    output_bit(LCD_DATA7, bit_test(n, 3));
00AA:  BTFSC  16.3
00AC:  BRA    00B2
00AE:  BCF    F8B.7
00B0:  BRA    00B4
00B2:  BSF    F8B.7
00B4:  BCF    F94.7
....................   #else      
....................    lcdlat.data = n;
....................   #endif
....................       
....................    delay_cycles(1);
00B6:  NOP   
....................    lcd_output_enable(1);
00B8:  BSF    F8B.0
00BA:  BCF    F94.0
....................    delay_us(2);
00BC:  MOVLW  02
00BE:  MOVWF  00
00C0:  DECFSZ 00,F
00C2:  BRA    00C0
00C4:  NOP   
....................    lcd_output_enable(0);
00C6:  BCF    F8B.0
00C8:  BCF    F94.0
00CA:  RETURN 0
.................... }
.................... 
.................... void lcd_send_byte(unsigned int8 address, unsigned int8 n)
.................... {
....................   #if defined(__PCB__)
....................    set_tris_lcd(LCD_OUTPUT_MAP);
....................   #else
....................    lcd_enable_tris();
*
016A:  BCF    F94.0
....................    lcd_rs_tris();
016C:  BCF    F94.2
....................    lcd_rw_tris();
016E:  BCF    F94.1
....................   #endif
.................... 
....................    lcd_output_rs(0);
0170:  BCF    F8B.2
0172:  BCF    F94.2
....................    while ( bit_test(lcd_read_byte(),7) ) ;
0174:  BRA    011E
0176:  MOVFF  01,15
017A:  BTFSC  01.7
017C:  BRA    0174
....................    lcd_output_rs(address);
017E:  MOVF   13,F
0180:  BNZ   0186
0182:  BCF    F8B.2
0184:  BRA    0188
0186:  BSF    F8B.2
0188:  BCF    F94.2
....................    delay_cycles(1);
018A:  NOP   
....................    lcd_output_rw(0);
018C:  BCF    F8B.1
018E:  BCF    F94.1
....................    delay_cycles(1);
0190:  NOP   
....................    lcd_output_enable(0);
0192:  BCF    F8B.0
0194:  BCF    F94.0
....................    lcd_send_nibble(n >> 4);
0196:  SWAPF  14,W
0198:  MOVWF  15
019A:  MOVLW  0F
019C:  ANDWF  15,F
019E:  MOVFF  15,16
01A2:  RCALL  0086
....................    lcd_send_nibble(n & 0xf);
01A4:  MOVF   14,W
01A6:  ANDLW  0F
01A8:  MOVWF  15
01AA:  MOVWF  16
01AC:  RCALL  0086
01AE:  RETURN 0
.................... }
.................... 
.................... #if defined(LCD_EXTENDED_NEWLINE)
.................... unsigned int8 g_LcdX, g_LcdY;
.................... #endif
.................... 
.................... void lcd_init(void) 
.................... {
....................    unsigned int8 i;
....................    unsigned int8 LCD_INIT_STRING[4] = {0x20 | (LCD_TYPE << 2), 0xc, 1, 6};
01B0:  MOVLW  28
01B2:  MOVWF  0C
01B4:  MOVLW  0C
01B6:  MOVWF  0D
01B8:  MOVLW  01
01BA:  MOVWF  0E
01BC:  MOVLW  06
01BE:  MOVWF  0F
....................                              // These bytes need to be sent to the LCD
....................                              // to start it up.
....................    
.................... 
....................    lcd_output_enable(0);
01C0:  BCF    F8B.0
01C2:  BCF    F94.0
....................    lcd_output_rs(0);
01C4:  BCF    F8B.2
01C6:  BCF    F94.2
....................    lcd_output_rw(0);
01C8:  BCF    F8B.1
01CA:  BCF    F94.1
.................... 
....................  #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);
01CC:  BCF    F94.4
....................    output_drive(LCD_DATA5);
01CE:  BCF    F94.5
....................    output_drive(LCD_DATA6);
01D0:  BCF    F94.6
....................    output_drive(LCD_DATA7);
01D2:  BCF    F94.7
....................   #else
....................    lcdtris.data = 0x0;
....................   #endif
....................    lcd_enable_tris();
01D4:  BCF    F94.0
....................    lcd_rs_tris();
01D6:  BCF    F94.2
....................    lcd_rw_tris();
01D8:  BCF    F94.1
....................  #endif
....................     
....................    delay_ms(15);
01DA:  MOVLW  0F
01DC:  MOVWF  10
01DE:  RCALL  005E
....................    for(i=1;i<=3;++i)
01E0:  MOVLW  01
01E2:  MOVWF  0B
01E4:  MOVF   0B,W
01E6:  SUBLW  03
01E8:  BNC   01FA
....................    {
....................        lcd_send_nibble(3);
01EA:  MOVLW  03
01EC:  MOVWF  16
01EE:  RCALL  0086
....................        delay_ms(5);
01F0:  MOVLW  05
01F2:  MOVWF  10
01F4:  RCALL  005E
01F6:  INCF   0B,F
01F8:  BRA    01E4
....................    }
....................    
....................    lcd_send_nibble(2);
01FA:  MOVLW  02
01FC:  MOVWF  16
01FE:  RCALL  0086
....................    delay_ms(5);
0200:  MOVLW  05
0202:  MOVWF  10
0204:  RCALL  005E
....................    for(i=0;i<=3;++i)
0206:  CLRF   0B
0208:  MOVF   0B,W
020A:  SUBLW  03
020C:  BNC   0228
....................       lcd_send_byte(0,LCD_INIT_STRING[i]);
020E:  CLRF   03
0210:  MOVF   0B,W
0212:  ADDLW  0C
0214:  MOVWF  FE9
0216:  MOVLW  00
0218:  ADDWFC 03,W
021A:  MOVWF  FEA
021C:  MOVFF  FEF,14
0220:  CLRF   13
0222:  RCALL  016A
.................... 
....................   #if defined(LCD_EXTENDED_NEWLINE)
0224:  INCF   0B,F
0226:  BRA    0208
0228:  GOTO   0570 (RETURN)
....................    g_LcdX = 0;
....................    g_LcdY = 0;
....................   #endif
.................... }
.................... 
.................... void lcd_gotoxy(unsigned int8 x, unsigned int8 y)
.................... {
....................    unsigned int8 address;
....................    
....................    if(y!=1)
022C:  DECFSZ 10,W
022E:  BRA    0232
0230:  BRA    0238
....................       address=LCD_LINE_TWO;
0232:  MOVLW  40
0234:  MOVWF  11
0236:  BRA    023A
....................    else
....................       address=0;
0238:  CLRF   11
....................      
....................    address+=x-1;
023A:  MOVLW  01
023C:  SUBWF  0F,W
023E:  ADDWF  11,F
....................    lcd_send_byte(0,0x80|address);
0240:  MOVF   11,W
0242:  IORLW  80
0244:  MOVWF  12
0246:  CLRF   13
0248:  MOVWF  14
024A:  RCALL  016A
.................... 
....................   #if defined(LCD_EXTENDED_NEWLINE)
024C:  RETURN 0
....................    g_LcdX = x - 1;
....................    g_LcdY = y - 1;
....................   #endif
.................... }
.................... 
.................... void lcd_putc(char c)
.................... {
....................    switch (c)
*
0276:  MOVF   0E,W
0278:  XORLW  07
027A:  BZ    028A
027C:  XORLW  0B
027E:  BZ    0294
0280:  XORLW  06
0282:  BZ    02A4
0284:  XORLW  02
0286:  BZ    02B0
0288:  BRA    02BA
....................    {
....................       case '\a'   :  lcd_gotoxy(1,1);     break;
028A:  MOVLW  01
028C:  MOVWF  0F
028E:  MOVWF  10
0290:  RCALL  022C
0292:  BRA    02C4
.................... 
....................       case '\f'   :  lcd_send_byte(0,1);
0294:  CLRF   13
0296:  MOVLW  01
0298:  MOVWF  14
029A:  RCALL  016A
....................                      delay_ms(2);
029C:  MOVLW  02
029E:  MOVWF  10
02A0:  RCALL  005E
....................                     #if defined(LCD_EXTENDED_NEWLINE)
....................                      g_LcdX = 0;
....................                      g_LcdY = 0;
....................                     #endif
....................                      break;
02A2:  BRA    02C4
.................... 
....................      #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;
02A4:  MOVLW  01
02A6:  MOVWF  0F
02A8:  MOVLW  02
02AA:  MOVWF  10
02AC:  RCALL  022C
02AE:  BRA    02C4
....................      #endif
....................      
....................       case '\b'   : lcd_send_byte(0,0x10);  break;
02B0:  CLRF   13
02B2:  MOVLW  10
02B4:  MOVWF  14
02B6:  RCALL  016A
02B8:  BRA    02C4
....................      
....................      #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;
02BA:  MOVLW  01
02BC:  MOVWF  13
02BE:  MOVFF  0E,14
02C2:  RCALL  016A
....................      #endif
....................    }
02C4:  RETURN 0
.................... }
....................  
.................... char lcd_getc(unsigned int8 x, unsigned int8 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);
.................... }
.................... 
.................... // write a custom character to the ram
.................... // which is 0-7 and specifies which character array we are modifying.
.................... // ptr points to an array of 8 bytes, where each byte is the next row of
.................... //    pixels.  only bits 0-4 are used.  the last row is the cursor row, and
.................... //    usually you will want to leave this byte 0x00.
.................... void lcd_set_cgram_char(unsigned int8 which, unsigned int8 *ptr)
.................... {
....................    unsigned int i;
.................... 
....................    which <<= 3;
....................    which &= 0x38;
.................... 
....................    lcd_send_byte(0, 0x40 | which);  //set cgram address
.................... 
....................    for(i=0; i<8; i++)
....................    {
....................       lcd_send_byte(1, *ptr++);
....................    }
....................   
....................    #if defined(LCD_EXTENDED_NEWLINE)
....................     lcd_gotoxy(g_LcdX+1, g_LcdY+1);  //set ddram address
....................    #endif
.................... }
.................... 
.................... void lcd_cursor_on(int1 on)
.................... {
....................    if (on)
....................    {
....................       lcd_send_byte(0,0x0F);           //turn LCD cursor ON
....................    }
....................    else
....................    {
....................       lcd_send_byte(0,0x0C);           //turn LCD cursor OFF
....................    }
.................... }
.................... 
.................... #endif
.................... 
.................... 
.................... void main()
*
0526:  CLRF   FF8
0528:  BCF    FD0.7
052A:  MOVLW  70
052C:  MOVWF  FD3
052E:  BCF    F9B.6
0530:  BCF    F9B.7
0532:  CLRF   08
0534:  CLRF   07
0536:  CLRF   0A
0538:  CLRF   09
053A:  MOVF   FC1,W
053C:  ANDLW  F0
053E:  MOVWF  FC1
0540:  MOVLW  00
0542:  MOVLB  F
0544:  MOVWF  x38
0546:  MOVWF  x39
0548:  MOVWF  x3A
054A:  CLRF   F77
054C:  CLRF   F78
054E:  CLRF   F79
.................... {
.................... 	setup_adc_ports(sAN0 | sAN1 | sAN2, VSS_VDD);
0550:  MOVF   FC1,W
0552:  ANDLW  F0
0554:  MOVWF  FC1
0556:  MOVLW  07
0558:  MOVWF  x38
055A:  MOVLW  00
055C:  MOVWF  x39
055E:  MOVWF  x3A
.................... 	setup_adc(ADC_CLOCK_INTERNAL | ADC_TAD_MUL_0);
0560:  MOVF   FC0,W
0562:  ANDLW  C0
0564:  IORLW  07
0566:  MOVWF  FC0
0568:  BCF    FC0.7
056A:  BSF    FC2.0
.................... 
....................    lcd_init();
056C:  MOVLB  0
056E:  BRA    01B0
....................  
.................... 	while(TRUE)
.................... 	{
.................... 
.................... 		//Example blinking LED program dont forget to remark out the following line
.................... 			welcome();					// display welcome message
0570:  BRA    03E2
0572:  BRA    0570
.................... 
.................... 		
.................... 				
.................... 		
.................... 	
.................... 	}
....................   
.................... }
.................... 
0574:  SLEEP 
.................... void welcome (void)
.................... 	{				
.................... 	 
.................... 	   	  printf(lcd_putc,"");		// clear the screenand print the wecome message.
.................... 					lcd_gotoxy(2,1);
*
03E2:  MOVLW  02
03E4:  MOVWF  0F
03E6:  MOVLW  01
03E8:  MOVWF  10
03EA:  RCALL  022C
.................... 					value1=read_pot1();  
03EC:  BRA    024E
03EE:  MOVFF  01,04
.................... 					printf(lcd_putc,"  pot Value 1%4u",value1);
03F2:  MOVLW  04
03F4:  MOVWF  FF6
03F6:  MOVLW  00
03F8:  MOVWF  FF7
03FA:  MOVLW  0D
03FC:  MOVWF  0B
03FE:  RCALL  02C6
0400:  MOVLW  01
0402:  MOVWF  0B
0404:  MOVLW  20
0406:  MOVWF  0E
0408:  RCALL  0276
040A:  DECFSZ 0B,F
040C:  BRA    0404
040E:  MOVFF  04,0B
0412:  MOVLW  13
0414:  MOVWF  0C
0416:  RCALL  030C
.................... 					lcd_gotoxy(4,2);
0418:  MOVLW  04
041A:  MOVWF  0F
041C:  MOVLW  02
041E:  MOVWF  10
0420:  RCALL  022C
.................... 					value2=read_pot2();
0422:  BRA    0372
0424:  MOVFF  01,05
.................... 					printf(lcd_putc,"pot value 2%4u",value2);
0428:  MOVLW  16
042A:  MOVWF  FF6
042C:  MOVLW  00
042E:  MOVWF  FF7
0430:  MOVLW  0B
0432:  MOVWF  0B
0434:  RCALL  02C6
0436:  MOVLW  01
0438:  MOVWF  0B
043A:  MOVLW  20
043C:  MOVWF  0E
043E:  RCALL  0276
0440:  DECFSZ 0B,F
0442:  BRA    043A
0444:  MOVFF  05,0B
0448:  MOVLW  13
044A:  MOVWF  0C
044C:  RCALL  030C
.................... 					lcd_gotoxy(24,1);
044E:  MOVLW  18
0450:  MOVWF  0F
0452:  MOVLW  01
0454:  MOVWF  10
0456:  RCALL  022C
.................... 					value3=read_pot3();
0458:  BRA    039A
045A:  MOVFF  01,06
.................... 					printf(lcd_putc,"pot value 3%4U",value3);
045E:  MOVLW  26
0460:  MOVWF  FF6
0462:  MOVLW  00
0464:  MOVWF  FF7
0466:  MOVLW  0B
0468:  MOVWF  0B
046A:  RCALL  02C6
046C:  MOVLW  01
046E:  MOVWF  0B
0470:  MOVLW  20
0472:  MOVWF  0E
0474:  RCALL  0276
0476:  DECFSZ 0B,F
0478:  BRA    0470
047A:  MOVFF  06,0B
047E:  MOVLW  13
0480:  MOVWF  0C
0482:  RCALL  030C
.................... 					lcd_gotoxy(23,2);
0484:  MOVLW  17
0486:  MOVWF  0F
0488:  MOVLW  02
048A:  MOVWF  10
048C:  RCALL  022C
.................... 					printf(lcd_putc,"      ");
048E:  MOVLW  36
0490:  MOVWF  FF6
0492:  MOVLW  00
0494:  MOVWF  FF7
0496:  RCALL  03C2
.................... 					output_B(0);
0498:  CLRF   F93
049A:  CLRF   F8A
.................... 					output_low(PIN_A6);
049C:  BCF    F92.6
049E:  BCF    F89.6
.................... 					output_low(PIN_A7);
04A0:  BCF    F92.7
04A2:  BCF    F89.7
.................... 	    if(input(PIN_A5))
04A4:  BSF    F92.5
04A6:  BTFSS  F80.5
04A8:  BRA    04F0
.................... 	    {
.................... 	       // button 2 code
.................... 	       printf(lcd_putc,"\f POT ON LEDS");
04AA:  MOVLW  3E
04AC:  MOVWF  FF6
04AE:  MOVLW  00
04B0:  MOVWF  FF7
04B2:  RCALL  03C2
.................... 	       output_B(value1);
04B4:  CLRF   F93
04B6:  MOVFF  04,F8A
.................... 	       delay_ms(800);
04BA:  MOVLW  04
04BC:  MOVWF  0B
04BE:  MOVLW  C8
04C0:  MOVWF  10
04C2:  RCALL  005E
04C4:  DECFSZ 0B,F
04C6:  BRA    04BE
.................... 	       output_B(value2);
04C8:  CLRF   F93
04CA:  MOVFF  05,F8A
.................... 	       delay_ms(800);
04CE:  MOVLW  04
04D0:  MOVWF  0B
04D2:  MOVLW  C8
04D4:  MOVWF  10
04D6:  RCALL  005E
04D8:  DECFSZ 0B,F
04DA:  BRA    04D2
.................... 	       output_B(value3);
04DC:  CLRF   F93
04DE:  MOVFF  06,F8A
.................... 	       delay_ms(800);			
04E2:  MOVLW  04
04E4:  MOVWF  0B
04E6:  MOVLW  C8
04E8:  MOVWF  10
04EA:  RCALL  005E
04EC:  DECFSZ 0B,F
04EE:  BRA    04E6
.................... 	    }
.................... 	    
.................... 	    
.................... 	     if(input(PIN_A4))
04F0:  BSF    F92.4
04F2:  BTFSS  F80.4
04F4:  BRA    0522
.................... 	   {
.................... 	      // button 1 code
.................... 	      // setup a counter whih meets the condtions for each statment so when the button is pressed it counts us and then meets the next condition allowing you to go to the next section
.................... 	      press = 0; 
04F6:  CLRF   08
04F8:  CLRF   07
.................... 	      lcd_gotoxy(2,1);
04FA:  MOVLW  02
04FC:  MOVWF  0F
04FE:  MOVLW  01
0500:  MOVWF  10
0502:  RCALL  022C
.................... 	      printf(lcd_putc,"\f  anti-clockwise");
0504:  MOVLW  4C
0506:  MOVWF  FF6
0508:  MOVLW  00
050A:  MOVWF  FF7
050C:  RCALL  03C2
.................... 	      output_high(PIN_A6);
050E:  BCF    F92.6
0510:  BSF    F89.6
.................... 	      output_low(PIN_A7);
0512:  BCF    F92.7
0514:  BCF    F89.7
.................... 	      delay_ms(200);
0516:  MOVLW  C8
0518:  MOVWF  10
051A:  RCALL  005E
.................... 	      press ++ ;
051C:  INCF   07,F
051E:  BTFSC  FD8.2
0520:  INCF   08,F
.................... 	    
.................... 	   }  
0522:  GOTO   0572 (RETURN)
.................... 	      //while(press=2;)
.................... 	   //   {
.................... 		 //button 1 code
.................... 		//printf(lcd_putc,"\f   STOP");
.................... 	    //  output_low(PIN_A6);
.................... 	    //  output_low(PIN_A7);
.................... 		// press = press+1;
.................... 		 
.................... 	     // }
.................... 	     /*
.................... 	     for(press=2)
.................... 		// button 1 code
.................... 	     {
.................... 		printf(lcd_putc,"\f clockwise");
.................... 		output_high(PIN_A7);
.................... 	        output_low(PIN_A6);
.................... 		 press = press+1;
.................... 		
.................... 	     }
.................... 		if(press==5)
.................... 		{
.................... 		   //button 1 code
.................... 		 printf(lcd_putc,"\f stop");
.................... 		  output_low(PIN_A7);
.................... 		  output_low(PIN_A6);
.................... 		   press = press+1;
.................... 		  */ 
.................... 		}
.................... 	    
.................... 					
.................... 	
.................... 	
.................... 	
.................... unsigned int read_pot1(void)
.................... 	 {
.................... 	    unsigned int value1;
.................... 	    set_adc_channel(0);
*
024E:  MOVLW  00
0250:  MOVWF  01
0252:  MOVF   FC2,W
0254:  ANDLW  83
0256:  IORWF  01,W
0258:  MOVWF  FC2
.................... 	    delay_us(20);
025A:  MOVLW  1A
025C:  MOVWF  00
025E:  DECFSZ 00,F
0260:  BRA    025E
0262:  NOP   
.................... 	    value1=read_adc();
0264:  BSF    FC2.1
0266:  BTFSC  FC2.1
0268:  BRA    0266
026A:  MOVFF  FC4,0B
.................... 	    return(value1);
026E:  MOVFF  0B,01
0272:  GOTO   03EE (RETURN)
.................... 	 } 
.................... 	 
.................... unsigned int read_pot2(void)
.................... 	 {
.................... 	    unsigned int value2;
.................... 	    set_adc_channel(1);
*
0372:  MOVLW  04
0374:  MOVWF  01
0376:  MOVF   FC2,W
0378:  ANDLW  83
037A:  IORWF  01,W
037C:  MOVWF  FC2
.................... 	    delay_us(20);
037E:  MOVLW  1A
0380:  MOVWF  00
0382:  DECFSZ 00,F
0384:  BRA    0382
0386:  NOP   
.................... 	    value2=read_adc();
0388:  BSF    FC2.1
038A:  BTFSC  FC2.1
038C:  BRA    038A
038E:  MOVFF  FC4,0B
.................... 	    return(value2);
0392:  MOVFF  0B,01
0396:  GOTO   0424 (RETURN)
.................... 	 } 
.................... 
.................... unsigned int read_pot3(void)
.................... 	 {
.................... 	    unsigned int value3;
.................... 	    set_adc_channel(2);
039A:  MOVLW  08
039C:  MOVWF  01
039E:  MOVF   FC2,W
03A0:  ANDLW  83
03A2:  IORWF  01,W
03A4:  MOVWF  FC2
.................... 	    delay_us(20);
03A6:  MOVLW  1A
03A8:  MOVWF  00
03AA:  DECFSZ 00,F
03AC:  BRA    03AA
03AE:  NOP   
.................... 	    value3=read_adc();
03B0:  BSF    FC2.1
03B2:  BTFSC  FC2.1
03B4:  BRA    03B2
03B6:  MOVFF  FC4,0B
.................... 	    return(value3);
03BA:  MOVFF  0B,01
03BE:  GOTO   045A (RETURN)
.................... 	 } 
.................... 	 
.................... 

Configuration Fuses:
   Word  1: E800   INTRC_IO NOPLLEN PRIMARY FCMEN IESO
   Word  2: 3C1E   PUT BROWNOUT BORV19 NOWDT WDT32768
   Word  3: 3F00   CCP2C1 PBADEN CCP3B5 HFOFST TIMER3C0 CCP2B5 NOMCLR
   Word  4: 0081   STVREN NOLVP NOXINST NODEBUG
   Word  5: C00F   NOPROTECT NOCPB NOCPD
   Word  6: E00F   NOWRT NOWRTC NOWRTB NOWRTD
   Word  7: 400F   NOEBTR NOEBTRB
