Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Configuration bit conflict for PIC18f4520 chip

Status
Not open for further replies.

dhanraj_kmr

Advanced Member level 4
Full Member level 1
Joined
Sep 23, 2008
Messages
117
Helped
3
Reputation
6
Reaction score
3
Trophy points
1,298
Location
Chennai, INDIA
Visit site
Activity points
2,174
Hi All,
I have a simple board with 4MZ and a complex board with 10 MZ crystal. I have two micros, one is PIC16f877a and another one is PIC18f4520. PIC16F micro works on both boards without any problem while PIC18F is not.

There is a two major chance for this failure. One is hardware and another one is software. I was about to ignore the hardware part since one micro is working fine.
So to verify that PIC18f is correctly programmed and functioning i want to verify few options that my configurations and start up code is correct. Parallel to that can anyone share the configuration and a startup code for blinking a LED?

I dont have much experience with handling PIC controller myself is past. This is my first project i am trying with PIC.

Here i have attached the main.c file i am using.

Code:
/*  Name       : main.c
 *  Purpose    : Main file.
 *  Author     : S.Dhanaraj
 *  Date       : 23-11-13
 *  Copyright  : All rights reserved for Silicon Micro Smith
 *  Revision   : Ver 1.0
 */
#include<stdio.h>
#include<htc.h>
#include "Include.h"
#include "LCD.h"
#include "Serial.h"
#include "IO.h"

//Chip Settings
 //__CONFIG(1H, RCIO6 & FCMDIS & IESODIS);    // 1H
// __CONFIG(2,  WDTDIS & PWRTEN & BORDIS ); // 2H 2L

#pragma config CONFIG1H IESO = OFF, OSC = HS, FCMEN = OFF
#pragma config CONFIG2 WDT = OFF, PWRT = ON, BOREN = OFF

char _scanf_buf_[10];
#define inbuf _scanf_buf_

unsigned char g_welcome_stratgy_comp;
unsigned char g_update_LCD;
// Main Function
void main(void)
{
	unsigned int i,j;
	// Init_Keypad();
	Timer0_Init();
	TRISA = 0x00;
	TRISB0 = 0;
	TRISC0 = 0;
	TRISD0 = 0;
	TRISE0 = 0;
	OSCCON = 0b00000000;
	LATA0 = 1;
	PORTBbits.RB0 = 1;
	PORTCbits.RC0 = 1;
	PORTDbits.RD0 = 1;
	PORTEbits.RE0 = 1;
	InitLCD();        // Initialize the LCD
	WriteDataToLCD('b');
	// Lcd4_Write_String("Welcome to BLACK CAT"); // Welcome String
	// GotoYXPositionOnLCD(LCD_LINE2, 0);	  // Goto Line2 offset 38
	// Lcd4_Write_String("GSM 431234"); // Write String
	while(1)
	{
		LATA = 0xFF;
		for ( i = 0; i < 20; i++)
 		{	__delay_ms(50);}
		// Keypad_handler();
		LATA = 0;
		for ( i = 0; i < 20; i++)
 		{	__delay_ms(50);}
	}
}
char getche(){return 0;}
void putch(char c){}

Code:
Build C:\Development\GSM_Burgular_Alarm\Burgular_Alarm for device 18F4520
Using driver C:\Program Files (x86)\HI-TECH Software\PICC-18\9.80\bin\picc18.exe

