CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

What does the moved IRQ/RESET look like in a list file?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
treitmey



Joined: 23 Jan 2004
Posts: 1094
Location: Appleton,WI USA

View user's profile Send private message Visit poster's website

What does the moved IRQ/RESET look like in a list file?
PostPosted: Mon Feb 13, 2006 5:58 pm     Reply with quote

What does the moved IRQ/RESET look like in a list file?
I want to verify that my #build statement did what I want.

Code:
//=======================//
#define  FIRM_MAJOR  2
#define  FIRM_MINOR  00
#define  HARD_MAJOR  3
#define  HARD_MINOR  01
#define  PROD_ID     1
//=======================//
#include <18f452.h>
#define hi(x)  (*(&x+1))  //data held at addr of x + 1
#define lo(x)  (*(&x))    //data held at addr of x

#org 0x7FE1, 0x7FFF  //puts 2.00 3.01 1 (0200030101) at 0x7FF0
const char revision[] = {FIRM_MAJOR,FIRM_MINOR,HARD_MAJOR,HARD_MINOR,PROD_ID};
#org default
//===========LOADER_SIZE============//
#define LOADER_ADDR 0x20
#define LOADER_SIZE 0x200
#define LOADER_END  LOADER_ADDR + LOADER_SIZE
#build(reset=LOADER_END+2, interrupt=LOADER_END+8)
//=======================//
//---------------- GLOBAL VAR --------------------
int8 RX_BUF[64];

//===================== PrgmPIC =========================
//Assumes RX_BUF[0] is defined as global. char RX_BUF[256]; or at least 64
#org LOADER_ADDR,LOADER_END
#use I2C(MASTER,SDA=PIN_C4,SCL=PIN_C3,FORCE_HW,FAST,RESTART_WDT)
void PrgmPIC(void){
  int32 address;
  int8 data,size;
  #define block 64
  char *ptr_char;
  disable_interrupts(GLOBAL);
  for(address=0;address<0x7D00;address+=block){ //read 8 bytes prgm from fram
    ptr_char=&RX_BUF[0];//&RX_BUF[0] is defined as global. char RX_BUF[256];
    for(size=block;size;ptr_char++,size--){
      if(size==block){
        i2c_start();
        i2c_write((0xA0|(int8)(address>>14))&0xFE);//&0xFE forces to write
        i2c_write(hi(address));
        i2c_write(lo(address));
        i2c_start();
        i2c_write((0xA0|(int8)(address>>14))|1);//|1 forces to read
      }
      if(size==1)
      {
        *ptr_char=i2c_read(0);//No ack on last read of chip
        i2c_stop();
      }
      else
      {
        *ptr_char=i2c_read(1);//The ack will put next data on bus
      }
    }
    write_program_memory(address,&RX_BUF[0],64);//write=8,erase=64
  }
  reset_cpu();
}
#org default

//---------------- MAIN --------------------
void main(void){
  while(1){
    if(!input(PIN_A0)){
      PrgmPIC();
    }
  }
}



And the listing
Code:

CCS PCH C Compiler, Version 3.242, 30995               13-Feb-06 16:55

               Filename: C:\ccs\Projects\3200I\update_firmware\t_197.lst

               ROM used: 588 bytes (2%)
                         Largest free fragment is 32082
               RAM used: 69 (4%) at main() level
                         81 (5%) worst case
               Stack:    3 worst case (2 in main + 1 for interrupts)

