Vous êtes sur la page 1sur 3

MODELING OF MOSFET USING C

#include<stdio.h>

#include<conio.h>

#include<math.h>

void main ()

float w=0.125,l=0.375,vtp=-0.63025,vtn=0.622490,tox=225.00e-10,Eox=8.85e-14,Ein=4,un=650,up=240;

float vgs,vds,ids,b1,b2,k1,k2;

int choice;

k1=(Ein * Eox * un)/tox;

k2=(Ein * Eox * up)/tox;

b1=k1* (w/l);

b2=k2 * (w/l);

clrscr();

printf("enter the values of vgs,vds");

scanf("%f,%f",&vgs,&vds);

printf("enter your choice for nmos(0) or pmos(1)");

scanf("%d",&choice);

switch (choice)

case 0:

if(vgs<vtn)

{
ids=0;

printf("the mosfet is in cutoff and the value of ids is %f",ids);

if(((vgs-vtn)>vds) && (vds>0))

ids=b1*(((vgs-vtn)* vds)-(vds * vds)/2);

printf("the mosfet is in linear and the value of ids is %f", ids);

if((vds>vgs-vtn) && (vgs>vtn))

ids=( b1/2)*((vgs-vtn)*(vgs-vtn));

printf("the mosfet is in saturation and value of ids is %f", ids);

break;

case 1:

if(vgs<vtp)

ids=0;

printf("the mosfet is in cutoff and the value of ids is %f",ids);

if(((vgs-vtp)>vds) && ( vds>0))

ids= (b2*(((vgs-vtp)*vds)- (vds * vds)/2));


printf("the mosfet is in linear and the value of ids is %f",ids);

if( vds>(vgs-vtp))

ids= (b2/2) * (( vgs- vtp) * (vgs-vtp));

printf(" the mosfet is in saturation and the value of ids is %f", ids);

Vous aimerez peut-être aussi