Make: The target "C:\Development\GSM_Burgular_Alarm\Main.p1" is out of date.
Executing: "C:\Program Files (x86)\HI-TECH Software\PICC-18\9.80\bin\picc18.exe" --pass1 "C:\Development\GSM_Burgular_Alarm\Source\Main.c" -q --chip=18F4520 -P --runtime=default --opt=default -D__DEBUG=1 -g --asmlist "--errformat=Error   [%n] %f; %l.%c %s" "--msgformat=Advisory[%n] %s" "--warnformat=Warning [%n] %f; %l.%c %s" 
Make: The target "C:\Development\GSM_Burgular_Alarm\Timer.p1" is up to date.
Make: The target "C:\Development\GSM_Burgular_Alarm\LCD.p1" is up to date.
Make: The target "C:\Development\GSM_Burgular_Alarm\IO.p1" is up to date.
Make: The target "C:\Development\GSM_Burgular_Alarm\Serial.p1" is up to date.
Executing: "C:\Program Files (x86)\HI-TECH Software\PICC-18\9.80\bin\picc18.exe" -oBurgular_Alarm.cof -mBurgular_Alarm.map --summary=default --output=default Main.p1 Timer.p1 LCD.p1 IO.p1 Serial.p1 --chip=18F4520 -P --runtime=default --opt=default -D__DEBUG=1 -g --asmlist "--errformat=Error   [%n] %f; %l.%c %s" "--msgformat=Advisory[%n] %s" "--warnformat=Warning [%n] %f; %l.%c %s" 
HI-TECH C Compiler for PIC18 MCUs (PRO Mode)  V9.80
Copyright (C) 2011 Microchip Technology Inc.
Serial number: HCPIC18P-XXXXXX (PRO)
Advisory[1233] Employing 18F4520 errata work-arounds:
Advisory[1234]  * Corrupted fast interrupt shadow registers
Warning [1413] C:\Program Files (x86)\HI-TECH Software\PICC-18\9.80\sources\doscan.c; 34. "ROM" is positioned at address 0x0 and has had its address taken; pointer comparisons may be invalid
Warning [1090] C:\Development\GSM_Burgular_Alarm\Source\Serial.c; 21. variable "_user_msg" is not used
Warning [1090] C:\Development\GSM_Burgular_Alarm\Source\Serial.c; 14. variable "_fl_count" is not used
Warning [1090] C:\Development\GSM_Burgular_Alarm\Source\Serial.c; 13. variable "_g_gsm_cmd_trackr" is not used
Warning [1090] C:\Development\GSM_Burgular_Alarm\Source\Main.c; 26. variable "_g_update_LCD" is not used
Warning [1090] C:\Development\GSM_Burgular_Alarm\Source\Main.c; 25. variable "_g_welcome_stratgy_comp" is not used
Warning [1090] C:\Development\GSM_Burgular_Alarm\Source\LCD.c; 10. variable "_guc_update_lcd_line_no" is not used
Warning [1090] C:\Development\GSM_Burgular_Alarm\Source\IO.c; 22. variable "_key" is not used
Warning [1090] C:\Development\GSM_Burgular_Alarm\Source\IO.c; 23. variable "_key_press" is not used
Warning [1090] C:\Development\GSM_Burgular_Alarm\Source\IO.c; 24. variable "_key_press_1" is not used
Warning [1090] C:\Development\GSM_Burgular_Alarm\Source\Timer.c; 37. variable "_over_run_error" is not used
Warning [1090] C:\Development\GSM_Burgular_Alarm\Source\Serial.h; 20. variable "_sys_new_sms_recvd" is not used
Warning [1090] C:\Development\GSM_Burgular_Alarm\Source\IO.c; 26. variable "_system_activated" is not used
Warning [1090] C:\Development\GSM_Burgular_Alarm\Source\IO.c; 25. variable "_system_active" is not used
Warning [1090] C:\Development\GSM_Burgular_Alarm\Source\Main.c; 30. variable "_j" is not used

Memory Summary:
    Program space        used   50Dh (  1293) of  8000h bytes   (  3.9%)
    Data space           used   161h (   353) of   600h bytes   ( 23.0%)
    Configuration bits   used     2h (     2) of     7h words   ( 28.6%)
    EEPROM space         used     0h (     0) of   100h bytes   (  0.0%)
    ID Location space    used     0h (     0) of     8h nibbles (  0.0%)

Loaded C:\Development\GSM_Burgular_Alarm\Burgular_Alarm.cof.

********** Build successful! **********

A quick reply is appreciated. I am holding the board to get going to deliver the project this week end. :(
 
Last edited:

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top