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.

Problem with working on uart module of PIC16F877A

Status
Not open for further replies.

mexx

Member level 2
Joined
Dec 2, 2003
Messages
49
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
550
uart problem

hi folks

there seems to be a problem whenever i work on uart module of my pic16f877a.

i hav written a simple code transmitting a single character from pic to my pc using max232.
i m using a 9.5 v battery to give the regulated 5v(7805) to both my pic and max232.
initiallly the code worked fine but after sometime it simply isn;t working anyway
even i m getting 3.79v from my 7805 with Vcc supply given to oth pic and max232.

is it because the current went down for pic and i hav to use a seperate power supply for both ICs.

plz help
 

Re: uart problem

Hi,

As far as I'm aware, the max232 requires a 5v supply, with a minimum of 4.5v. And the 16F877A's minimum supply voltage is 4v. Generally, a 5v supply is best for the 877A, since its got loads of modules (USRT, SPI PWM etc.).

So, I suspect that the fact your power supply voltage is 3.79v, the max232/PIC isn't happy. It might still provide an output (1's and 0's) but the circuit to boost the voltage to +/- 12v probably isn't functioning properly. That said, I've built a similar circuit before, without any level shifting (pic -> buffer -> PC: 0-5v) and it worked.

Just out of interest, what 7805 are you using? Is it TO-92, or T0220? (big 3-pin, or small 3-pin). The latter can only provide a maximum of 100mA, with a reliable 50mA.

My advice, assuming your micro/code is all O.K, is to check the current draw from the battery. And then the current from the regulator, and change the regulator for a new one. There may be a short somewhere which shorts the circuit and battery. Also, try using a short cable to your PC (5m?) and taking out the max232, with the output of the PIC into an inverter (not gate, 74HC04 or similar) then to the TX line of your cable. Use hyperterminal for debugging. Does the 7805 heat up at all?? it'll switch itself off if you draw too much current from it (like shorting the output to ground).

Sorry if this doesn't help, let me know how you got on.

Good luck,
BuriedCode.
 

Re: uart problem

the output of my batteries (without regulator is around 8.5 volts,50 mA) and after regulating it is coming 4.3v,6mA.....
is it ok for driving both of my IC's. also i m using small 3-pin 7805.

earlie when i wasn't using max232 and only simple applications of pic everything worked fine.
//just a simple question//what should be the ideal current input(and minimum) to pic microcontroller for every module of it to work fine(the voltage as told is b/w 4-5 v) and the same for max232.

is the single battery that i m using is ok for both the ICs.?
what if i use a dc adapter ..lets say my mobile phone charger gives a decent 8.5 volts...
is there any problem due to current drop by usin 2 ic's rather than 1.
 

Re: uart problem

Hello again.

Thanks for taking the measurements, many do not provide such information...
Input 8.5V@50mA, output: 4.3@6mA. This is a bit confusing. If the battery is just connected to the regulator (nothing running off the 8.5v) then the current for both the input and output should be the same...All the regulator really does is drop the voltage down to 5v from a +7.5v input. The current is determined by the circuit, it'll draw what it needs.

So usually with regualtors, the amount of power they 'absorb' is given by (Vin-Vout)*I. I really don't know whats going on with the current drop, but I'm not expert with regard to power :(

//just a simple question//what should be the ideal current input(and minimum) to pic microcontroller for every module of it to work fine(the voltage as told is b/w 4-5 v) and the same for max232.

According to the data sheet for the PIC16F87X (including the 877) the typical current draw is a staggering 7 mA, thats with a maximum osc frequency (20Mhz), V=5.5v and I think, all modules on. However, it depends what you have connected to the pins of the PIC. A LED may draw 20mA which would have to come from the PIC, thus, from the PIC's power supply, boosting the current to 27mA. That said, I have had the 877 run from 4 mA, microcontrollers are wonderful things, they hardly need any current as long as they don't have to drive anything that requires current. So back to your question, it's always better to have plenty of current available rather than too little. Say your power supply (and regulator) can provide 5V at 10A. The PIC will draw what it needs, say, 15mA. But if you only have 8mA available, the PIC will struggle to do its job, especially when driving pins that are connected to something.

Another issue, will be the max232. The datasheet for that states a 'typical current' of 8mA., with a max. of 10mA. Although this is very impressive for what the chip does (not as impressive as the tiny current the PIC needs) both chips require a higher current than your 7805 seems to be providing.

So the current from the battery/regulator should be at least 20mA. I would say 40mA just to make sure. Does your regulator look like this?
**broken link removed**

Or is it smaller? If it is the one in the picture, then it should be able to provide more than enough current, but if its the smaller one (looks like a small transistor) then I would chenge it. I've used the smaller ones before, and although they say it can give 100mA, I've yet to get more than 30mA out of it, and even then it got very hot.

is the single battery that i m using is ok for both the ICs.?

I'm sure its fine. I use 9V pp3's for nearly all of my micro circuits, unless your driving a motor, or a relay, or bulb, your battery will be good for the job. And you said its providing 50mA to the regulator, which is more than enough.

what if i use a dc adapter ..lets say my mobile phone charger gives a decent 8.5 volts...

You could do, and see what happens. Take voltage/current measurements with that, and see if there is any major difference in the values. My money is on the regulator. If you can, replace it. If you can't (parts can sometimes be hard to get hold of) you could try using diodes to drop the voltage from the battery. Most diodes have a vdrop of 0.6v. So for 8.5 to 5v = 8.5-5 = 3.5. So 6 diodes in series would give you a drop of 3.6V, and a output of 4.9V, not bad. The current should be the same before and after the diodes.

Well, I'm out of idea's. But I'm certain that your circuits require more currect, and your regulator isn't functioning properly.

BuriedCode.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top