Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations SSS148 on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

PICmicro & I/O Pin 6

Status
Not open for further replies.

UsmanLula

Electrical
Aug 10, 2005
34
Hi all,

I have used a PICmicro (as mentioned earlier in the thread - wanted to concentrate on a particular aspect)

I have used the PICmicro I/O to source the power to several components in the circuit. I know that each I/O pin of the PIC16C62B is able to source 25 mA - but if i am powering the PICmicro with a 5V supply (Vdd) - what is the output voltage on each I/O? Is it (according to the PIC16CXX family reference) Vdd-0.7??? (Output Voltage High on I/O)

If so, does that mean each I/O pin can supply a minimum of 4.3V??? Also, what is the tolerance on the I/O pin?

I am almost now about to do an error calculation on the whole circuit. I am sure at the time I measured the voltage at the I/O pin - but I have no record of this!!!

Any help on this very much appreciated. Thanks once again to all who replied to the previous thread!

Usman
Medical Physicist












 
Replies continue below

Recommended for you

Yes PIC's have a whopping drive on SOME of their pins.

But do remember!!! That the total drive to the PIC is supplied only thru one or two pins and that there are very small wires going to it/them. We are talking 18um or wires that are 0.0007 inches in diameter. When you start drawing 25 to 100mA thru this your voltage will drop.

Your scheme while clever is treading on thin ice. The numbers you are looking for aren't spec'd because they are so nebulous. The spec is of typically 3mA >-> Vdd - 0.7. NOT 25mA! Your scheme may still work if you are running things that work down to 3V. But you will experience voltages all over the place depending on other pin loading and processor workload.[spineyes]
 
If you really want to drive something high side, look at using something like a MAX894L.
 
Well guys

My circuit draws an overall current from the PICmicro of 20 mA (measured). This excludes the PICmicro.

Comments on Thread

Section 30 of the PICmicro Reference states that the Output Voltage will not be reached if the I/O pin is shorted. I have not shorted any I/O pins.


Breakdown of Current Measurement

The S250 strain gauge (1.68mA), LTC1298(0.29 mA), POT (5.43mA) and the classic IA (using three op-amps of the quad LT1014 (1.39mA)) are powered by a single I/O pin of the PICmicro (consuming no more than 10 mA in total). The MAX232 Line Driver is powered by another I/O pin of the PICmicro (consuming no more than 9 mA).

Summary

The current consumed by each of the only two I/O pin used to power the circuit is 10mA i.e. 20 mA in total. Plus a third Pin to power an LED (~10mA). All components mentioned in 'Breakdown' section required a supply voltage of 5V.

Datasheets

According to the MICROCHIP Midrange Reference (Section 30, page 30-11: Electrical Spec), the Output High Voltage (Voh) is Vdd-0.7. This is under the conditions of sourcing 3mA using a supply of 4.5V (Vdd). Now, why would Microchip say each I/O pin can source 25mA?????? So, the Output High Voltage is a minimum of 4.3V. MICROCHIP state its a minimum voltage by the way. Does that mean it can supply 5V??? Or is that when the current consumption is lowered???

Also, why would each Port supply 200 mA in total?? This can't just be a transient? can it? There are 8 I/O Pins in Port B (im using three pins). Divide 200/8 gives 25mA for each I/O pin. So each must be capable of supply 25mA but the test condition only states 3mA for a 4.5 Vdd??? Perhaps they mean when supply the PICmicro with 6V and supplying the maximum current to the PICmicro will provide the 25mA I need???


Comparison to Atmel AVR Micro-controller

Secondly, the Atmel AVR 8-bit micro (ATtiny26X) can source 20 mA and thus supply 4.2V (minimum) (from each Pin of Ports A&B) under conditions when the supply to micro is 5V (Vcc). Does this mean, that this particular AVR is better at sourcing current than the PIC?? If we are simply saying each micro is powered by 4.5Vdd (which they are) - Then the PICmicro supplies 3mA at 3.8V; whereas the AVR supplies 20mA at 4.2V.

