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.
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
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?
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.
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.