Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
LinkBack Thread Tools Display Modes
Old 30th September 2007, 07:00 AM   (permalink)
Default PIC output pin keeps going low

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?
Endicron is offline  
Old 30th September 2007, 07:15 AM   (permalink)
Default

Post your code.
__________________
Bill
Smart Kits build Smart People

http://www.blueroomelectronics.com
blueroomelectronics is online now  
Old 30th September 2007, 07:49 AM   (permalink)
Default

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?
__________________
Eric
"Good enough is Perfect"

PIC tutorials:
Gramo's: www.digital-diy.net/
Bill's: www.blueroomelectronics.com/
ericgibbs is online now  
Old 30th September 2007, 09:38 AM   (permalink)
Default

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 is offline  
Old 30th September 2007, 10:06 AM   (permalink)
Default

Only PIC and LED? No resistor? How about the decoupling caps?
__________________
Superman returns..
bananasiong is offline  
Old 30th September 2007, 12:25 PM   (permalink)
Default

Quote:
Originally Posted by Endicron
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.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is offline  
Old 30th September 2007, 01:31 PM   (permalink)
Default

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.
mramos1 is offline  
Old 30th September 2007, 04:28 PM   (permalink)
Default

Quote:
Originally Posted by Endicron
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.
__________________
L.Chung
eblc1388 is offline  
Old 30th September 2007, 09:23 PM   (permalink)
Default

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.
__________________
--- The days of the digital watch are numbered. ---
kchriste is offline  
Old 30th September 2007, 11:40 PM   (permalink)
Default

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.
Endicron is offline  
Old 1st October 2007, 12:52 AM   (permalink)
Default

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.
Pommie is offline  
Old 1st October 2007, 08:32 AM   (permalink)
Default

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.
__________________
Superman returns..
bananasiong is offline  
Old 1st October 2007, 09:15 AM   (permalink)
Default

Quote:
Originally Posted by Endicron
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?.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is offline  
Reply

Bookmarks

Thread Tools
Display Modes



Similar Threads
Title Starter Forum Replies Latest
Basing a PWM output on an Analogue input turbo-brown Electronic Projects Design/Ideas/Reviews 6 12th September 2007 02:00 AM
Output = Input - Problems adamthole Micro Controllers 20 24th April 2007 05:09 AM
555 timer output help for a newbee... WIZARDSV650S Electronic Projects Design/Ideas/Reviews 6 6th April 2007 05:04 AM
Using PicBasic with Output compare for sounds mduong77 Micro Controllers 7 29th March 2007 03:29 AM
How to design such output stage eeglp Electronic Projects Design/Ideas/Reviews 4 8th April 2003 07:01 PM



All times are GMT. The time now is 06:19 PM.


Electronic Circuits  |  Learning Electronics
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.

eXTReMe Tracker