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.

Analog woes. Led's aren't behaving as I expected?

Status
Not open for further replies.

ravix

New Member
Hi. I am trying to build a very simple device that can turn on six different LED's, one at a time. I have some experience with pics, and the circuit is working well digitally.

Attached is a simplified circuit diagram to help me explain. The only things not included in this diagram are the programming pins and resistors, a couple of switches attached to int0 and int1 (with pulldown resistors) and a couple decoupling caps.



I set PORTA to digital outputs, then set each pin to 0 to turn on the LED. Simple, right?

Unfortunately, one LED (the blue one) almost always stays on. ARGH! Its stays on UNLESS I have its pin enabled. In which case no LED is illuminated.

Does anyone know how this could happen? Is there something wrong with my circuit setup?
 

Attachments

  • led_ques.png
    led_ques.png
    7 KB · Views: 138
Last edited:
Almost certainly the problem is inside the box.
 
hi ravix,

I give up, which is the Blue one.:)
 
It's either a fuse.....or something else.:D

The blue LED may require more current. Is the resistor speced right?
 
I set PORTA to digital outputs, then set each pin to 0 to turn on the LED. Simple, right?

:confused:

EDIT: Please ignore, I see the grounds are being switched.
 
Last edited:
Just to make sure, you're setting TRISA to set the pin as a digital out, correct? TRISx is to determine if a pin is an input or an output, PORTx is intended to read the input value (though writing to it will write to LATx) and LATx is for writing an output. At least with the Hitech compiler I use, I suppose another compiler may define those differently, but it would go against the datasheet.
 
research causes cancer in rats.

Yes, and increased ice cream sales causes the asphalt in the street to soften.
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top