Its very confusing now. Need some light on why MICROCHIP claim that each I/O port sources 25mA. Mind you, the circuit does work but I do not recollect measuring the source current from each I/O port. I am still sure I have measured the voltage at each pin. But no record of this!

Conclusion

Any light on this topic guys???

Thanks for the previous few threads - very interesting. The whole idea of this circuit was to put it to SLEEP whilst consuming only around 1.1 uA (PICmicro in SLEEP). But, seen as I am about to do these error calculations - i'l have to make assumptions!


 
I think that you should look at an output pin in the high state as a voltage source (Vcc) and a 200 ohms resistor in series.

That will give you a fairly clear picture of what happens if you do not load the pin at all (Vcc, obviously) and if you short the pin to Vdd (Vcc/200 ohms = 25 mA if Vcc is 5.0 V).

It will also give you close to the specified Vcc - 0.7 V when you are drawing 3 mA out of the pin (well, that gives you Vcc - 0.6 V, but close enough). There is probably some non-linearity inside the chip.

There are curves showing output voltage vs source and sink current in the data sheet if you want to go into more detail.

Gunnar Englund
 
UsmanLula; Why can you not SET a pin high and simply plot the voltage as you step your resistor decade box down (current up to 25mA) Since this is not spec'd just measure it for yourself. Then you will have your own experience with the subject which always "feels" better than what you try to read "between the lines".

If you are stuck bobbing in a life raft doing this, let me know I'd be happy to do it. Take me about 30 minutes. Not a problem.

I presume you are going to try using the bridge and A/D in a ratiometric manner to mitigate the lousy voltage regulation?
 
Hi Itsmoked

I am revising for my medical electronics viva which is on 21st September. It is based on the three project I have done so far. I would appreciate your help in this. Cheers.

I didnt actually think about the I/O power that much at the time I was building the circuit - silly me. Now that I come to think of it - I should have actually tested the I/O port output properly!.

The viva is about 30-45 minutes long and the examiner is a consultant medical physicist specialising in the field of medical electronics instrumentation. Its my final viva before I qualify to work unsupervised in the clinical setting (hospital).

Thanks in advance

Usman
England
UK



 
UsmanLula; Sorry but several things conspired to make this take longer to get to. Bday parties, etc.

The PIC appears to perform better than the spec reads. (typical) But still about what I'd guess.

Picture worth a thousand words and all, here you go.

Should be an image in this post. If not,[banghead] the same picture is here:
ddfjac.jpg
 
Thankyou so much "Its_smoked" for the work especially over the weekend!!!

I am pretty impressed with the results. So my components are powered at about 4.5V being sourced with ~9mA (each of the two ports).

Does this mean that if my Vcc has a tolerance of 2% i.e. a range of 4.9 - 5.1V, the I/O output voltage will not be affected? Or does it mean that the output I/O will be affected by the same amount?? i.e. 2%. So for a Vcc tolerance of +/-2% (5V), the I/O output will be 4.5V (+/-2%)????

I would like to thank you once again for your efforts. Very much appreciated! Cheers :)

Usman





 
My pleasure UsmanLula.

Oh yes! The output would be directly related to the supply voltage. Same exact shifts.

My notes of dropping Vcc refers to my system's regulator stiffening up with load not some inherent standard tolerance.

If needed one could always run a tiny low head regulator with a pin and design everything to run on a lower voltage..say 4V.

But I still like the idea.
 
Remember, the PIC I/O is NOT designed to supply power to external circuitry. Make sure you understand all of the surge current requirements of your external circuit. Also, make sure that the inductance is kept to a minimum to prevent voltage flyback when the circuit "switches" or when the supply (I/O) is turned off.
 
Smoked,

That's exactly what I also would do on a rainy day! Good to see that there are still some enthusiasts left on the Earth! Kudos.

Gunnar Englund
 
Cheers ItsSmoked.

