Pic16F876a output

Hi

I have now looked trough my datasheet over 16F876A and cant find any info about how much voltage it will have when high out on etc port C, and how much current there will be.

Any1 know wich page to find that, getting anoing that i cant find it.

Section 17.2, page 179.

Section 17.2, page 179.

what?

Have now tried to find that information. But no luck. not sure what to look after.

I am using Port A, as input for A/D konverter

And Port C as output, PWM 1 on pin 13 + direction control on pin 14, and PWM2 on Pin 12 + derection control on pin 11.

(No subject)

16F876A_Output.jpg

16F876A_Output2.jpg

seen those

Jep also looked at that page. Thanks, then i know i am on the right track.

But those are absolute max ratings, it proberly wont be able to handle those with out breaking.

But does it mean that there will be etc. (vdd - 0.7) --> 5 - 0.7 = 4.3V and about 20mAmp out when high?

Or how can i calculate how much current it will give?

My direction control, pin 11 and 14, are wired to a 1k resistor and then to the base of a BC547b.

My problem that i need to calculate the voltage and current around the transistor, and to make a formel to calculate the resistor.

And every time i try, my resoult always get around 50k+ ohm for my resistor, but if i am correct it shall only be around 1k ohm.

If Vdd = 5V you will get a

If Vdd = 5V you will get a minimum of 4.3V output, and you can sink/source up to 25mA with no problems. Just to be safe I usually try to keep my output currents below 20mA per pin.

Taking the worst-case scenario for your transistor base resistor:
(assuming emitter is tied to ground)
Min hFE = 200
Min VBE(on) = 0.58V
Max VBE(sat) = 0.9V
Max Collector current = 100mA

Min base current to pull 100mA through collector: [Collector current] - [Min hFE] = 100mA/200 = 0.5mA
Min voltage across base resistor: [Output voltage] - [Max VBE(sat)] = 4.3V - 0.9V = 3.4V
Max base resistance for worst-case: R = V/I = 3.4V/0.5mA = 6,800Ω

You can use a base resistor lower than 6,800Ω, but if you use one that is higher you run the risk of not being able to pull the max rated collector current.

For this circuit

It is for this circuit i need to calsulate the correct values for the resistors and so on.

How do you make sure that the current is set to be max 20mA pr. pin?

When i am using PWM at the TIP31, is there any special formulars to calculate the frekvens, duty cucle?

Just click on the picture and it should pop up, in a new window. Not sure you can see it if you dont click on it.

Dont mind the little error i have dwaren at the relays, Have corrected it on the drawning i am using :0)

til_lmr_fuldt_diagram_fors__g.pdf|x

If all the PIC outputs

If all the PIC outputs supply 5V through a 1kΩ like you have drawn it, then the current will not be more than 5V/1kΩ = 5mA.

The TIP31A datasheet will list a maximum frequency, or at least rise/fall times that you can use to calculate the frequency from. Realistically the motor and motor capacitors will be the problem - I suggest you set your PWM frequency as low as possible and only raise it if you need to.

As long as your motors and transistors are operating withing their maximum current/power values you can set the duty cycle to whatever you want.

problem

So my problem that i having right now. Where noting happens when i am turning it on. Only the right wheels give alittle respond, but they wont turn.

Can my problem be that the frequency is set to high, in the code?

Hmm, try setting the duty

Hmm, try setting the duty cycle to 100% - if it works then the frequency is probably too high, if it still doesn’t work at 100% it’s probably something else.

question

I just looked on my schmatic, and began to wonder, when the BC547 at the relay is open, then it will make the relay react.

Then wont the 9v go troughe the spole in the relay and over the transistor to ground?

For if so, then my calculation will be different, when the transistor is on.

I’m not sure I understand

I’m not sure I understand which transistors you’re talking about here.

When the BC547 controlling the relay turns on, current flows from the 9V source via the relay coil and transistor to ground, flipping the relay contacts. If the BC547 is then turned off the relay contacts revert to their original position. The calculation for this transistor is the same as I mentioned earlier, since the reference voltages are between the base and emitter, which remains grounded.