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: 2291824 • 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

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

You need to declare the variables as float.
scanf is used for the user input.
print is used for printing the output.
for float %f is used.

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

#include <stdio.h>

int main()
{
float V, T, I, Vt;
float Is = 2.5e-12, n=1.7, k=1.38064852e-23, q=1.60217662e-19;

printf("Enter the diode temperature (K): ");
scanf("%f", &T);
printf("Enter the diode voltage (V): ");
scanf("%f", &V);
Vt = k*T/q;
I = Is*(exp(V/(n*Vt))-1);
  
printf(" Diode current I = %0.2g A", I);

return 0;
}