I like the regulator idea too. Atleast I will have a larger head room for the current over the regulated voltage level say 4V. The work you did is very interesting. Now i am hoping to spend all day Wednesday doing the calculations for the circuit and its limitations. By the way, looking through the PIC reference PIC16C6X...Figure 17-20: IOH vs. VOH (Vdd=5V). I just realised. For source current of 10mA Voh=4.3V (i.e. Vdd-0.7). I cant believe I missed this graph. In fact I was looking at the PIC16C62A section and not PIC16C61 section.Sorry

Malone - I have only come across one aspect close to what you mentioned and that deals with successive operations on the I/O ports. "...The sequence of instructions should be such to allow the pin voltage to stabilise (load dependent) before the next instruction...". The I/O pins are TTL inputs and I couldnt find any graphs in the PIC reference related to I/O port and its transients. I do know however, that any unused pins should be grounded via a resistor (in case these set off the interrupts and also to ensure the PIC consumes <1uA during SLEEP operation). I will have a look at the other datasheets (strain gauge/ADC/IA) with regards to transients. Thanks

Usman
 
One more query. :)

I powered the MAX232 using a seperate I/O. Assuming I use the data (from the work of Smokey) and say the I/O supplies ~8.8mA and 4.5V. When I did connect this to the MAX232 Vcc, it didnt work. So what I did was use a 100 Ohm resistor in between the I/O and the MAX Vcc. However, this means that if im supplying 8.8mA via a 100 Ohm resistor, the voltage is bearly a volt (0.88V) being supplied to the MAX232. It was working like this. but how can it work if it requires a 5V supply Vcc???

I looked at the MAX232 datasheet, in the maximum absolute ratings for Vcc i.e. -0.3V to +6V. So does this mean, the MAX232 will work in this voltage range? The MAX232 does require 5-10 mA though. A bit confused here. Any help appreciated.

Usman
 
No, looking at the graph: 8.8mA would start out at 4.4V the 100 ohm res will drop;

100 x 0.0088 = 0.88V Which is of course,

4.4 - 0.9 = 3.5V

You fed the MAX 3.5V. Some RS232 systems work okay with this if you aren't talking fast or far.

I don't off hand see where the 100 Ohms would help anything.
 
Hey smokey

Thanks for that. Somehow I couldnt get the MAX232 to work straight off the PIC I/O. MAX may be workin due to the low speed. True.

The PIC16C62 does not have a UART. I was using the RC6/RC7 pins (TX/RX) for serial data transmission. But i set the baud rate of 19,200 in the PIC C program. How does the serial transmission work?? By bit-banging in software using the PCM compiler?? Is the UART a software UART???? Dont understand how the serial transmission works on the PIC16C62.

I didnt of course use SPI or I2C (although I was told to use I2C - no time!).

Thanks once again for your valuable time.

Usman
 
Two comments:

- The level converter in the MAX232 may generate some noise.

- "Software UART" means you assemble each frame and bit-bang the output. It also means you (over)sample the input and build the incoming words yourself. Start with 300 baud and work your way up.



Mike Halloran
Pembroke Pines, FL, USA
 
Hi Mike

Thanks for that. I have already developed the kit. The bit-banging bit was left to the C-compiler. I just stated the RS-232 parameters. thats all I did for the PIC. What is bit-banging in short??? (i have checked the net but i still cant understand it! It goes into too much depth-I didnt implement the algorithm myself).

Ta

Usman
 
Usman,

if you make an iteration to your design, you could use a 74ACT245 as a "higher power" output pins IC. Its off state would provide the same zero power consumption, and the ON state could drive much more milliamps with less voltage loss. As a bonus, you can parallel outputs to further reduce the losses.

The comments about the noise generated by the RS232 buffer also mean that the power supply noise of this buffer can backfire into the PIC through the I/O pin used to power the part. It may cause some unexpected behaviour versus your code, because the noise can fool logic levels within the pic. This is something that an external buffer chip would guard the PIC from.

You can also parallel I/O pins on the PIC to reduce this effect, and of course provide some filtering on the lines used as external power pins. I'm sure that you provided some, already.

Felixc

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor