1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
|
[code]
#include <iostream>
#include <cmath>
#include <iterator> // std::advance
#include <cstdlib>
#define VBE 0.7f
using namespace std;
/****************************************************************************/
float Calcib(float ic, float beta, float ib);
float Calcrb(float Vcc, float ib, float rb);
float Calcrc(float Vcc, float ic, float rc);
/****************************************************************************/
int main(int argc, char** argv) {
float ib;
float rc;
float rb;
float Vcc;
float ic;
float beta;
ib = Calcib(ic, beta, ib);
rb = Calcrb(Vcc, ib, rb);
rc = Calcrc(Vcc, ic, rc);
cout << "Please enter the value for Vcc: " ; //prints sentence on screen
cin >> Vcc; //value entry
cout << "Please enter the value for ic: " ; //prints sentence on screen
cin >> ic; //value entry
cout << "Please enter a value for beta; " ; //prints sentence on screen
cin >> beta;
cout<< "*.*.*.*.*.Base Bias.*.*.*.*.*" << endl;
cout<< "vcc\t\t "<< Vcc << endl;
cout<< "ic \t\t " << ic << endl;
cout<< "beta\t\t "<< beta << endl;
cout<< "ib\t\t " << ib << endl;
cout<< "rb\t\t " << rb << endl;
cout<< "rc\t\t " << rc << endl;
cout<< "*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*" << endl;
return 0;
}
float Calcib(float ic, float beta, float ib)
{
ib = (ic / beta);
return ib;
}
float Calcrb(float Vcc, float ib, float rb)
{
rb = ceil((Vcc - VBE) / ib);
return rb;
}
float Calcrc(float Vcc, float ic, float rc)
{
rc = ceil((0.5 * Vcc) / ic);
return rc;
}
| |