Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

ECE 103 Engineering Programming Spring 2018 Secondary Exercise B The diode is a

ID: 2291813 • Letter: E

Question

ECE 103 Engineering Programming Spring 2018 Secondary Exercise B The diode is a semiconductor device that allows electric current to pass through it in one direction but blocks the current in the opposite direction. The equation for the diode current I is: kT See: https:llen wikipedia.org/wiki/Diode nV where V 9 I is the diode current (A). Is is the reverse saturation current (A). Vo is the voltage across the diode (V). Vr is the thermal voltage (V). n is the ideality factor (dimensionless). T is the diode temperature (K). Boltzmann constant: k 1.38064852x10 Electron charge: q1.60217662x10-19 C Requirements Write a C program that calculates the diode current for a given Vo and T. For this problem, you may assume that Is = 2.5×1012 A and n 1.7 . Prompt the user to enter the diode voltage Vo (in V) and the temperature T (in K). . Calculate and display the diode current I For practice, define Is, n, k, and q as constant variables of type double .Display your calculated result to at most two (2) decimal places. Hint: To match the sample output, consider using the %g option. Save your program using this filename: hw2b.c

Explanation / Answer

/******************************************************************************

Online C Compiler.
Code, Compile, Run and Debug C program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <stdio.h>
#include<math.h>
#include<float.h>

int main()

{
double temp,diodeVoltage,VT;
double k = 1.3864852e-23,q = 1.60217662e-19;
double Is = 2.5e-12, n = 1.7,I;
printf("Enter the diode temperature (k) : ");
scanf("%d",&temp);
printf("Enter the diode voltage (V) : ");
scanf("%d",diodeVoltage);
VT = k*temp/q;
I = Is*(exp(diodeVoltage/(n*VT))-1);
printf("Diode Current I = %g",I);
return 0;
}