Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
Everything about electronics
Everything about electronics
.calculator-container {
max-width: 600px;
margin: 40px auto;
padding: 20px;
border: 2px solid #ccc;
border-radius: 12px;
background-color: #f9f9f9;
font-family: Arial, sans-serif;
}
.calculator-container h2 {
text-align: center;
margin-bottom: 5px;
}
.calculator-container p {
text-align: center;
font-size: 14px;
margin-bottom: 20px;
}
.full-calc-box {
padding: 15px;
border: 2px solid #aaa;
border-radius: 12px;
background-color: #fff;
}
.calc-group {
margin-bottom: 30px;
padding: 15px;
border: 1px solid #ddd;
border-radius: 10px;
background: #fdfdfd;
}
.calc-group h3 {
text-align: center;
margin-bottom: 15px;
}
.form-row {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 12px;
}
.form-row label {
flex: 1;
}
.form-row input, .form-row select {
flex: 2;
padding: 6px;
margin-left: 10px;
}
.form-buttons {
text-align: center;
margin-top: 15px;
}
.form-buttons button {
padding: 8px 18px;
margin: 5px;
font-size: 14px;
border-radius: 6px;
border: none;
background-color: #3498db;
color: white;
cursor: pointer;
}
Calculate output voltage and gain for a differential amplifier based on resistor values and input voltages.
Ω
kΩ
MΩ
Ω
kΩ
MΩ
V
mV
V
mV
V
mV
Ω
kΩ
MΩ
Ω
kΩ
MΩ
function calcDiffVout() {
let r1 = parseFloat(document.getElementById(“diff_r1”).value);
let rfu = parseFloat(document.getElementById(“diff_rf_unit”).value);
let r1u = parseFloat(document.getElementById(“diff_r1_unit”).value);
let rf = parseFloat(document.getElementById(“diff_rf”).value);
let v1 = parseFloat(document.getElementById(“diff_v1”).value);
let v1u = parseFloat(document.getElementById(“diff_v1_unit”).value);
let v2 = parseFloat(document.getElementById(“diff_v2”).value);
let v2u = parseFloat(document.getElementById(“diff_v2_unit”).value);
let vout = parseFloat(document.getElementById(“diff_vout”).value);
let voutu = parseFloat(document.getElementById(“diff_vout_unit”).value);
r1 = isNaN(r1) ? null : r1 * r1u;
rf = isNaN(rf) ? null : rf * rfu;
v1 = isNaN(v1) ? null : v1 * v1u;
v2 = isNaN(v2) ? null : v2 * v2u;
vout = isNaN(vout) ? null : vout * voutu;
if (r1 && rf && v1 != null && v2 != null && vout == null) {
const gain = rf / r1;
const output = gain * (v2 – v1);
document.getElementById(“diff_vout”).value = (output / voutu).toFixed(3);
} else {
alert(“Please leave Vout field empty to calculate it.”);
}
}
function clearDiffVout() {
[“diff_r1”, “diff_rf”, “diff_v1”, “diff_v2”, “diff_vout”].forEach(id => document.getElementById(id).value = “”);
}
function calcDiffGain() {
let r1 = parseFloat(document.getElementById(“diff_g_r1”).value);
let rf = parseFloat(document.getElementById(“diff_g_rf”).value);
let r1u = parseFloat(document.getElementById(“diff_g_r1_unit”).value);
let rfu = parseFloat(document.getElementById(“diff_g_rf_unit”).value);
let gain = parseFloat(document.getElementById(“diff_gain”).value);
r1 = isNaN(r1) ? null : r1 * r1u;
rf = isNaN(rf) ? null : rf * rfu;
if (r1 && rf && !gain) {
document.getElementById(“diff_gain”).value = (rf / r1).toFixed(3);
} else if (gain && r1 && !rf) {
document.getElementById(“diff_g_rf”).value = ((gain * r1) / rfu).toFixed(3);
} else if (gain && rf && !r1) {
document.getElementById(“diff_g_r1”).value = ((rf / gain) / r1u).toFixed(3);
} else {
alert(“Please leave one field blank to calculate it.”);
}
}
function clearDiffGain() {
[“diff_g_r1”, “diff_g_rf”, “diff_gain”].forEach(id => document.getElementById(id).value = “”);
}
(adsbygoogle = window.adsbygoogle || []).push({});