ArmandoCircuitos
Inicio
Electronica
Programacion
Resultado
Codigo
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace Regulador_LM317_01 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } double Vout, Iadj, r1, r2; int a = 0; int b = 0; double[] multiplos = {1, 1000}; private void Form1_Load(object sender, EventArgs e) { cmbR1.SelectedIndex = 0; cmbR2.SelectedIndex = 0; } private void calcular() { r1 = r1 * multiplos[a]; r2 = r2 * multiplos[b]; Iadj = 46 * 0.000001; //46-100uA Vout = 1.25 * (1 + (r2 / r1)) + (Iadj * r2); Vout = Math.Round(Vout,2); lblVo.Text = Vout.ToString() + "V"; if (r1>1000){ r1 = r1 / 1000; lblR1.Text = r1.ToString() + "KΩ"; }else lblR1.Text = r1.ToString() + "Ω"; if (r2 > 1000){ r2 = r2 / 1000; lblR2.Text = r2.ToString() + "KΩ"; }else lblR2.Text = r2.ToString() + "Ω"; } private void cmbR1_SelectedIndexChanged(object sender, EventArgs e) { a = cmbR1.SelectedIndex; } private void cmbR2_SelectedIndexChanged(object sender, EventArgs e) { b = cmbR2.SelectedIndex; } private void button1_Click(object sender, EventArgs e) { r1 = Convert.ToDouble(txtR1.Text); r2 = Convert.ToDouble(txtR2.Text); calcular(); lblSalida.Text = "Vout = " + lblVo.Text; } } }
Descarga del archivo
Descargar archivo