Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Newbie problems + Pic16pro40 not working

Status
Not open for further replies.

2camjohn

Member
I am a newbie to pics but have done high level programming for some years.

I have written a program in basic which uses interrupts. I am using this pic basic compiler

At the moment I only want to use the internal clock.

I try and program a 16f877 with my pic16pro40 but it wont write to it.

Pic16 pro (fully registered) for dos says "hardware fault"

Picall windows says "program error address=0 buffer = 118a device =3fff

WinPicProg says "Program verify failed at Program address 0x000, Programming Aborted!"

When i read the chip back it is blank.

I have been through a mountain of docs about this but cant figure out what to do.
Im not really sure what config word / fuses to use so if someone could suggest some I can eliminate that as a problem.
I dont know where to select LVP or HVP either or whether i can.
I have used two 9v batteries instead of the AC power supply incase it was that.


My programmer seems to be able to program a 12c508a but i cant set up the GPIO pins properly. There are no examples on how to do this in basic and I have programmed 3 of these OTP chips to do nothing :(

If someone could help me out here it would be appreciated.

Im now off to buy some more 12c508a chips since thats the only chip my programmer works with.

Thanks in advance for your time
 
There are a number of possible reasons, which basically boil down to:

1) A hardware fault on the programmer.

2) A fault in the software (unlikely, as you've tried various ones).

3) The programmer has been constructed incorrectly, did you build it from a kit or from scratch?.

4) The lead is faulty, or it's too long.

5) The power supply is too low, the use of two 9V batteries 'should' eliminate that possibility.

6) The computer port is faulty, or it's a computer which just doesn't like to work in this way.

This error usually means that the PIC isn't been swircthed to programming mode (by the 13V on MCLR), the most common cause is too little voltage. Using WinPicProg you can manually toggle the output pins from the hardware screen, by doing so you can check the voltages on the actual PIC pins to make sure they are correct.
 
Hi

Thanks for the reply.

I can eliminate possibilities 4 and 6 as i have tried two cables (a 2m printer extension and a 30cm zip drive one) and I have tried it on 3 different computers. (two with ecp(i think thats right) printer ports, one normal)

I have been all over the board with my multimeter and nothing is shorted and every solder joint seems good.


I am going to test the MCLR pin now I will post my findings.



What else do you suggest to eliminate the rest of the potential causes.

If it is certain that my programmer is the cause then I will buy another, I dont want to do this unless I am certain it is the problem.
My experience so far with pics is of throwing good money after bad :(
 
2camjohn said:
PS

Which of the options in the hardware screen of WinPicprog toggles the MCLR pin?

Thanks

Vpp and Vpp40, the P16PRO40 uses two different lines, for different sizes of chips (to enable the use of one ZIF socket for all chips).

You should measure the voltages from ground (the negative supply rail).
 
Ive just worked out I can program a 16f84a but only with WinPicProg. :lol:

The 16f84a has everything I need so Im happy now, although I am more confused now than ever :? .


I have some more questions:

My chip has 18 pins.
I am using 2 for output and 2 for input.1 is for the clock and 2 are used for power so what about the rest? What do i do with them?


Also I read that the outputs are sometimes inverted ie you connect them to +5 instead of 0v, is this the case for the 16f84a?

I read aswell you have to connect mclr to + using a resistor, why is this done and what is a good value for this resistor?

Lastly what do i need for my crystal, i have some 22nf caps but how do i arrange the circuit?

Thanks for your time and help.
 
2camjohn said:
Ive just worked out I can program a 16f84a but only with WinPicProg. :lol:

The 16f84a has everything I need so Im happy now, although I am more confused now than ever :? .

The P16PRO40 has two different Vpp connections, one for small chips (Vpp) and one for big chips (Vpp40) - it's possible your Vpp40 isn't working correctly.

I have some more questions:

My chip has 18 pins.
I am using 2 for output and 2 for input.1 is for the clock and 2 are used for power so what about the rest? What do i do with them?

Two are used for the clock, depending on which oscillator option you use, but in any case the two pins are not available as I/O. One pin is the MCLR (reset) pin, again, this isn't usable as I/O. Along with the supply pins, this uses up 5 pins, leaving 13 I/O pins. Any pins you don't use, just leave them disconnected - there are various different schemes to minimise power consumption, but just leaving them is generally fine.

A big advantage of the 16F628 over the 84 is that you can use 16 of the pins as I/O, using an internal clock oscillator and internal reset connection.

Also I read that the outputs are sometimes inverted ie you connect them to +5 instead of 0v, is this the case for the 16f84a?

I don't understand what you mean :lol: RA4 is an open-collector output, which means it can only sink current and not source it, this often gives a few problems.

I read aswell you have to connect mclr to + using a resistor, why is this done and what is a good value for this resistor?

I always just connect it straight to +ve, there's no need for a resistor, although adding a more complicated reset circuit can help with some problems (to do with poor HT supplies etc.).

Lastly what do i need for my crystal, i have some 22nf caps but how do i arrange the circuit?

Connect your crystal across the two oscillator pins, and connect 22pF (not nF) capacitors from either end of the crystal to ground.
 
I tried to make the chip work on a bread board but it does nothing.


pin 4 is connected to +5v with a 10k resistor
pin5 0v
pin6 is my interrupt input
pin7 is another input which is connected to 0v
pin 14 is connected to +5v
pins 15 and 16 are connected to each side of the crystal, which is connected on either side to ground by two 22nf caps
pin 17 is connected to the anode of an LED which is connected to gorund via a 1k resistor
pin 17 is connected to the anode of an LED which is connected to gorund via a 1k resistor


the outputs both read ov (one should be high one should be low)

the crystal reads 1.94v(pin 16) and 2.6v (pin 15)


I just noteiced when i shorted pin 16 to +5v both leds came on, thats not what is supposed to happen but its the most life ive had out of a pic chip yet.


If anyone can offer any help whatsoever i will be very grateful.

Cheers
John
 
Thanks Nigel you are a hero :D


If i buy a 628 i dont have to bother with a crystal?
What speed does it run at?




My capacitors are the wrong value and also polarised (they have an anode and cathode) is this going to cause the chip to completely not function?

Looks like im back off to maplins for more capacitors :)

Thanks again Nigel you are a newbies deity :wink:
 
Nigel Goodwin said:
2camjohn said:
If anyone can offer any help whatsoever i will be very grateful.

You've said 22nF capacitors again - 22nF are a thousand times too big, and will prevent the clock oscillator running.

Sorry posted that almost at same time as you.

Thanks again, no doubt i will be back tomorrow with more stupid mistakes and problems :twisted: :lol:
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top