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 CCS Technical Support

PIC16F877 / verification error and invalid target id warning

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



Joined: 08 Jan 2013
Posts: 1

View user's profile Send private message

PIC16F877 / verification error and invalid target id warning
PostPosted: Wed Jan 09, 2013 5:34 am     Reply with quote

Hi, I am a university student and I am trying to go over some tutorials that were given to me by my supervisor and I am encountering some strange errors. It should be noted that this is my first time I am attempting PIC programming so all I know for sure is that I am following the tutorial step by step so it is pretty clear to me that something is happening that was not suppose to happen.
I am using MPLAB IDE v.7.4 and MPLAB ICD2 as the controller. My PIC16F877 is connected onto a PIC board which has a 20MHZ crystal a MAX232 and is connected onto the controller using an RJ11 connector. The PIC is powered by an external adapter of 5V/1A and there are also 8 LEDs onto all B pins.
The code I am using is a basic LED counting test:
Code:

//LED counting test.c
#include<16F877.H>
#pragma fuses HS,NOWDT,NOPROTECT,NOLVP
#pragma use delay(clock=20000000)

void main()
{
int value;

set_tris_b(0x00);

for(value=0; value<=60; value++)
  {
   OUTPUT_B(value);
   delay_ms(1000000);
  }

}

MPLAB gives me a warning and an error

Warning:
ICDWarn0020: Invalid target device id (expected=0x4D, read=0x1FF) Error:

ICD0161: Verify failed (MemType = Program, Address = 0x0, Expected Val = 0x3000, Val Read = 0x3FFF)
I’ve been looking around through the internet for similar topics but I can’t seem to figure out what’s wrong. What got me really confused is the fact that I bought a new PIC just to try and see if it got fried, and the first time I tried to program it, it worked. But the weird thing is after being programmed once it started the same problems as the previous PIC.
I also tried to set the memory locations as manual like some forums suggested but nothing changed.

The Self test numbers are:
Target Vdd: 5.04
Target Vpp:12.46
MPLAB ICD 2 Vpp:12.54

And additional info:
Oscillator HS
Watchdog timer OFF
Power Up timer OFF
Brown Out detect ON
Low Voltage Program DISABLED
Flash Program write ENABLED
Data EE read protect OFF
Code Protect OFF
Thanking you in advance,
Kyriacos Makris
Ttelmah



Joined: 11 Mar 2010
Posts: 19508

View user's profile Send private message

PostPosted: Wed Jan 09, 2013 7:21 am     Reply with quote

0x1FF, is normally that there is something wrong with the connections.

Triple check that the programming connector does match the recommended wiring pattern, especially ground connections etc.. Are you sure that the 5v/1A adapter is not going overvoltage when the you switch off, or starting overvoltage with no load, and then spiking the chip when you connect it.

Best Wishes
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