Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

problems with LEDs on Pic16f876 port A

Status
Not open for further replies.

fuzzzy

Full Member level 3
Full Member level 3
Joined
Oct 2, 2004
Messages
156
Helped
7
Reputation
14
Reaction score
2
Trophy points
1,298
Location
ITALY
Activity points
1,650
pic16f876 portpin

Hi
I've got a little problem.

I have 3 led and a buzzer on ports A0, A1, A2, A3.
i'm using a 16f876

I can't understand why if I set high these ports, A0,A2 and A3 they make less light than A1.

it seems like these ports flashes at very high frequncy while A1 is always high.

when my code find a delay, leds remain low or high for the delay.

there is no pullup on these ports. I set correctly TRIS to 0.

it seems like ports goes in input during the code and then when I order to set high they go high for awhile and then they go down.

my code is in CCS C.

Could you help me??
 

fuzzzy

Check the data sheet.
I have often found problems with ports on higher end PIC's to be caused by extra features of the port.
For and example I found one port pin which defaults to an ADC input (which I didn't know) and if the port is set as an 1, it would output a high level for 5us or so, before going back to the normal ADC state. Had me thinking for ages.

Anyway read the datasheet carefully and see if you can find anything.

Maui
 

Always use a transistor to drive your LED so enought current can make them lit bright.
 

Hai
Did you set the ports as digital ?
PORTA is Also Analogue port.
PIcstudent
 

    fuzzzy

    Points: 2
    Helpful Answer Positive Rating
You have to put the pins as digital. You only have to write this 2 lines(in the correct bank).

MOVLW 0x06
MOVWF ADCON1 ; Configure all pins as digital inputs
 

    fuzzzy

    Points: 2
    Helpful Answer Positive Rating
Use port B to drive the LEDs, it gives more current ~150ma, port A give less then that .
 

Hi,

I solved my problem setting port as digital, i thougt they were digital as default instead I had to put them manually.

Now my sistem works very well
 

Set PORTA to digital port.

setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_OFF);
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top