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.

PIC output pin keeps going low

Status
Not open for further replies.

Endicron

New Member
I'm trying to learn my way around PICs. All I want to do is pulse an LED using only a 3V source. I'm using a 16F684A and the spec says it has an operating range of 2.0 - 5.5V. It also states that the "Voltage on all other pins with respect to VSS is -0.3V to VDD + 0.3V."

I can get the LED to turn on only when Vdd is 4.20V or higher.

I'm running an internal 4MHz clock

and theres only the PIC and the LED on the board.

The LED has a VF of roughly 1.7V.

In theory if I apply 3V for Vdd then there should exist 3V at the output pin of where the LED is placed, more that enough to bias it.

What am I doing wrong?
 
hi,

What value are the LED segment resistors ?, are the LED's common anode/cathode? [sounds like CC]

Do you have a transistor in the common of the LED?
 
Here's all I have. There are no active components in the circuit. Just one LED. The I/O will source/sink 25mA automatically. Again, the code and the built circuit works fine at 4.3V and above. I can see the LED turning ON and OFF at a visible rate. I can apply 3V to Vdd but I get nothing, 0V, at the I/O port being tested.

There is no segment display. Just one LED.

Code
STATUS equ 03h ;Address of the STATUS register
TRISA equ 85h ;Address of the tristate register for port A
PORTA equ 05h ;Address of Port A
COUNT1 equ 21h ;First counter for our delay loops
COUNT2 equ 22h ;Second counter for our delay loops

bsf STATUS,5 ;Switch to Bank 1
movlw 00h ;Set the Port A pins
movwf TRISA ;to output.
bcf STATUS,5 ;Switch back to Bank 0

Start movlw 1Fh ;Turn the LED on by first putting
movwf PORTA ;it into the w register and then

Loop1 decfsz COUNT1,1 ;Subtract 1 from 255
goto Loop1 ;If COUNT is zero, carry on
decfsz COUNT2,1 ;Subtract 1 from 255
goto Loop1 ;Go back to the start of our loop.
;This delay counts down from
;255 to zero, 255 times

movlw 00h ;Turn the LED off by first putting
movwf PORTA ;it into the w register and then on

Loop2 decfsz COUNT1,1 ;This second loop keeps the
goto Loop2 ;LED turned off long enough for
decfsz COUNT2,1 us to see it turned off
goto Loop2
goto Start ;go back to Start and turn LED

END

Thanks
 
Endicron said:
Here's all I have. There are no active components in the circuit. Just one LED. The I/O will source/sink 25mA automatically.

No, add a series resistor - the PIC is specified that you shouldn't try and draw more than 25mA, it's not automatically limited to that - you should always use a resistor.

Also post all your code, not just a part of it - and use the 'code' tags (click on Go Advanced) to sorround your code to maintain it's formatting.
 
Not sure on this pic as I have not used it, but make sure that pin is set to an output and look for CMCON in the spec just in case. But you did say it "works" at a higher voltage? Does it blink or just light up? Also, as stated, add that current limiting resistor :)

Post a drawing and the complete code (as requested) and I am sure someone will get you working.
 
Endicron said:
I'm trying to learn my way around PICs. All I want to do is pulse an LED using only a 3V source. I'm using a 16F684A and the spec says it has an operating range of 2.0 - 5.5V.

Microchip Website don't have the 16F684 PIC with an "A" version.

Even as simple as a part number and you get it wrong. :mad:
 
It sounds like you have brown out reset enabled in the CONFIG bits. This can cause the PIC to be in reset as long as the supply voltage is lower than 4.2V.
 
kchriste
I believe there had to be something related to PIC setup that needed to be addressed.

The PIC is 16F648A.

eblc1388: I mixed the numbers around, no need to be a jerk.

Nigel Goodwin: The LED would have burnt out within seconds if the current were any higher than I had stated and I used an ammeter to see what it was drawinig (without current limiting resistor) when I coded the LED to remain ON. It works, I can code it to blink at a 30mA and code it to leave the LED ON with no problem. Same LED was used for many days now. I still works.
 
Mixing up the numbers makes a big difference.

I checked the BOR voltage in the 16F684 data sheet yesterday and didn't post as the value is much too low to be the problem.

On a 16F648 the BOR voltage can be as high as 4.35V and is probably your problem.

Maybe you should apologize to eblc as due to him you may have found your problem.

Mike.
 
Yesterday I found that the VBOR of PIC16F684 is from 2.0 V to 2.2 V. Then I thought that was the current limiting resistor problem. If it is PIC16F648A, then it is probably the problem. The VBOR for this PIC is from 3.65 V to 4.35 V. But anyhow, the resistor is still needed. Don't be stubborn, I've burned a few PICs simply because of not putting in the resistor for turning on the LED.
 
Endicron said:
Nigel Goodwin: The LED would have burnt out within seconds if the current were any higher than I had stated and I used an ammeter to see what it was drawinig (without current limiting resistor) when I coded the LED to remain ON. It works, I can code it to blink at a 30mA and code it to leave the LED ON with no problem. Same LED was used for many days now. I still works.

It doesn't matter - it's BAD PRACTICE - and you're abusing the PIC. You're supposed to use a current limiting resistor - why not do so?.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top