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.

PICKit2 and PIC18F4550 problem.

Status
Not open for further replies.

Windmiller

Member level 4
Joined
Mar 30, 2010
Messages
76
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Location
Sweden
Activity points
1,997
Hello

I've recently bought myself a PICKit2 to use instead of my previous Velleman VM134 and it seems to work fine, had no problems writing to any of my PIC16F. But when it comes to the PIC18F4550 my only of the P18F family that I own, then I'll have to write several times to make the darn thing programmed??

When I use the programming software that came with the PICKit2 it says something like "... configuration bits are not set.." every time I load any of my .hex files and that I should in MPLAB export the file with configuration bits. And If I do like it says, I will still get the same result in the PICKit2 software and it never works. If I use MPLAB all the way, then the programming works fine some of the times maby not on the first click but after I've been clicking the write button about five - ten times, then there might be a program on the chip.

Why do I have to program P18F sever times to get the code on the chip? :sad: Anyone else who got this problem with the P18F4550? I had almoust the same problem with my Velleman VM134, but here it was only writing a bit of the code to the chip.

Here is my code, that works some of the times:

Code:
	CONFIG WDT=OFF; disable watchdog timer
	CONFIG MCLRE = ON; MCLEAR Pin on
	CONFIG DEBUG = ON; Enable Debug Mode
	CONFIG LVP = OFF; Low-Voltage programming disabled (necessary for debugging)
	CONFIG FOSC = INTOSCIO_EC;Internal oscillator, port function on RA6

org 0; start code at 0

	CBLOCK 0
		Delay1:1
		Delay2:1
	ENDC

;Delay1 res 1 ;reserve 1 byte for the variable Delay1
;Delay2 res 1 ;reserve 1 byte for the variable Delay2

Start:
	CLRF PORTD
	CLRF TRISD
	CLRF Delay1
	CLRF Delay2

MainLoop:
	BTG PORTD,RD1 ;Toggle PORT D PIN 1 (20)
Delay:
	DECFSZ Delay1,1 ;Decrement Delay1 by 1, skip next instruction if Delay1 is 0
	GOTO Delay
	DECFSZ Delay2,1
	GOTO Delay
	GOTO MainLoop
	END

Regards

/ Morgan
 
Last edited:

Hi,

Don't have a 4550 chip to hand to replicate your problem - but I have prgrammed that chip without problems.

First - the code you posted is incomplete and does not build.

Add these to lines to the beginning of your code so MPlab knows what chip you are talking about.

Code:
	LIST P=18F4550		;directive to define processor
	#include <P18F4550.INC>	;processor specific variable definitions

Then check your mplab settings, goto Configure, Cofigure Bits and then see that the check box at the top left " configuaration bits set in code " is Ticked On.


Also when you specify your user Registers Delay1 it automatically assumes you want just one byte, so there is no need to use the :1 unless you want create more.
 

wp100, I've checked it all now. Still it does only write some of the times when I'm clicking the button which I think is wierd, because if something was wrong it shouldn't work at all, but it does.
I don't get it, why not everytime.

And I must add that it's not reporting that anything went wrong, there's just nothing there when I read back and I've even tried it in circuit. And every once in a while the code has been written to the chip.

Thanks

/ Morgan
 
Last edited:

Hi,

A few questions before I can answer -

First how have you got your 4550 chip connected to the Pk2, in its own socket, in a circuit board or on a breadboard ?

How long are the leads from the Pk2 output socket to the 4550 ?

You say you are pressing 'the button' - which ? - the red button on the Pk2 ?

How are you using the PK2, from the Programmer selection in Mplab or the stand alone PK2 V2.61 program.

Think knowing all that we can then see whats going wrong.
 

Hello

First how have you got your 4550 chip connected to the Pk2, in its own socket, in a circuit board or on a breadboard ?
It's on a breadboard.

How long are the leads from the Pk2 output socket to the 4550 ?
Just about 2 inches

You say you are pressing 'the button' - which ? - the red button on the Pk2 ?
The icon button in MPLAB writing section.

How are you using the PK2, from the Programmer selection in Mplab or the stand alone PK2 V2.61 program.
Both, I've tried both but it was only working some of the times in MPLAB and never in the stand alone.

/ Morgan
 

Hi,

Well that all sounds normal with good short leads to the 4550 chip.

Assume ? you have got nothing else connected to the 4550 other than the 5 leads from the PK2 ?

While it should program up on the breadboard they can cause occassional wierd problems due to bad connections - if you have a spare 40 pin dil socket I would be tempted to solder the leads from the pk2 to the dil socket pins so there is no chance of poor connections.

If it still fails to work then send over both the full assembler file you are using plus the built .hex file together with the Mplab Project files, .Mcp & .Mcw, so we can reproduce your situation fully.
Will pinch a 4550 and try programming it with your project code.
 

Hi,

Just another way to do things - this is a working program for the 4550.

Simply start the stand alone program pk2 v2.61 you should then be able to 'Import' this file then 'write' it to the chip in a few seconds.

Can you do that without problems ?
 

Attachments

  • test.rar
    6.8 KB · Views: 55

Hi,

Well that all sounds normal with good short leads to the 4550 chip.

Assume ? you have got nothing else connected to the 4550 other than the 5 leads from the PK2 ?

While it should program up on the breadboard they can cause occassional wierd problems due to bad connections - if you have a spare 40 pin dil socket I would be tempted to solder the leads from the pk2 to the dil socket pins so there is no chance of poor connections.

If it still fails to work then send over both the full assembler file you are using plus the built .hex file together with the Mplab Project files, .Mcp & .Mcw, so we can reproduce your situation fully.
Will pinch a 4550 and try programming it with your project code.

--------------------------------------------------------------------------------

Hi,

Just another way to do things - this is a working program for the 4550.

Simply start the stand alone program pk2 v2.61 you should then be able to 'Import' this file then 'write' it to the chip in a few seconds.

Can you do that without problems ?

Hello wp100

Sorry for my delay..
I'll try to use a dil socket instead when I come home from work today, and try using your attached file to see how that works then I'll be back for status report. Thank you, I believe it could be the problem with poor connections like you're saying.

/ Morgan
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top