summaryrefslogtreecommitdiff
path: root/3041/CH8/EX8.1/Ex8_1.sce
blob: e61eef58042745f5d0f81f149108199082481e1f (plain)
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
//Variable declaration
C=0.1                      //capacitance(uF)
R1=10                      //resistance(k ohms)
R2=2.3                     //resistance(k ohms)
Vcc=12.                    //supply voltage(V) 
Rl=10**3.                  //resistance(k ohms)

//Calculations
//Part a
f=1/(0.693*C*(R2+R1/2))    //frequency(Hz)

//Part b
D=(1+(R2/R1))/(1+2*(R2/R1))*100          //duty cycle
 
//Part c
//(i)
T1=0.693*C*(R1+R2)                        //time period through R1(ms)
T2=0.693*R2*C                             //time period through R2(ms)
Pavg=(Vcc/Rl)**2*(T1/(T1+T2))             //average power dissipated during current sourcing(mW)

//Part d
Pavg1=(T2/(T1+T2))*(Vcc/Rl)**2           //average power dissipated during current sinking(mW)

//Results
printf (" %.2f kHz",f)
printf ("duty cycle is %.2f %%",D)
printf ("average power dissipated in current sourcing is %.3f mW",Pavg/1E-3)
printf ("average power dissipated in current sinking is %.3f mW",Pavg1/1e-3)