CCS PCH C Compiler, Version 5.103, 56135               17-May-24 11:42

               Filename:   D:\owncloud8.2\2023-24 assignments\embedded C\Embedded C EES\practical\Gillepie Joseph\JosephGillespie-ACDA4013-Practical\proteus\PIC18F25K22_1\Debug.lst

               ROM used:   1202 bytes (4%)
                           Largest free fragment is 31566
               RAM used:   16 (1%) at main() level
                           30 (2%) worst case
               Stack used: 5 locations
               Stack size: 31

*
0000:  GOTO   0398
.................... #import(file="main.o")
.................... #include <main.h>
.................... #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 50,6F
0006:  DATA 74,20
0008:  DATA 41,20
000A:  DATA 56,61
000C:  DATA 6C,75
000E:  DATA 65,20
0010:  DATA 3D,25
0012:  DATA 33,75
0014:  DATA 00,00
0016:  DATA 50,6F
0018:  DATA 74,20
001A:  DATA 42,20
001C:  DATA 56,61
001E:  DATA 6C,75
0020:  DATA 65,20
0022:  DATA 3D,25
0024:  DATA 33,75
0026:  DATA 00,00
0028:  DATA 50,6F
002A:  DATA 74,20
002C:  DATA 43,20
002E:  DATA 56,61
0030:  DATA 6C,75
0032:  DATA 65,20
0034:  DATA 3D,25
0036:  DATA 33,75
0038:  DATA 00,00
*
02A0:  TBLRD*+
02A2:  MOVFF  FF6,11
02A6:  MOVFF  FF7,12
02AA:  MOVFF  FF5,13
02AE:  RCALL  0250
02B0:  MOVFF  11,FF6
02B4:  MOVFF  12,FF7
02B8:  DECFSZ 10,F
02BA:  BRA    02A0
02BC:  RETURN 0
02BE:  MOVF   13,W
02C0:  CLRF   01
02C2:  SUBWF  12,W
02C4:  BC    02CC
02C6:  MOVFF  12,00
02CA:  BRA    02E4
02CC:  CLRF   00
02CE:  MOVLW  08
02D0:  MOVWF  14
02D2:  RLCF   12,F
02D4:  RLCF   00,F
02D6:  MOVF   13,W
02D8:  SUBWF  00,W
02DA:  BTFSC  FD8.0
02DC:  MOVWF  00
02DE:  RLCF   01,F
02E0:  DECFSZ 14,F
02E2:  BRA    02D2
02E4:  RETURN 0
02E6:  MOVF   01,W
02E8:  MOVFF  10,12
02EC:  MOVLW  64
02EE:  MOVWF  13
02F0:  RCALL  02BE
02F2:  MOVFF  00,10
02F6:  MOVF   01,W
02F8:  MOVLW  30
02FA:  BNZ   030A
02FC:  BTFSS  11.1
02FE:  BRA    0318
0300:  BTFSC  11.3
0302:  BRA    0318
0304:  BTFSC  11.4
0306:  MOVLW  20
0308:  BRA    0310
030A:  BCF    11.3
030C:  BCF    11.4
030E:  BSF    11.0
0310:  ADDWF  01,F
0312:  MOVFF  01,13
0316:  RCALL  0250
0318:  MOVFF  10,12
031C:  MOVLW  0A
031E:  MOVWF  13
0320:  RCALL  02BE
0322:  MOVFF  00,10
0326:  MOVF   01,W
0328:  MOVLW  30
032A:  BNZ   0338
032C:  BTFSC  11.3
032E:  BRA    0340
0330:  BTFSS  11.0
0332:  BRA    0340
0334:  BTFSC  11.4
0336:  MOVLW  20
0338:  ADDWF  01,F
033A:  MOVFF  01,13
033E:  RCALL  0250
0340:  MOVLW  30
0342:  ADDWF  10,F
0344:  MOVFF  10,13
0348:  RCALL  0250
034A:  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)
*
003A:  CLRF   FEA
003C:  MOVLW  14
003E:  MOVWF  FE9
0040:  MOVF   FEF,W
0042:  BZ    0060
0044:  MOVLW  05
0046:  MOVWF  01
0048:  CLRF   00
004A:  DECFSZ 00,F
004C:  BRA    004A
004E:  DECFSZ 01,F
0050:  BRA    0048
0052:  MOVLW  2E
0054:  MOVWF  00
0056:  DECFSZ 00,F
0058:  BRA    0056
005A:  BRA    005C
005C:  DECFSZ FEF,F
005E:  BRA    0044
0060:  RETURN 0
.................... 
.................... #define LED PIN_C3
.................... #define DELAY 500
.................... 
.................... 
.................... 
.................... 
.................... unsigned long counter = 0;
.................... unsigned ms_count=0;
.................... unsigned press = 0;
.................... unsigned values[4];
.................... 
.................... #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
.................... 
.................... #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);
*
00FA:  BSF    F94.4
....................    output_float(LCD_DATA5);
00FC:  BSF    F94.5
....................    output_float(LCD_DATA6);
00FE:  BSF    F94.6
....................    output_float(LCD_DATA7);
0100:  BSF    F94.7
....................   #else
....................    lcdtris.data = 0xF;
....................   #endif
....................  #endif
....................         
....................    lcd_output_rw(1);
0102:  BSF    F8B.1
0104:  BCF    F94.1
....................    delay_cycles(1);
0106:  NOP   
....................    lcd_output_enable(1);
0108:  BSF    F8B.0
010A:  BCF    F94.0
....................    delay_cycles(1);
010C:  NOP   
....................    high = lcd_read_nibble();
010E:  RCALL  00A8
0110:  MOVFF  01,1B
....................       
....................    lcd_output_enable(0);
0114:  BCF    F8B.0
0116:  BCF    F94.0
....................    delay_cycles(1);
0118:  NOP   
....................    lcd_output_enable(1);
011A:  BSF    F8B.0
011C:  BCF    F94.0
....................    delay_us(1);
011E:  BRA    0120
0120:  BRA    0122
....................    low = lcd_read_nibble();
0122:  RCALL  00A8
0124:  MOVFF  01,1A
....................       
....................    lcd_output_enable(0);
0128:  BCF    F8B.0
012A:  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);
012C:  BCF    F94.4
....................    output_drive(LCD_DATA5);
012E:  BCF    F94.5
....................    output_drive(LCD_DATA6);
0130:  BCF    F94.6
....................    output_drive(LCD_DATA7);
0132:  BCF    F94.7
....................   #else
....................    lcdtris.data = 0x0;
....................   #endif
....................  #endif
.................... 
....................    return( (high<<4) | low);
0134:  SWAPF  1B,W
0136:  MOVWF  00
0138:  MOVLW  F0
013A:  ANDWF  00,F
013C:  MOVF   00,W
013E:  IORWF  1A,W
0140:  MOVWF  01
0142:  GOTO   0152 (RETURN)
.................... }
.................... 
.................... unsigned int8 lcd_read_nibble(void)
.................... {
....................   #if (defined(LCD_DATA4) && defined(LCD_DATA5) && defined(LCD_DATA6) && defined(LCD_DATA7))
*
00A8:  CLRF   1C
....................    unsigned int8 n = 0x00;
.................... 
....................    /* Read the data port */
....................    n |= input(LCD_DATA4);
00AA:  BSF    F94.4
00AC:  MOVLW  00
00AE:  BTFSC  F82.4
00B0:  MOVLW  01
00B2:  IORWF  1C,F
....................    n |= input(LCD_DATA5) << 1;
00B4:  BSF    F94.5
00B6:  MOVLW  00
00B8:  BTFSC  F82.5
00BA:  MOVLW  01
00BC:  MOVWF  00
00BE:  BCF    FD8.0
00C0:  RLCF   00,F
00C2:  MOVF   00,W
00C4:  IORWF  1C,F
....................    n |= input(LCD_DATA6) << 2;
00C6:  BSF    F94.6
00C8:  MOVLW  00
00CA:  BTFSC  F82.6
00CC:  MOVLW  01
00CE:  MOVWF  00
00D0:  RLCF   00,F
00D2:  RLCF   00,F
00D4:  MOVLW  FC
00D6:  ANDWF  00,F
00D8:  MOVF   00,W
00DA:  IORWF  1C,F
....................    n |= input(LCD_DATA7) << 3;
00DC:  BSF    F94.7
00DE:  MOVLW  00
00E0:  BTFSC  F82.7
00E2:  MOVLW  01
00E4:  MOVWF  00
00E6:  RLCF   00,F
00E8:  RLCF   00,F
00EA:  RLCF   00,F
00EC:  MOVLW  F8
00EE:  ANDWF  00,F
00F0:  MOVF   00,W
00F2:  IORWF  1C,F
....................    
....................    return(n);
00F4:  MOVFF  1C,01
....................   #else
00F8:  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));
*
0062:  BTFSC  1B.0
0064:  BRA    006A
0066:  BCF    F8B.4
0068:  BRA    006C
006A:  BSF    F8B.4
006C:  BCF    F94.4
....................    output_bit(LCD_DATA5, bit_test(n, 1));
006E:  BTFSC  1B.1
0070:  BRA    0076
0072:  BCF    F8B.5
0074:  BRA    0078
0076:  BSF    F8B.5
0078:  BCF    F94.5
....................    output_bit(LCD_DATA6, bit_test(n, 2));
007A:  BTFSC  1B.2
007C:  BRA    0082
007E:  BCF    F8B.6
0080:  BRA    0084
0082:  BSF    F8B.6
0084:  BCF    F94.6
....................    output_bit(LCD_DATA7, bit_test(n, 3));
0086:  BTFSC  1B.3
0088:  BRA    008E
008A:  BCF    F8B.7
008C:  BRA    0090
008E:  BSF    F8B.7
0090:  BCF    F94.7
....................   #else      
....................    lcdlat.data = n;
....................   #endif
....................       
....................    delay_cycles(1);
0092:  NOP   
....................    lcd_output_enable(1);
0094:  BSF    F8B.0
0096:  BCF    F94.0
....................    delay_us(2);
0098:  MOVLW  02
009A:  MOVWF  00
009C:  DECFSZ 00,F
009E:  BRA    009C
00A0:  NOP   
....................    lcd_output_enable(0);
00A2:  BCF    F8B.0
00A4:  BCF    F94.0
00A6:  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();
*
0146:  BCF    F94.0
....................    lcd_rs_tris();
0148:  BCF    F94.2
....................    lcd_rw_tris();
014A:  BCF    F94.1
....................   #endif
.................... 
....................    lcd_output_rs(0);
014C:  BCF    F8B.2
014E:  BCF    F94.2
....................    while ( bit_test(lcd_read_byte(),7) ) ;
0150:  BRA    00FA
0152:  MOVFF  01,1A
0156:  BTFSC  01.7
0158:  BRA    0150
....................    lcd_output_rs(address);
015A:  MOVF   18,F
015C:  BNZ   0162
015E:  BCF    F8B.2
0160:  BRA    0164
0162:  BSF    F8B.2
0164:  BCF    F94.2
....................    delay_cycles(1);
0166:  NOP   
....................    lcd_output_rw(0);
0168:  BCF    F8B.1
016A:  BCF    F94.1
....................    delay_cycles(1);
016C:  NOP   
....................    lcd_output_enable(0);
016E:  BCF    F8B.0
0170:  BCF    F94.0
....................    lcd_send_nibble(n >> 4);
0172:  SWAPF  19,W
0174:  MOVWF  1A
0176:  MOVLW  0F
0178:  ANDWF  1A,F
017A:  MOVFF  1A,1B
017E:  RCALL  0062
....................    lcd_send_nibble(n & 0xf);
0180:  MOVF   19,W
0182:  ANDLW  0F
0184:  MOVWF  1A
0186:  MOVWF  1B
0188:  RCALL  0062
018A:  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};
018C:  MOVLW  28
018E:  MOVWF  10
0190:  MOVLW  0C
0192:  MOVWF  11
0194:  MOVLW  01
0196:  MOVWF  12
0198:  MOVLW  06
019A:  MOVWF  13
....................                              // These bytes need to be sent to the LCD
....................                              // to start it up.
....................    
.................... 
....................    lcd_output_enable(0);
019C:  BCF    F8B.0
019E:  BCF    F94.0
....................    lcd_output_rs(0);
01A0:  BCF    F8B.2
01A2:  BCF    F94.2
....................    lcd_output_rw(0);
01A4:  BCF    F8B.1
01A6:  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);
01A8:  BCF    F94.4
....................    output_drive(LCD_DATA5);
01AA:  BCF    F94.5
....................    output_drive(LCD_DATA6);
01AC:  BCF    F94.6
....................    output_drive(LCD_DATA7);
01AE:  BCF    F94.7
....................   #else
....................    lcdtris.data = 0x0;
....................   #endif
....................    lcd_enable_tris();
01B0:  BCF    F94.0
....................    lcd_rs_tris();
01B2:  BCF    F94.2
....................    lcd_rw_tris();
01B4:  BCF    F94.1
....................  #endif
....................     
....................    delay_ms(15);
01B6:  MOVLW  0F
01B8:  MOVWF  14
01BA:  RCALL  003A
....................    for(i=1;i<=3;++i)
01BC:  MOVLW  01
01BE:  MOVWF  0F
01C0:  MOVF   0F,W
01C2:  SUBLW  03
01C4:  BNC   01D6
....................    {
....................        lcd_send_nibble(3);
01C6:  MOVLW  03
01C8:  MOVWF  1B
01CA:  RCALL  0062
....................        delay_ms(5);
01CC:  MOVLW  05
01CE:  MOVWF  14
01D0:  RCALL  003A
01D2:  INCF   0F,F
01D4:  BRA    01C0
....................    }
....................    
....................    lcd_send_nibble(2);
01D6:  MOVLW  02
01D8:  MOVWF  1B
01DA:  RCALL  0062
....................    delay_ms(5);
01DC:  MOVLW  05
01DE:  MOVWF  14
01E0:  RCALL  003A
....................    for(i=0;i<=3;++i)
01E2:  CLRF   0F
01E4:  MOVF   0F,W
01E6:  SUBLW  03
01E8:  BNC   0204
....................       lcd_send_byte(0,LCD_INIT_STRING[i]);
01EA:  CLRF   03
01EC:  MOVF   0F,W
01EE:  ADDLW  10
01F0:  MOVWF  FE9
01F2:  MOVLW  00
01F4:  ADDWFC 03,W
01F6:  MOVWF  FEA
01F8:  MOVFF  FEF,19
01FC:  CLRF   18
01FE:  RCALL  0146
.................... 
....................   #if defined(LCD_EXTENDED_NEWLINE)
0200:  INCF   0F,F
0202:  BRA    01E4
0204:  GOTO   03E2 (RETURN)
....................    g_LcdX = 0;
....................    g_LcdY = 0;
....................   #endif
.................... }
.................... 
.................... void lcd_gotoxy(unsigned int8 x, unsigned int8 y)
.................... {
....................    unsigned int8 address;
....................    
....................    if(y!=1)
0208:  DECFSZ 15,W
020A:  BRA    020E
020C:  BRA    0214
....................       address=LCD_LINE_TWO;
020E:  MOVLW  40
0210:  MOVWF  16
0212:  BRA    0216
....................    else
....................       address=0;
0214:  CLRF   16
....................      
....................    address+=x-1;
0216:  MOVLW  01
0218:  SUBWF  14,W
021A:  ADDWF  16,F
....................    lcd_send_byte(0,0x80|address);
021C:  MOVF   16,W
021E:  IORLW  80
0220:  MOVWF  17
0222:  CLRF   18
0224:  MOVWF  19
0226:  RCALL  0146
.................... 
....................   #if defined(LCD_EXTENDED_NEWLINE)
0228:  RETURN 0
....................    g_LcdX = x - 1;
....................    g_LcdY = y - 1;
....................   #endif
.................... }
.................... 
.................... void lcd_putc(char c)
.................... {
....................    switch (c)
*
0250:  MOVF   13,W
0252:  XORLW  07
0254:  BZ    0264
0256:  XORLW  0B
0258:  BZ    026E
025A:  XORLW  06
025C:  BZ    027E
025E:  XORLW  02
0260:  BZ    028A
0262:  BRA    0294
....................    {
....................       case '\a'   :  lcd_gotoxy(1,1);     break;
0264:  MOVLW  01
0266:  MOVWF  14
0268:  MOVWF  15
026A:  RCALL  0208
026C:  BRA    029E
.................... 
....................       case '\f'   :  lcd_send_byte(0,1);
026E:  CLRF   18
0270:  MOVLW  01
0272:  MOVWF  19
0274:  RCALL  0146
....................                      delay_ms(2);
0276:  MOVLW  02
0278:  MOVWF  14
027A:  RCALL  003A
....................                     #if defined(LCD_EXTENDED_NEWLINE)
....................                      g_LcdX = 0;
....................                      g_LcdY = 0;
....................                     #endif
....................                      break;
027C:  BRA    029E
.................... 
....................      #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;
027E:  MOVLW  01
0280:  MOVWF  14
0282:  MOVLW  02
0284:  MOVWF  15
0286:  RCALL  0208
0288:  BRA    029E
....................      #endif
....................      
....................       case '\b'   : lcd_send_byte(0,0x10);  break;
028A:  CLRF   18
028C:  MOVLW  10
028E:  MOVWF  19
0290:  RCALL  0146
0292:  BRA    029E
....................      
....................      #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;
0294:  MOVLW  01
0296:  MOVWF  18
0298:  MOVFF  13,19
029C:  RCALL  0146
....................      #endif
....................    }
029E:  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
.................... 
.................... /***************************Globals***********************************/
.................... 
.................... unsigned int read_potA(void);    //They 3 unsigned ints are to set the pot value reders.(Task1)
.................... unsigned int read_potB(void);
.................... unsigned int read_potC(void);
.................... unsigned int valueA;             //Theys are the return values of the pots witch will be githern within there sections.(Task1)
.................... unsigned int valueB;
.................... unsigned int valueC;
.................... unsigned int button1(void);
.................... 
.................... 
.................... void main()
*
0398:  CLRF   FF8
039A:  BCF    FD0.7
039C:  MOVLW  70
039E:  MOVWF  FD3
03A0:  BCF    F9B.6
03A2:  BCF    F9B.7
03A4:  CLRF   05
03A6:  CLRF   04
03A8:  CLRF   06
03AA:  CLRF   07
03AC:  MOVF   FC1,W
03AE:  ANDLW  F0
03B0:  MOVWF  FC1
03B2:  MOVLW  00
03B4:  MOVLB  F
03B6:  MOVWF  x38
03B8:  MOVWF  x39
03BA:  MOVWF  x3A
03BC:  CLRF   F77
03BE:  CLRF   F78
03C0:  CLRF   F79
.................... {
.................... 	setup_adc_ports(sAN0 | sAN1 | sAN2, VSS_VDD);
03C2:  MOVF   FC1,W
03C4:  ANDLW  F0
03C6:  MOVWF  FC1
03C8:  MOVLW  07
03CA:  MOVWF  x38
03CC:  MOVLW  00
03CE:  MOVWF  x39
03D0:  MOVWF  x3A
.................... 	setup_adc(ADC_CLOCK_INTERNAL | ADC_TAD_MUL_0);
03D2:  MOVF   FC0,W
03D4:  ANDLW  C0
03D6:  IORLW  07
03D8:  MOVWF  FC0
03DA:  BCF    FC0.7
03DC:  BSF    FC2.0
.................... 
....................    lcd_init();
03DE:  MOVLB  0
03E0:  BRA    018C
....................  
.................... 	while(TRUE)
.................... 	{
.................... 	   lcd_gotoxy(2,1);		// This section starting with lcd_gotoxy are setting the position of the texst sentraley within the LCD screen.(Task1)
03E2:  MOVLW  02
03E4:  MOVWF  14
03E6:  MOVLW  01
03E8:  MOVWF  15
03EA:  RCALL  0208
.................... 	   printf(lcd_putc,"Pot A Value =%3u",read_potA());
03EC:  RCALL  022A
03EE:  MOVFF  01,0F
03F2:  MOVLW  04
03F4:  MOVWF  FF6
03F6:  MOVLW  00
03F8:  MOVWF  FF7
03FA:  MOVLW  0D
03FC:  MOVWF  10
03FE:  RCALL  02A0
0400:  MOVFF  0F,10
0404:  MOVLW  13
0406:  MOVWF  11
0408:  RCALL  02E6
.................... 	   
.................... 	   lcd_gotoxy(2,2);
040A:  MOVLW  02
040C:  MOVWF  14
040E:  MOVWF  15
0410:  RCALL  0208
.................... 	   printf(lcd_putc,"Pot B Value =%3u",read_potB());		//All printf's are desplaying the texst to the LCD screen.(Task1)
0412:  RCALL  034C
0414:  MOVFF  01,0F
0418:  MOVLW  16
041A:  MOVWF  FF6
041C:  MOVLW  00
041E:  MOVWF  FF7
0420:  MOVLW  0D
0422:  MOVWF  10
0424:  RCALL  02A0
0426:  MOVFF  0F,10
042A:  MOVLW  13
042C:  MOVWF  11
042E:  RCALL  02E6
.................... 	   
.................... 	   lcd_gotoxy(22,1);
0430:  MOVLW  16
0432:  MOVWF  14
0434:  MOVLW  01
0436:  MOVWF  15
0438:  RCALL  0208
.................... 	   printf(lcd_putc,"Pot C Value =%3u",read_potC());
043A:  RCALL  0372
043C:  MOVFF  01,0F
0440:  MOVLW  28
0442:  MOVWF  FF6
0444:  MOVLW  00
0446:  MOVWF  FF7
0448:  MOVLW  0D
044A:  MOVWF  10
044C:  RCALL  02A0
044E:  MOVFF  0F,10
0452:  MOVLW  13
0454:  MOVWF  11
0456:  RCALL  02E6
.................... 	   
.................... 	 if(input(PIN_A4))			//This activated the movement of the moter clockwize when the button is pressed.(Task 2 i)
0458:  BSF    F92.4
045A:  BTFSS  F80.4
045C:  BRA    0466
.................... 	   {
.................... 	      output_high(PIN_A6);
045E:  BCF    F92.6
0460:  BSF    F89.6
.................... 	      output_low(PIN_A7);
0462:  BCF    F92.7
0464:  BCF    F89.7
.................... 
.................... 	   }
.................... /*******************************************************************Attempt at button press for task 2******************************************/	   
.................... /*	   if(input(PIN_A4))			//This activated the movement of the moter when the button is pressed.(Task 2 i)
.................... 	   {
.................... 	      while(input(PIN_A4)==1)
.................... 	      output_high(PIN_A6);
.................... 	      output_low(PIN_A7);
.................... 	      
.................... 	      if(input(PIN_A4))
.................... 	      {
.................... 		 while(input(PIN_A4))
.................... 		 output_low(PIN_A6);         //This stopes the movement of the moter. (Task 2 ii)
.................... 	         output_low(PIN_A7);
.................... 	      }
.................... 
.................... 	   }*/
.................... 	   
.................... /*
.................... Task 2 rif raff
.................... 	   
.................... output_low(PIN_A6);         //This stopes the movement of the moter. (Task 2 ii)
.................... output_low(PIN_A7);
.................... 	   
.................... output_low(PIN_A6);         //This makes the moter move anti clock wize (Task 2 iii)
.................... output_high(PIN_A7);
.................... 	   
.................... output_low(PIN_A6);         //This stopes the movement of the moter. (Task 2 iV)
.................... output_low(PIN_A7);
.................... /*******************************************************************************************************************************************/
.................... 	   
.................... 	   if(input(PIN_A5))		//desplayes the value of Veriable resistor on the LED,s for 2 seconds (Task 3)
0466:  BSF    F92.5
0468:  BTFSS  F80.5
046A:  BRA    04AE
.................... 	   {
.................... 	      output_B(read_potA());    //Desplayes pot A's value in LEDs (Task 3)
046C:  RCALL  022A
046E:  CLRF   F93
0470:  MOVFF  01,F8A
.................... 	      delay_ms(2000);
0474:  MOVLW  08
0476:  MOVWF  0F
0478:  MOVLW  FA
047A:  MOVWF  14
047C:  RCALL  003A
047E:  DECFSZ 0F,F
0480:  BRA    0478
.................... 	      output_B(read_potB());    //Desplayes pot B's Values in LEDs (Task 3)
0482:  RCALL  034C
0484:  CLRF   F93
0486:  MOVFF  01,F8A
.................... 	      delay_ms(2000);
048A:  MOVLW  08
048C:  MOVWF  0F
048E:  MOVLW  FA
0490:  MOVWF  14
0492:  RCALL  003A
0494:  DECFSZ 0F,F
0496:  BRA    048E
.................... 	      output_B(read_potC());	//Desplayes pot C's values in LEDs (Task 3)
0498:  RCALL  0372
049A:  CLRF   F93
049C:  MOVFF  01,F8A
.................... 	      delay_ms(2000);
04A0:  MOVLW  08
04A2:  MOVWF  0F
04A4:  MOVLW  FA
04A6:  MOVWF  14
04A8:  RCALL  003A
04AA:  DECFSZ 0F,F
04AC:  BRA    04A4
.................... 	   }
04AE:  BRA    03E2
.................... 	 }
.................... }
.................... 
04B0:  SLEEP 
.................... unsigned int button1(void) // This is a attempt as getting the button 1 to count up by one on eatch press.(Task2)
.................... {
....................    values[press]=read_adc(adc_read_only);
....................    press++;
....................    if(press>5) press = 0;
....................    set_adc_channel(press);
....................    delay_us(1);
....................    read_adc(adc_start_only);
.................... }
.................... 
.................... unsigned int read_potA(void)  //The following 3 read pot functions are reading the value of the veriable resistor so that it can be printed to the screen. (Task1)
.................... {			      
....................    unsigned int valueA;
....................    set_adc_channel(0);
*
022A:  MOVLW  00
022C:  MOVWF  01
022E:  MOVF   FC2,W
0230:  ANDLW  83
0232:  IORWF  01,W
0234:  MOVWF  FC2
....................    delay_us(20);
0236:  MOVLW  1A
0238:  MOVWF  00
023A:  DECFSZ 00,F
023C:  BRA    023A
023E:  NOP   
....................    valueA=read_adc();
0240:  BSF    FC2.1
0242:  BTFSC  FC2.1
0244:  BRA    0242
0246:  MOVFF  FC4,0F
....................    return(valueA);
024A:  MOVFF  0F,01
024E:  RETURN 0
.................... }
.................... 
.................... unsigned int read_potB(void) //This section reads the pot value of B (Task1)
.................... {
....................    unsigned int valueB;
....................    set_adc_channel(1); 
*
034C:  MOVLW  04
034E:  MOVWF  01
0350:  MOVF   FC2,W
0352:  ANDLW  83
0354:  IORWF  01,W
0356:  MOVWF  FC2
....................    delay_us(20);
0358:  MOVLW  1A
035A:  MOVWF  00
035C:  DECFSZ 00,F
035E:  BRA    035C
0360:  NOP   
....................    valueB=read_adc();
0362:  BSF    FC2.1
0364:  BTFSC  FC2.1
0366:  BRA    0364
0368:  MOVFF  FC4,0F
....................    return(valueB);
036C:  MOVFF  0F,01
0370:  RETURN 0
.................... }
.................... 
.................... unsigned int read_potC(void) //This section reads the pot value of C (Task1)
.................... {
....................    unsigned int valueC;
....................    set_adc_channel(2); 
0372:  MOVLW  08
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   
....................    valueC=read_adc();
0388:  BSF    FC2.1
038A:  BTFSC  FC2.1
038C:  BRA    038A
038E:  MOVFF  FC4,0F
....................    return(valueC);
0392:  MOVFF  0F,01
0396:  RETURN 0
.................... }
.................... 

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