*
0222:  GOTO   0264
.................... //=======================//
.................... #define  FIRM_MAJOR  2
.................... #define  FIRM_MINOR  00
.................... #define  HARD_MAJOR  3
.................... #define  HARD_MINOR  01
.................... #define  PROD_ID     1
.................... //=======================//
.................... #include <18f452.h>
.................... //////// Standard Header file for the PIC18F452 device ////////////////
.................... #device PIC18F452
*
0244:  MOVF   FF2,W
0246:  MOVWF  03
0248:  BCF    FF2.7
024A:  BSF    FA6.7
024C:  BSF    FA6.2
024E:  MOVLB  F
0250:  MOVLW  55
0252:  MOVWF  FA7
0254:  MOVLW  AA
0256:  MOVWF  FA7
0258:  BSF    FA6.1
025A:  NOP   
025C:  MOVF   03,W
025E:  IORWF  FF2,F
0260:  MOVLB  0
0262:  RETLW  00
*
7FE0:  CLRF   FF7
7FE2:  ADDLW  F0
7FE4:  MOVWF  FF6
7FE6:  MOVLW  7F
7FE8:  ADDWFC FF7,F
7FEA:  TBLRD*+
7FEC:  MOVF   FF5,W
7FEE:  RETURN 0
7FF0:  DATA 02,00
7FF2:  DATA 03,01
7FF4:  DATA 01,00
7FF6:  RETLW  00
.................... //#nolist
.................... #list //2/13/2006 4:38PM tjr for a full list
.................... //////// Program memory: 16384x16  Data RAM: 1536  Stack: 31
.................... //////// I/O: 34   Analog Pins: 8
.................... //////// Data EEPROM: 256
.................... //////// C Scratch area: 00   ID Location: 2000
.................... //////// Fuses: LP,XT,HS,RC,EC,EC_IO,H4,RC_IO,PROTECT,NOPROTECT,OSCSEN
.................... //////// Fuses: NOOSCSEN,NOBROWNOUT,BROWNOUT,WDT1,WDT2,WDT4,WDT8,WDT16,WDT32
.................... //////// Fuses: WDT64,WDT128,WDT,NOWDT,BORV20,BORV27,BORV42,BORV45,PUT,NOPUT
.................... //////// Fuses: CCP2C1,CCP2B3,NOSTVREN,STVREN,NODEBUG,DEBUG,NOLVP,LVP,WRT
.................... //////// Fuses: NOWRT,NOWRTD,WRTD,NOWRTB,WRTB,WRTC,NOWRTC,CPD,NOCPD,CPB
.................... //////// Fuses: NOCPB,EBTR,NOEBTR,EBTRB,NOEBTRB
.................... ////////
.................... ////////////////////////////////////////////////////////////////// I/O
.................... // Discrete I/O Functions: SET_TRIS_x(), OUTPUT_x(), INPUT_x(),
.................... //                         PORT_B_PULLUPS(), INPUT(),
.................... //                         OUTPUT_LOW(), OUTPUT_HIGH(),
.................... //                         OUTPUT_FLOAT(), OUTPUT_BIT()
.................... // Constants used to identify pins in the above are:
.................... 
.................... #define PIN_A0  31744
.................... #define PIN_A1  31745
.................... #define PIN_A2  31746
.................... #define PIN_A3  31747
.................... #define PIN_A4  31748
.................... #define PIN_A5  31749
.................... #define PIN_A6  31750
.................... 
.................... #define PIN_B0  31752
.................... #define PIN_B1  31753
.................... #define PIN_B2  31754
.................... #define PIN_B3  31755
.................... #define PIN_B4  31756
.................... #define PIN_B5  31757
.................... #define PIN_B6  31758
.................... #define PIN_B7  31759
.................... 
.................... #define PIN_C0  31760
.................... #define PIN_C1  31761
.................... #define PIN_C2  31762
.................... #define PIN_C3  31763
.................... #define PIN_C4  31764
.................... #define PIN_C5  31765
.................... #define PIN_C6  31766
.................... #define PIN_C7  31767
.................... 
.................... #define PIN_D0  31768
.................... #define PIN_D1  31769
.................... #define PIN_D2  31770
.................... #define PIN_D3  31771
.................... #define PIN_D4  31772
.................... #define PIN_D5  31773
.................... #define PIN_D6  31774
.................... #define PIN_D7  31775
.................... 
.................... #define PIN_E0  31776
.................... #define PIN_E1  31777
.................... #define PIN_E2  31778
.................... 
.................... ////////////////////////////////////////////////////////////////// Useful defines
.................... #define FALSE 0
.................... #define TRUE 1
.................... 
.................... #define BYTE int
.................... #define BOOLEAN short int
.................... 
.................... #define getc getch
.................... #define fgetc getch
.................... #define getchar getch
.................... #define putc putchar
.................... #define fputc putchar
.................... #define fgets gets
.................... #define fputs puts
.................... 
.................... ////////////////////////////////////////////////////////////////// Control
.................... // Control Functions:  RESET_CPU(), SLEEP(), RESTART_CAUSE()
.................... // Constants returned from RESTART_CAUSE() are:
.................... 
.................... #define WDT_TIMEOUT       7
.................... #define MCLR_FROM_SLEEP  11
.................... #define MCLR_FROM_RUN    15
.................... #define NORMAL_POWER_UP  12
.................... #define BROWNOUT_RESTART 14
.................... #define WDT_FROM_SLEEP   3
.................... #define RESET_INSTRUCTION 0
.................... 
.................... ////////////////////////////////////////////////////////////////// Timer 0
.................... // Timer 0 (AKA RTCC)Functions: SETUP_COUNTERS() or SETUP_TIMER_0(),
.................... //                              SET_TIMER0() or SET_RTCC(),
.................... //                              GET_TIMER0() or GET_RTCC()
.................... // Constants used for SETUP_TIMER_0() are:
.................... #define RTCC_INTERNAL   0
.................... #define RTCC_EXT_L_TO_H 32
.................... #define RTCC_EXT_H_TO_L 48
.................... 
.................... #define RTCC_DIV_1      8
.................... #define RTCC_DIV_2      0
.................... #define RTCC_DIV_4      1
.................... #define RTCC_DIV_8      2
.................... #define RTCC_DIV_16     3
.................... #define RTCC_DIV_32     4
.................... #define RTCC_DIV_64     5
.................... #define RTCC_DIV_128    6
.................... #define RTCC_DIV_256    7
.................... 
.................... #define RTCC_OFF        0x80
.................... 
.................... #define RTCC_8_BIT      0x40
.................... 
.................... // Constants used for SETUP_COUNTERS() are the above
.................... // constants for the 1st param and the following for
.................... // the 2nd param:
.................... 
.................... ////////////////////////////////////////////////////////////////// WDT
.................... // Watch Dog Timer Functions: SETUP_WDT() or SETUP_COUNTERS() (see above)
.................... //                            RESTART_WDT()
.................... //
.................... #define WDT_ON      0x100
.................... #define WDT_OFF     0
.................... 
.................... ////////////////////////////////////////////////////////////////// Timer 1
.................... // Timer 1 Functions: SETUP_TIMER_1, GET_TIMER1, SET_TIMER1
.................... // Constants used for SETUP_TIMER_1() are:
.................... //      (or (via |) together constants from each group)
.................... #define T1_DISABLED         0
.................... #define T1_INTERNAL         0x85
.................... #define T1_EXTERNAL         0x87
.................... #define T1_EXTERNAL_SYNC    0x83
.................... 
.................... #define T1_CLK_OUT          8
.................... 
.................... #define T1_DIV_BY_1         0
.................... #define T1_DIV_BY_2         0x10
.................... #define T1_DIV_BY_4         0x20
.................... #define T1_DIV_BY_8         0x30
.................... 
.................... ////////////////////////////////////////////////////////////////// Timer 2
.................... // Timer 2 Functions: SETUP_TIMER_2, GET_TIMER2, SET_TIMER2
.................... // Constants used for SETUP_TIMER_2() are:
.................... #define T2_DISABLED         0
.................... #define T2_DIV_BY_1         4
.................... #define T2_DIV_BY_4         5
.................... #define T2_DIV_BY_16        6
.................... 
.................... ////////////////////////////////////////////////////////////////// Timer 3
.................... // Timer 3 Functions: SETUP_TIMER_3, GET_TIMER3, SET_TIMER3
.................... // Constants used for SETUP_TIMER_3() are:
.................... //      (or (via |) together constants from each group)
.................... #define T3_DISABLED         0
.................... #define T3_INTERNAL         0x85
.................... #define T3_EXTERNAL         0x87
.................... #define T3_EXTERNAL_SYNC    0x83
.................... 
.................... #define T3_DIV_BY_1         0
.................... #define T3_DIV_BY_2         0x10
.................... #define T3_DIV_BY_4         0x20
.................... #define T3_DIV_BY_8         0x30
.................... 
.................... ////////////////////////////////////////////////////////////////// CCP
.................... // CCP Functions: SETUP_CCPx, SET_PWMx_DUTY
.................... // CCP Variables: CCP_x, CCP_x_LOW, CCP_x_HIGH
.................... // Constants used for SETUP_CCPx() are:
.................... #define CCP_OFF                         0
.................... #define CCP_CAPTURE_FE                  4
.................... #define CCP_CAPTURE_RE                  5
.................... #define CCP_CAPTURE_DIV_4               6
.................... #define CCP_CAPTURE_DIV_16              7
.................... #define CCP_COMPARE_SET_ON_MATCH        8
.................... #define CCP_COMPARE_CLR_ON_MATCH        9
.................... #define CCP_COMPARE_INT                 0xA
.................... #define CCP_COMPARE_INT_AND_TOGGLE      0x2
.................... #define CCP_COMPARE_RESET_TIMER         0xB
.................... #define CCP_PWM                         0xC
.................... #define CCP_PWM_PLUS_1                  0x1c
.................... #define CCP_PWM_PLUS_2                  0x2c
.................... #define CCP_PWM_PLUS_3                  0x3c
.................... #define CCP_USE_TIMER3                  0x100
.................... long CCP_1;
.................... #byte   CCP_1    =                      0xfbe
.................... #byte   CCP_1_LOW=                      0xfbe
.................... #byte   CCP_1_HIGH=                     0xfbf
.................... long CCP_2;
.................... #byte   CCP_2    =                      0xfbb
.................... #byte   CCP_2_LOW=                      0xfbb
.................... #byte   CCP_2_HIGH=                     0xfbc
.................... ////////////////////////////////////////////////////////////////// PSP
.................... // PSP Functions: SETUP_PSP, PSP_INPUT_FULL(), PSP_OUTPUT_FULL(),
.................... //                PSP_OVERFLOW(), INPUT_D(), OUTPUT_D()
.................... // PSP Variables: PSP_DATA
.................... // Constants used in SETUP_PSP() are:
.................... #define PSP_ENABLED                     0x10
.................... #define PSP_DISABLED                    0
.................... 
.................... #byte  PSP_DATA=    0xF83
.................... 
.................... ////////////////////////////////////////////////////////////////// SPI
.................... // SPI Functions: SETUP_SPI, SPI_WRITE, SPI_READ, SPI_DATA_IN
.................... // Constants used in SETUP_SSP() are:
.................... #define SPI_MASTER       0x20
.................... #define SPI_SLAVE        0x24
.................... #define SPI_L_TO_H       0
.................... #define SPI_H_TO_L       0x10
.................... #define SPI_CLK_DIV_4    0
.................... #define SPI_CLK_DIV_16   1
.................... #define SPI_CLK_DIV_64   2
.................... #define SPI_CLK_T2       3
.................... #define SPI_SS_DISABLED  1
.................... 
.................... #define SPI_SAMPLE_AT_END 0x8000
.................... #define SPI_XMIT_L_TO_H  0x4000
.................... 
.................... ////////////////////////////////////////////////////////////////// UART
.................... // Constants used in setup_uart() are:
.................... // FALSE - Turn UART off
.................... // TRUE  - Turn UART on
.................... #define UART_ADDRESS           2
.................... #define UART_DATA              4
.................... ////////////////////////////////////////////////////////////////// VREF
.................... // Constants used in setup_low_volt_detect() are:
.................... //
.................... #define LVD_LVDIN   0x1F
.................... #define LVD_46 0x1E
.................... #define LVD_43 0x1D
.................... #define LVD_41 0x1C
.................... #define LVD_40 0x1B
.................... #define LVD_37 0x1A
.................... #define LVD_36 0x19
.................... #define LVD_34 0x18
.................... #define LVD_31 0x17
.................... #define LVD_29 0x16
.................... #define LVD_28 0x15
.................... #define LVD_26 0x14
.................... #define LVD_25 0x13
.................... #define LVD_23 0x12
.................... #define LVD_21 0x11
.................... 
.................... 
.................... 
.................... ////////////////////////////////////////////////////////////////// INTERNAL RC
.................... // Constants used in setup_oscillator() are:
.................... #define OSC_TIMER1  1
.................... #define OSC_NORMAL  0
.................... 
.................... 
.................... ////////////////////////////////////////////////////////////////// ADC
.................... // ADC Functions: SETUP_ADC(), SETUP_ADC_PORTS() (aka SETUP_PORT_A),
.................... //                SET_ADC_CHANNEL(), READ_ADC()
.................... // Constants used for SETUP_ADC() are:
.................... #define ADC_OFF                 0              // ADC Off
.................... #define ADC_CLOCK_DIV_2   0x10000
.................... #define ADC_CLOCK_DIV_4    0x4000
.................... #define ADC_CLOCK_DIV_8    0x0040
.................... #define ADC_CLOCK_DIV_16   0x4040
.................... #define ADC_CLOCK_DIV_32   0x0080
.................... #define ADC_CLOCK_DIV_64   0x4080
.................... #define ADC_CLOCK_INTERNAL 0x00c0              // Internal 2-6us
.................... 
.................... // Constants used in SETUP_ADC_PORTS() are:
.................... #define NO_ANALOGS                           7    // None
.................... #define ALL_ANALOG                           0    // A0 A1 A2 A3 A5 E0 E1 E2
.................... #define AN0_AN1_AN2_AN4_AN5_AN6_AN7_VSS_VREF 1    // A0 A1 A2 A5 E0 E1 E2 VRefh=A3
.................... #define AN0_AN1_AN2_AN3_AN4                  2    // A0 A1 A2 A3 A5
.................... #define AN0_AN1_AN2_AN4_VSS_VREF             3    // A0 A1 A2 A5 VRefh=A3
.................... #define AN0_AN1_AN3                          4    // A0 A1 A3
.................... #define AN0_AN1_VSS_VREF                     5    // A0 A1 VRefh=A3
.................... #define AN0_AN1_AN4_AN5_AN6_AN7_VREF_VREF 0x08    // A0 A1 A5 E0 E1 E2 VRefh=A3 VRefl=A2
.................... #define AN0_AN1_AN2_AN3_AN4_AN5           0x09    // A0 A1 A2 A3 A5 E0
.................... #define AN0_AN1_AN2_AN4_AN5_VSS_VREF      0x0A    // A0 A1 A2 A5 E0 VRefh=A3
.................... #define AN0_AN1_AN4_AN5_VREF_VREF         0x0B    // A0 A1 A5 E0 VRefh=A3 VRefl=A2
.................... #define AN0_AN1_AN4_VREF_VREF             0x0C    // A0 A1 A5 VRefh=A3 VRefl=A2
.................... #define AN0_AN1_VREF_VREF                 0x0D    // A0 A1 VRefh=A3 VRefl=A2
.................... #define AN0                               0x0E    // A0
.................... #define AN0_VREF_VREF                     0x0F    // A0 VRefh=A3 VRefl=A2
.................... #define ANALOG_RA3_REF         0x1         //!old only provided for compatibility
.................... #define A_ANALOG               0x2         //!old only provided for compatibility
.................... #define A_ANALOG_RA3_REF       0x3         //!old only provided for compatibility
.................... #define RA0_RA1_RA3_ANALOG     0x4         //!old only provided for compatibility
.................... #define RA0_RA1_ANALOG_RA3_REF 0x5         //!old only provided for compatibility
.................... #define ANALOG_RA3_RA2_REF              0x8   //!old only provided for compatibility
.................... #define ANALOG_NOT_RE1_RE2              0x9   //!old only provided for compatibility
.................... #define ANALOG_NOT_RE1_RE2_REF_RA3      0xA   //!old only provided for compatibility
.................... #define ANALOG_NOT_RE1_RE2_REF_RA3_RA2  0xB   //!old only provided for compatibility
.................... #define A_ANALOG_RA3_RA2_REF            0xC   //!old only provided for compatibility
.................... #define RA0_RA1_ANALOG_RA3_RA2_REF      0xD   //!old only provided for compatibility
.................... #define RA0_ANALOG                      0xE   //!old only provided for compatibility
.................... #define RA0_ANALOG_RA3_RA2_REF          0xF   //!old only provided for compatibility
.................... 
.................... 
.................... // Constants used in READ_ADC() are:
.................... #define ADC_START_AND_READ     7   // This is the default if nothing is specified
.................... #define ADC_START_ONLY         1
.................... #define ADC_READ_ONLY          6
.................... 
.................... 
.................... 
.................... ////////////////////////////////////////////////////////////////// INT
.................... // Interrupt Functions: ENABLE_INTERRUPTS(), DISABLE_INTERRUPTS(),
.................... //                      EXT_INT_EDGE()
.................... //
.................... // Constants used in EXT_INT_EDGE() are:
.................... #define L_TO_H              0x40
.................... #define H_TO_L                 0
.................... // Constants used in ENABLE/DISABLE_INTERRUPTS() are:
.................... #define GLOBAL                    0xF2C0
.................... #define INT_RTCC                  0xF220
.................... #define INT_TIMER0                0xF220
.................... #define INT_TIMER1                0x9D01
.................... #define INT_TIMER2                0x9D02
.................... #define INT_TIMER3                0xA002
.................... #define INT_EXT                   0xF210
.................... #define INT_EXT1                  0xF008
.................... #define INT_EXT2                  0xF010
.................... #define INT_RB                    0xF208
.................... #define INT_PSP                   0x9D80
.................... #define INT_AD                    0x9D40
.................... #define INT_RDA                   0x9D20
.................... #define INT_TBE                   0x9D10
.................... #define INT_SSP                   0x9D08
.................... #define INT_CCP1                  0x9D04
.................... #define INT_CCP2                  0xA001
.................... #define INT_BUSCOL                0xA008
.................... #define INT_LOWVOLT               0xA004
.................... #define INT_EEPROM                0xA010
.................... 
.................... #list
.................... 
.................... #define hi(x)  (*(&x+1))  //data held at addr of x + 1
.................... #define lo(x)  (*(&x))    //data held at addr of x
.................... 
.................... #org 0x7FE1, 0x7FFF  //puts 2.00 3.01 1 (0200030101) at 0x7FF0
.................... const char revision[] = {FIRM_MAJOR,FIRM_MINOR,HARD_MAJOR,HARD_MINOR,PROD_ID};
.................... #org default
.................... //===========LOADER_SIZE============//
.................... #define LOADER_ADDR 0x20
.................... #define LOADER_SIZE 0x200
.................... #define LOADER_END  LOADER_ADDR + LOADER_SIZE
.................... #build(reset=LOADER_END+2, interrupt=LOADER_END+8)
.................... //=======================//
.................... //---------------- GLOBAL VAR --------------------
.................... int8 RX_BUF[64];
.................... 
.................... //===================== PrgmPIC =========================
.................... //Assumes RX_BUF[0] is defined as global. char RX_BUF[256]; or at least 64
.................... //Notice how we reprogram to 0x7D00 and this function is stored after
.................... //that at address 0x7D18.  This is as high as we could go.
.................... #org LOADER_ADDR,LOADER_END
.................... #use I2C(MASTER,SDA=PIN_C4,SCL=PIN_C3,FORCE_HW,FAST,RESTART_WDT)
*
0000:  BCF    FC6.7
0002:  BCF    F9E.3
0004:  MOVFF  50,FC9
0008:  MOVLW  02
000A:  BTFSC  FC6.7
000C:  BRA    0018
000E:  BTFSS  F9E.3
0010:  BRA    000E
0012:  MOVLW  00
0014:  BTFSC  FC5.6
0016:  MOVLW  01
0018:  MOVWF  01
001A:  RETLW  00
*
022A:  BSF    FC5.3
022C:  BTFSC  FC5.3
022E:  BRA    022C
0230:  BTFSC  00.0
0232:  BCF    FC5.5
0234:  BTFSS  00.0
0236:  BSF    FC5.5
0238:  BSF    FC5.4
023A:  BTFSC  FC5.4
023C:  BRA    023A
023E:  MOVFF  FC9,01
0242:  RETLW  00
.................... void PrgmPIC(void){
....................   int32 address;
....................   int8 data,size;
....................   #define block 64
....................   char *ptr_char;
....................   disable_interrupts(GLOBAL);
*
0020:  BCF    FF2.6
0022:  BCF    FF2.7
0024:  BTFSC  FF2.7
0026:  BRA    0022
....................   for(address=0;address<0x7D00;address+=block){ //read 8 bytes prgm from fram
0028:  CLRF   48
002A:  CLRF   47
002C:  CLRF   46
002E:  CLRF   45
0030:  MOVF   48,F
0032:  BTFSS  FD8.2
0034:  BRA    01CC
0036:  MOVF   47,F
0038:  BTFSS  FD8.2
003A:  BRA    01CC
003C:  MOVF   46,W
003E:  SUBLW  7C
0040:  BTFSS  FD8.0
0042:  BRA    01CC
....................     ptr_char=&RX_BUF[0];//&RX_BUF[0] is defined as global. char RX_BUF[256];
0044:  CLRF   4C
0046:  MOVLW  05
0048:  MOVWF  4B
....................     for(size=block;size;ptr_char++,size--){
004A:  MOVLW  40
004C:  MOVWF  4A
004E:  MOVF   4A,F
0050:  BTFSC  FD8.2
0052:  BRA    014C
....................       if(size==block){
0054:  MOVF   4A,W
0056:  SUBLW  40
0058:  BNZ   0106
....................         i2c_start();
005A:  BSF    FC5.0
005C:  BTFSC  FC5.0
005E:  BRA    005C
....................         i2c_write((0xA0|(int8)(address>>14))&0xFE);//&0xFE forces to write
0060:  CLRF   03
0062:  RRCF   48,W
0064:  MOVWF  02
0066:  RRCF   47,W
0068:  MOVWF  01
006A:  RRCF   46,W
006C:  MOVWF  00
006E:  RRCF   02,F
0070:  RRCF   01,F
0072:  RRCF   00,F
0074:  RRCF   02,F
0076:  RRCF   01,F
0078:  RRCF   00,F
007A:  RRCF   02,F
007C:  RRCF   01,F
007E:  RRCF   00,F
0080:  RRCF   02,F
0082:  RRCF   01,F
0084:  RRCF   00,F
0086:  RRCF   02,F
0088:  RRCF   01,F
008A:  RRCF   00,F
008C:  MOVLW  03
008E:  ANDWF  02,F
0090:  MOVF   00,W
0092:  IORLW  A0
0094:  ANDLW  FE
0096:  MOVWF  4F
0098:  MOVWF  50
009A:  RCALL  0000
....................         i2c_write(hi(address));
009C:  CLRF   03
009E:  MOVLW  46
00A0:  MOVWF  FE9
00A2:  MOVFF  03,FEA
00A6:  MOVFF  FEF,4D
00AA:  MOVFF  4D,50
00AE:  RCALL  0000
....................         i2c_write(lo(address));
00B0:  CLRF   03
00B2:  MOVLW  45
00B4:  MOVWF  FE9
00B6:  MOVFF  03,FEA
00BA:  MOVFF  FEF,4D
00BE:  MOVFF  4D,50
00C2:  RCALL  0000
....................         i2c_start();
00C4:  BSF    FC5.1
00C6:  BTFSC  FC5.1
00C8:  BRA    00C6
....................         i2c_write((0xA0|(int8)(address>>14))|1);//|1 forces to read
00CA:  CLRF   03
00CC:  RRCF   48,W
00CE:  MOVWF  02
00D0:  RRCF   47,W
00D2:  MOVWF  01
00D4:  RRCF   46,W
00D6:  MOVWF  00
00D8:  RRCF   02,F
00DA:  RRCF   01,F
00DC:  RRCF   00,F
00DE:  RRCF   02,F
00E0:  RRCF   01,F
00E2:  RRCF   00,F
00E4:  RRCF   02,F
00E6:  RRCF   01,F
00E8:  RRCF   00,F
00EA:  RRCF   02,F
00EC:  RRCF   01,F
00EE:  RRCF   00,F
00F0:  RRCF   02,F
00F2:  RRCF   01,F
00F4:  RRCF   00,F
00F6:  MOVLW  03
00F8:  ANDWF  02,F
00FA:  MOVF   00,W
00FC:  IORLW  A0
00FE:  IORLW  01
0100:  MOVWF  4F
0102:  MOVWF  50
0104:  RCALL  0000
....................       }
....................       if(size==1)
0106:  DECFSZ 4A,W
0108:  BRA    0126
....................       {
....................         *ptr_char=i2c_read(0);//No ack on last read of chip
010A:  MOVFF  4C,03
010E:  MOVFF  4B,FE9
0112:  MOVFF  4C,FEA
0116:  CLRF   00
0118:  RCALL  022A
011A:  MOVFF  01,FEF
....................         i2c_stop();
011E:  BSF    FC5.2
0120:  BTFSC  FC5.2
0122:  BRA    0120
....................       }
....................       else
0124:  BRA    013C
....................       {
....................         *ptr_char=i2c_read(1);//The ack will put next data on bus
0126:  MOVFF  4C,03
012A:  MOVFF  4B,FE9
012E:  MOVFF  4C,FEA
0132:  MOVLW  01
0134:  MOVWF  00
0136:  RCALL  022A
0138:  MOVFF  01,FEF
....................       }
....................     }
013C:  MOVFF  4C,03
0140:  MOVF   4B,W
0142:  INCF   4B,F
0144:  BTFSC  FD8.2
0146:  INCF   4C,F
0148:  DECF   4A,F
014A:  BRA    004E
....................     write_program_memory(address,&RX_BUF[0],64);//write=8,erase=64
014C:  BSF    FD0.6
014E:  BCF    FA6.6
0150:  MOVFF  47,FF8
0154:  MOVFF  46,FF7
0158:  MOVFF  45,FF6
015C:  MOVF   FF6,W
015E:  ANDLW  07
0160:  MOVWF  00
0162:  MOVLW  F8
0164:  ANDWF  FF6,F
0166:  TBLRD*-
0168:  CLRF   FEA
016A:  MOVLW  05
016C:  MOVWF  FE9
016E:  MOVLW  40
0170:  MOVWF  01
0172:  MOVWF  02
0174:  MOVLW  08
0176:  TSTFSZ 00
0178:  ADDWF  02,F
017A:  MOVF   02,W
017C:  ADDLW  07
017E:  ANDLW  F8
0180:  MOVWF  02
0182:  MOVF   FF6,W
0184:  TSTFSZ 00
0186:  BRA    0196
0188:  ADDLW  01
018A:  ANDLW  3F
018C:  BNZ   0196
018E:  BSF    FA6.4
0190:  TBLRD*+
0192:  RCALL  0244
0194:  TBLRD*-
0196:  TSTFSZ 00
0198:  BRA    01A8
019A:  MOVFF  FEE,FF5
019E:  MOVF   01,F
01A0:  BZ    01AA
01A2:  TBLWT+*
01A4:  DECF   01,F
01A6:  BRA    01AE
01A8:  DECF   00,F
01AA:  TBLRD+*
01AC:  TBLWT*
01AE:  MOVLW  07
01B0:  ANDWF  FF6,W
01B2:  XORLW  07
01B4:  BTFSC  FD8.2
01B6:  RCALL  0244
01B8:  DECFSZ 02,F
01BA:  BRA    0182
01BC:  CLRF   FF8
....................   }
01BE:  MOVLW  40
01C0:  ADDWF  45,F
01C2:  MOVLW  00
01C4:  ADDWFC 46,F
01C6:  ADDWFC 47,F
01C8:  ADDWFC 48,F
01CA:  BRA    0030
....................   reset_cpu();
01CC:  RESET
.................... }
01CE:  RETLW  00
.................... #org default
.................... 
.................... //---------------- MAIN --------------------
.................... void main(void){
*
0264:  CLRF   FF8
0266:  BCF    FD0.7
0268:  CLRF   FEA
026A:  CLRF   FE9
026C:  BSF    F94.3
026E:  BSF    F94.4
0270:  CLRF   FC8
0272:  MOVLW  28
0274:  MOVWF  FC6
0276:  BCF    FC7.7
0278:  BCF    FC7.6
027A:  BSF    FC1.0
027C:  BSF    FC1.1
027E:  BSF    FC1.2
0280:  BCF    FC1.3
....................   while(1){
....................     if(!input(PIN_A0)){
0282:  BSF    F92.0
0284:  BTFSC  F80.0
0286:  BRA    028A
....................       PrgmPIC();
0288:  RCALL  0020
....................     }
....................   }
028A:  BRA    0282
.................... }
.................... 
.................... 
028C:  SLEEP

PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Feb 14, 2006 2:29 am     Reply with quote

Quote:
What does the moved IRQ/RESET look like in a list file?
I want to verify that my #build statement did what I want.


The line in bold is the relocated reset code. It just jumps to main(),
which is at address 0x0264.
Quote:

*
0222: GOTO 0264
.................... //=======================//
.................... #define FIRM_MAJOR 2
.................... #define FIRM_MINOR 00
.................... #define HARD_MAJOR 3
.................... #define HARD_MINOR 01
.................... #define PROD_ID 1


You won't see anything for the relocated interrupt dispatcher code
because you don't have any #INT_XXX statement(s) in your program.


Also, is it your intention that the CCS i2c library code be #org'ed
in the LOADER_ADDR segment ? If so, you need to add the "Default"
directive at the end of the #org statement. You'll also have to
increase LOADER_SIZE to 0x220, because it needs a little bit more room.
treitmey



Joined: 23 Jan 2004
Posts: 1094
Location: Appleton,WI USA

View user's profile Send private message Visit poster's website

PostPosted: Tue Feb 14, 2006 8:42 am     Reply with quote

Exactly what I was going for.

And yes, I cut my program to nothing and didn't make the connection that no IRQ means no IRQ redirector.

AND yes I do want the I2C functions.. but if they go pass the protected 512 boot area will I get in trouble?
or
I just have to keep in mind not to program that space. Right?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Feb 14, 2006 2:16 pm     Reply with quote

Do you want the i2c library code to be entirely inside the #org'ed area ?
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group