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.

Troubleshooting PIC16F877A

Status
Not open for further replies.

apgphp2005

Newbie level 5
Joined
Sep 22, 2005
Messages
8
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,432
pic 16f877a crystal troubleshooting

Hi all,

I am having problems running a PIC. I programmed a PIC16F877A using PICSTART and MPLAB. The program is to Convert Analog to Digital from PORTA.0 and transmit a ASCII SYMBOL using RS232 Protocol from PORTB.0 .

When i apply 5V to PIN 11 (i.e. Vdd) and Ground to PIN 12 (i.e. Vss). We apply a 2.5 V analog voltage to PIN 2 (i.e. PORTA.0) and attach an oscilloscope to PIN 33 (i.e. PORTB.0) we see no change in Voltage level of (PORTB.0) i.e. it stays at GROUND Level. And, the PIC starts heating up. Also, after some time the connectivity (i.e. tested with Multimeter) is lost between (PIN 11 & PIN 32) AND (PIN 12 & PIN 31). But, when power is turned off and PIC cools down connectivity appears again.

Also, please tell me how to make a PIC work after having programmed it. I mean how to start it.

Hoping Someone might help me out.

Thanks in advance
 

pic16f877a program lost

The chip getting hot means there is a hardware fault of some sort. Are you sure you have pin A0 set as an input?

When microcontrollers get hot I throw them in the bin. I don't reuse them The cost of a new chip is not worth hours of time trying to find why some piece of equipment is working unreliably because it has a half dead chip in it.

The internal USART uses pin 25 (C6) for outgoing data. If you use port B you will have to implement serial transmission in software.

I take it your software has not been debugged at all?
Break it into small parts and test them seperatly eg make a version that does nothing but send out serial data constantly.

The 16F877 has in circuit debug but it's too easy to get bogged down spending hours single stepping your software when you should be reading you software line by line, reading the datasheet and thinking about your software works.
 

    apgphp2005

    Points: 2
    Helpful Answer Positive Rating
pines de pin 11 vcc y gnd del pic16f877a

Hi throwaway18,

Thanks for your reply. I forgot to mention that i have successfully tested my code on simulators, i used oshon soft PIC simulator ide. It has also been tested for Software UART. Also, that i wrote code in PICBasic not Assembly.

And, since this is the first time i am running a PIC i can't just throw away without knowing what the problem is because i have never run a PIC before. So, i think may be i am doing something wrong while supling power to it.

Can you please tell me what coonections with volatges do you apply at your PIC's and if possible PIC16F877 or PIC16F877A.

Thanks again
 

pines de vcc y gnd del pic16f877a

Doesn't F877 have a MCLRB pin? You have to tie this pin high (to VCC) or else the part is in shutdown and won't run.

If you saw the IC get hot, that means you were running a lot of current somewhere you usually don't want to - this can happen if Vcc and GND are backwards, or if any pin is higher than Vcc. It shouldn't happen by applying 2.5v to an ADC port when in shutdown, but I can't be sure.

The problem is that sometimes if you drive current the wrong direction, you burn some junctions inside the chip, and it never works right again - that was the point of throw's warning. But as the chips are expensive, maybe it's worth looking into whether it's still salvageable..

I would put a current meter in series with the 5v supply - it should not register more than a few mA when the chip is running, and very small currents when the chip is in shutdown. Also check the 2.5v source - it should not be giving ANY current to the ADC. One of these is your culprit. If the ADC pin is sinking current from the 2.5v, it is probably burned. Maybe try the next one over just for debugging, but all in all this chip is injured and should probably be replaced.

First, apply only VCC and GND. Make sure current into Vcc not too high, and check for clocking on OSC2 - I assume you're using external osc or a crystal, this will be your best check if the IC is alive.

If the chip is up, and clocking, your program should be running. Now you can try applying analog voltages to the ADC's.

good luck!
 

    apgphp2005

    Points: 2
    Helpful Answer Positive Rating
troubleshooting pic16f877a

Check the actual 5V to make sure it is 5V.
To avoid the inputs being in some intermediary state and cause the part to draw a lot of current, make ALL UNUSED pins OUTPUTS. That way no input will be left floating. If you have all the unused pins configured as inputs, but left unconnected, that might be the reason for the chip getting hot.
Make sure also that you do not have two outputs tied together and conflicting with one another. That would cause overheating, too.
What RS-232 drivers do you use? Check that chip, too.
 

    apgphp2005

    Points: 2
    Helpful Answer Positive Rating
initialize adc in pic16f877a

Hi electronrancher & VVV,

Thanks for your reply. Could you guys have a look at my Program, it's in PICBasic and see if i have missed something. This program take analog input at PORTA.0 and give ascii code 'A', 'B' or 'C' using RS232 Protocol at PORTB.0. The ascii code sent depends on analog voltage level.

The code gets compiled without warnings and errors. It simulates very well on PIC Simulator IDE. I even simulated the transmission protocol and it works fine too. But, i think i am not giving Proper input currents and voltages to the Microchip.

I am not that good at electronics. So please don't mind my silly questions. But, when i checked output cuurent of 5V source it was approx 1mA. But, at that time the source wasn't connected to PIC so must i check current after the Source is connected to PIC.

PIC i am using is PIC16F877.

Also, guys i will buy a new PIC. But, could you guys inform me of any change to be made in my code and also what connections should i make this time.

Sine program indentation gets removed when posted here, i am attaching my program's code.

'A/D conversion Program

Define ADC_BITS 10
Define ADC_CLOCK 3

Pressure VAR Word
TxValue VAR Byte

Start:
GoSub Initialize 'Initialze ADC and Output
Loop:
GoSub Read_ADC 'Read Analog Value
if pressure > 200 then
GoSub Get_Transmit_Value 'Get Value to Trasmit
GoSub Transmit 'Transmit value to receiver
' Pause 100 'Pause 100 msec
endif
Goto Loop
Finish:
End

Initialize: 'Initialze ADC and Output
TRISA = %00000001 'Set PortA Pin0 (AN0/RA0) as Input
ADCON1 = %10001110
PORTB.0 = 0 'Set PortB Pin0 as Low
TRISB = %00000000 'Set PortB Pin0 as Output
Return

Read_ADC: 'Read Analog Value
ADCIN PORTA.0, Pressure
Return

Get_Transmit_Value: 'Get Value to Trasmit
if pressure >= 200 AND pressure < 400 then
TxValue = "A"
endif
if pressure >= 400 AND pressure < 600 then
TxValue = "B"
endif
if pressure >= 600 AND pressure < 800 then
TxValue = "C"
endif
Return

Transmit: 'Transmit value to receiver
SEROUT PORTB.0, 6, [TxValue]
Return
 

input to pic16f877a and multimeter is not same

I don't know is your code corect but I have one suggestion. You should check hardware with some easier program, for example blinking of leds. If this program works you will go further to find mistake with your ADC&USART. If you dont have example with leds, let me know and I will sent to you.
 

pic16f877a,pin vcc y gnd

your code is not going to make the chip get hot, you need to find out what's wrong with your setup..
 

pic16f877a heating up

Can you post an image of the board you are using? If you made ha board is possible to have some shorts between tracks. If you use a socket you can check shorts (without the PIC) between all the pins and GND/Vdd.

I don't use PICBasic, but I can't see PIN configuration (inputs and outputs). Check it.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top