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.

PIC16F628A not stable ?

Status
Not open for further replies.

Hero.sl

New Member
Hi all
Im just trying to test whether my PIC is correctly programmed, using the following SIMPLE circuit.
**broken link removed**

(LED blinker) But the problem is the output is unstable. It only works when I touch the VDD pin. Any ideas?
Im using WinPic programmer, No errors in programming the PIC.
WDT is off. using Internal oscillator @ 4MHz.
Thanks
 
Sounds like you need a 0.1uF capacitor across pins 5 & 14 of the PIC.
You should also have a 10K resistor between pins 4 & 14 if MCLR is enabled in software.
 
It looks like you missed the reset pullup resistor on MCLR and there is no bypass cap between Vdd and Vss.
3v0

Hi all
Im just trying to test whether my PIC is correctly programmed, using the following SIMPLE circuit.
**broken link removed**

(LED blinker) But the problem is the output is unstable. It only works when I touch the VDD pin. Any ideas?
Im using WinPic programmer, No errors in programming the PIC.
WDT is off. using Internal oscillator @ 4MHz.
Thanks
 
Last edited:
Don't turn off MCLR in your code or you may not be able to reprogram it. Use a pullup resistor instead.

Mike.
 
Here's a small LED blink program & schematic for a 16F628A
Find the PDF by on this page. **broken link removed**
**broken link removed**
 
Thanks guyz.. now its working. :)
I thought we should pull up MCLR only when programming.

I noticed that when I remove the 470Ω resistor, the LED is always on instead of blinking(Blueroom's circuit). How does the voltage on RB0 affect the process?
 
Last edited:
I thought we should pull up MCLR only when programming.
Exactly the opposite. When the programmer is plugged in to the ICSP connector, it controls the MCLR pin.

But when you disconnect the programmer your MCLR pin is floating, so the chip is likely to be in reset at least 50% of the time. If MCLR is enabled you MUST have a (typically 10K to 33K) pullup resistor to hold the pin high.
 
If you remove the 470Ω resistor then the load on the pin becomes too much and the pin never gets to a voltage that would be read back as a logic low. It will always be around 3V.

If you change the code to,
Code:
		list	p=16F628A
		include	<p16F628A.inc> 
		__config 0x3F34
		org	0
		bsf	STATUS, RP0
		movlw	b'00001110'
		movwf	OPTION_REG
		bcf	TRISB, 0
		bcf	STATUS, RP0
		movlw	1
		xorwf	0x20,F
		movfw	0x20
		movwf	PORTB, f
		sleep
		end
it should start flashing again. This works because it uses a SFR (ram) location to remember the previous state.

Mike.
 
Last edited:
I got it. but another question. Even after declaring PortB as outputs, does it read the pins and change PORTB?
What will happen to PORTB when the WTD timeouts?
 
When a pin is set to output and you read it's value, you will get the value on the pin which maybe different to what was previously written if the pin is overloaded.

When the WDT times out it resets the pic and the pin gets toggled by the xor instruction. When you removed the resistor you overloaded the pin and it always read back as a logic one. The xor instruction changed the 1 to a zero and wrote it back therefore always lighting the LED.

Mike.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top