I am facing an Issue with my PIC16f877A controller.
Its working in Debug mode with PicKit3 connected. But when I program the device for release mode, It gives no sign of working.
I am using MPLAB X with XC8 compiler
I have also connected 10k resistance between MCLR & VDD.
But still unable to resolve the issue.
Here is my main.c
#include "lib/System/config.h"
#include <xc.h>
#include <pic16f877a.h>
#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>
#include <stdbool.h>
#include "lib/UART/UARTLib.h"
#include "lib/I2C/I2CInterface.h"
#include "lib/I2C/idmodule.h"
// CONFIG
#pragma config FOSC = HS // Oscillator Selection bits (HS oscillator)
#pragma config WDTE = OFF // Watchdog Timer Enable bit (WDT disabled)
#pragma config PWRTE = OFF // Power-up Timer Enable bit (PWRT disabled)
#pragma config BOREN = ON // Brown-out Reset Enable bit (BOR enabled)
#pragma config LVP = OFF // Low-Voltage (Single-Supply) In-Circuit Serial Programming Enable bit (RB3 is digital I/O, HV on MCLR must be used for programming)
#pragma config CPD = OFF // Data EEPROM Memory Code Protection bit (Data EEPROM code protection off)
#pragma config WRT = OFF // Flash Program Memory Write Enable bits (Write protection off; all program memory may be written to by EECON control)
#pragma config CP = OFF // Flash Program Memory Code Protection bit (Code protection off)
static unsigned char data_Pkt_1[ MAX_BUF_SIZE ] = { NULL } ; // this is the buffer to accept incoming data
static unsigned char data_Pkt_2[ MAX_PKT_SIZE - MAX_BUF_SIZE ] = { NULL } ; // this is the buffer to accept incoming data
bool isDataPktReceived = false; // Flag to check the incoming Data Pkt
bool opStatus = WRITE;
char start_byte_addr[] = { 0x00, 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70 } ;
int maxBytes;
int Error = 0;
void receiveDataPkt(); // Function to receive Data from the PC
void transmitDataPkt(); // Function to transmit Data to the PC
void initIDComm(); // Function to Initialize ID Module Communication
void initBuffers(); // Initialize buffers with 0x00
void write_IDM( void ); // Function to Write ID Module
void read_IDM( void ); // Function to Read ID Module
bool validateData( void ); // Function to Validate Data
void createResponsePkt( bool opStatus ); // Function to Create Response Pkt
void createErrorPkt( void ); // Function to create Error Pkt
void interrupt ISR(void); // Interrupt Service Routine
/**********************************************************
Function : Main Function to Initialize the Operation
Parameter : None
Return : None
***********************************************************/
int main()
{
UARTInit();
idmInitI2C();
while (1)
{
while ( idmCheckConnection() ) {
if ( UART_GetRecvByteStatus() ) {
UART_SetRecvByteStatus(false); // Set Received flag False
receiveDataPkt(); // Receive Incoming data
}
if ( isDataPktReceived ) {
initIDComm();
isDataPktReceived = false;
}
}
}
return 0;
}
Please help me debugging the issue.