mP PRO V5.0, optimisation level 0 and PIC16F689 on custom PCB. Timer 1 is used for a 100ms interupt and WDT is OFF.
The program is fine while it fits into Page 0 memory. If I add the procedure 'Log_Events_Uart' to the code, I can see from the List file that the procedures are in Page 0 and Main is now in Page 1 and the program no longer runs.
The program does not get to 'LEDs_All_ON;' turning LEDs on which is at the start of the program after the initialisation.
Code: Select all
//** Routines locations **
//ADDRESS SIZE PROCEDURE
//----------------------------------------------
0x0004 [155] _Interrupt
0x009F [29] _Div_16x16_U
0x00BC [26] _Div_8x8_U
0x00D6 [47] _ByteToStr
0x0105 [15] _EEPROM_Read
0x0114 [10] _UART1_Write
0x011E [67] _WordToStr
0x0161 [43] _Mul_16x16_U
0x018C [24] _Event_to_ASCII
0x01A4 [7] _Delay_22us
0x01AB [23] _UART1_Write_Text
0x01C2 [17] _Event_Num_to_ASCII
0x01D3 [107] _Run_Hr_Min_ASCII
0x023E [10] _Uart_Output_CR_LF
0x0248 [35] _EEProm_Read_Event
0x026B [24] _Setup_to_ASCII
0x0283 [35] _EEPROM_Write
0x02A6 [10] _LEDs_OFF
0x02B0 [10] _EE_Write_Buzz_Mode
0x02BA [13] _Del_10ms
0x02C7 [45] _ADC_Read
0x02F4 [226] _Log_Events_Uart
0x03D6 [7] _Buzzers_OFF
0x03DD [57] _EEProm_Save_Event
0x0416 [10] _LEDs_All_ON
0x0420 [26] _Find_Start_Log
0x043A [27] _EEProm_Read_Word
0x0455 [10] _LEDs_All_OFF
0x045F [16] _UART1_Init
0x046F [7] _Buzzers_ON
0x0800 [1216] _main
Code: Select all
;Address Opcode ASM
0x0000 0x158A BSF PCLATH, 3
0x0001 0x2800 GOTO 2048
;LWA_TOW_10.mpas,751 :: Buzzers_ON;
0x083C 0x118A BCF PCLATH, 3
0x083D 0x246F CALL _Buzzers_ON
0x083E 0x158A BSF PCLATH, 3
Code: Select all
begin
// Initialise TIMER & WDT
WDTCON := %00001000; // ~5.12 secs DISabled
CLRWDT; // Watchdog 10ms min.
OSCCON := %01100001; // Internal OSC @4Mhz
OPTION_REG := %10001111;
INTCON := %00000000;
PIR1 := %00000000;
PIR2 := %00000000;
PIE1 := %00000000;
PIE2 := %00000000;
CM1CON0 := %10000111;
CM2CON0 := %00010111;
// CM2CON1
// 0.6V reference enabled for comparator 1
VRCON := %00010000; // bit 7 = C1VREN (Comparator 1 Vref select)
//
// RCON register contains details of reset source - do not initialise
//
ANSEL := %00000001; // ONLY RA0 is Analog
ANSELH := %00000000; // ONLY RA0 is Analog
//
// Initialise PORTA
//
PORTA := %00000000; // All low
TRISA := %11111111; // All inputs !!!A/D MUST be inputs
WPUA := %00110110; // Weak pullup enabled
//
// Initialise PORTB
//
PORTB := %00000000; // All low
TRISB := %00100000; // RB7,RB6 & RB4 OUTPUTS and RB5 (RXD) INPUT
//
// Initialise PORTC
//
PORTC := %00000000; // All low
TRISC := %11001000; // RC5,RC4,RC2,RC1 & RC0 OUTPUTS and RC7,RC6 & RC3 INPUTS
// Self test
LEDs_All_ON; <<<<<<<<<<<<<<
Buzzers_ON;