HTML LED Vorwiderstands berechnungs Prog.


  • el_diabolo
  • 716 Aufrufe 0 Antworten

Diese Seite verwendet Cookies. Durch die Nutzung unserer Seite erklären Sie sich damit einverstanden, dass wir Cookies setzen. Weitere Informationen

  • HTML LED Vorwiderstands berechnungs Prog.

    Durch Verwendung eines richtig dimensionierten Vorwiderstandes stellt sich die passende LED-Betriebsspannung von selbst ein.
    und Die LED`s werden nicht Beschädigt.
    -----------------------------------------------------------------------------------------------------


    1. Alles markieren Kopieren
    2. Neue htm datei erstellen
    3. einfügen
    4. speichern
    5. starten :)

    Ergebnis : (Beispiel)


    HTML-Quellcode

    1. <html>
    2. <head>
    3. <body bgcolor="#EAEDF4">
    4. <base target="_self">
    5. <title>Vorwiderstands berechnung</title>
    6. </head>
    7. <SCRIPT type="text/javascript">
    8. function findResistance(){
    9. var Vs = Number(document.led.Vs.value);
    10. var Vf = Number(document.led.Vf.value);
    11. var Id = Number(document.led.Id.value);
    12. if (Vs < 3) {
    13. alert ("Es müssen mehr als 3V Eingansspannung herschen.");
    14. return;
    15. }
    16. if (Vs > 24) {
    17. alert ("Es gibt keinen Widerstand für LED's bei einer Eingangsspannung von mehr als 24V");
    18. return;
    19. }
    20. if (Vf > Vs) {
    21. alert ("Die Eingegeben LED Referenzspannung ist zu hoch");
    22. return;
    23. }
    24. if (Vf < 1.6) {
    25. alert ("Die Eingegeben LED Referenzspannung ist zu niedrig");
    26. return;
    27. }
    28. if (Id < 5) {
    29. alert("Die Eingegeben LED Referenzspannung ist zu niedrig");
    30. return;
    31. }
    32. st = new Array(1.0, 1.2, 1.5, 1.8, 2.2, 2.7, 3.3, 3.9, 4.7, 5.6, 6.8, 8.2, 10, 12, 15, 18, 22, 27, 33, 39, 47, 56, 68, 82, 100, 120, 150, 180, 220, 270, 330, 390, 470, 560, 680, 820, 1000, 1200, 1500, 1800, 2200, 2700, 3300, 3900, 4700, 5600, 6800, 8200, 10000);
    33. color = new Array('braun schwarz gold', 'braun rot gold', 'braun grün gold', 'braun grau gold', 'rot rot gold', 'rot violet gold', 'orange orange gold', 'orange weiß gold', 'gelb violet gold', 'grün blau gold', 'blau grau gold', 'grau rot gold', 'braun schwarz schwarz', 'braun rot schwarz', 'braun grün schwarz', 'braun grau schwarz', 'rot rot schwarz', 'rot violet schwarz', 'orange orange schwarz', 'orange weiss schwarz', 'gelb violet schwarz', 'grün blau schwarz', 'blau grau schwarz', 'grau rot schwarz', 'braun schwarz braun', 'braun rot braun', 'braun grün braun', 'braun grau braun', 'rot rot braun', 'red violet braun', 'orange orange braun', 'orange weiss braun', 'gelb violet braun', 'grün blau braun', 'blau grau braun', 'grau rot braun', 'braun schwarz rot', 'braun rot rot', 'braun grün rot', 'braun grau rot', 'rot rot rot', 'rot violet rot', 'orange orange rot', 'orange weiss rot', 'gelb violet rot', 'grün blau rot', 'blau grau rot', 'grau rot rot', 'braun schwarz orange');
    34. actualR = (1000*(Vs-Vf)/(Id));
    35. for (i=0;i<48;i++){
    36. if (Math.max(st[i],actualR) == st[i]) {
    37. closestR = st[i];
    38. colorR = color[i];
    39. break;
    40. }
    41. }
    42. actualI = (Vs-Vf)/(closestR)
    43. document.led.R1.value = (Math.round(10*actualR)/10);
    44. document.led.R2.value = closestR;
    45. document.led.color.value = colorR;
    46. document.led.P1.value = Math.round(1000 * actualI * Vf);
    47. document.led.P2.value = Math.round(1000*(Vs-Vf)*(Vs-Vf)/closestR);
    48. closestR = 0;
    49. } </SCRIPT>
    50. <FORM name="led">
    51. <TABLE width="57%" border="0" cellpadding="0" cellspacing="0" height="1" style="border-collapse: collapse" bordercolor="#111111" align="left">
    52. <TBODY>
    53. <TR>
    54. <TD height="1" width="259">
    55. <u><i><b>
    56. <font face="Verdana" size="4" color="#C0C0C0">LED - </font></b></i>
    57. <b><i><font face="Verdana" size="4" color="#C0C0C0">
    58. Vorwiderstandsrechner</font></i></b></u><TD height="1" width="175">
    59. <TR>
    60. <TD height="1" width="259">
    61. <TD height="1" width="175">
    62. <TR>
    63. <TD height="1" width="259">
    64. <TD height="1" width="175">
    65. <TR>
    66. <TD height="1" width="259">
    67. <font face="Verdana" size="1">Eingangsspannung</font><TD height="1" width="175">
    68. <font color="#FFFFFF" size="1" face="Verdana">
    69. <INPUT name="Vs" size="5"></font><font size="1" face="Verdana">
    70. <b>V</b> [3-24 V]</font><TR>
    71. <TD height="1" width="259">
    72. <font face="Verdana" size="1">LED Referenzspannung</font><TD height="1" width="175">
    73. <font color="#FFFFFF" size="1" face="Verdana">
    74. <INPUT name="Vf" size="5"></font><font size="1" face="Verdana"><b>
    75. V</b> [2-4 V]</font><TR>
    76. <TD height="1" width="259">
    77. <font face="Verdana" size="1">LED Referenzsstrom</font><TD height="1" width="175">
    78. <font color="#FFFFFF" size="1" face="Verdana">
    79. <b>
    80. <INPUT name="Id" size="5"></b></font><font size="1" face="Verdana"><b>
    81. mA</b> [10-50 mA]</font><TR>
    82. <TD height="1" width="259">
    83. <font size="1" face="Verdana">&nbsp; </font>
    84. <TD height="1" width="175">
    85. <font color="#FFFFFF" size="1" face="Verdana">
    86. <INPUT name="button" type="button" onClick="findResistance()" value="Berechnen"></font><font size="1" face="Verdana">
    87. </font>
    88. <TR>
    89. <TD height="1" width="259">
    90. <hr color="#eaeaea" SIZE="1">
    91. <TD height="1" width="175">
    92. <hr color="#eaeaea" SIZE="1">
    93. <TR>
    94. <TD height="1" width="259">
    95. <font face="Verdana" size="1">Benötigter Widerstand</font><TD height="1" width="175">
    96. <font color="#FFFFFF" size="1" face="Verdana">
    97. <INPUT name="R1" size="5"></font><font size="1" face="Verdana">
    98. <b>Ohm</b></font><TR>
    99. <TD height="1" width="259">
    100. <font face="Verdana" size="1">Nächste Widerstandsgröße</font><TD height="1" width="175">
    101. <font color="#FFFFFF" size="1" face="Verdana">
    102. <INPUT name="R2" size="5"></font><font size="1" face="Verdana">
    103. <b>Ohm</b></font><TR>
    104. <TD height="1" width="259">
    105. <font face="Verdana" size="1">Widerstandsfarbe</font><TD height="1" width="175">
    106. <font color="#FFFFFF" size="1" face="Verdana">
    107. <INPUT name="color" size="25"></font><font size="1" face="Verdana">&nbsp;
    108. <TR>
    109. <TD height="1" width="259">
    110. <font face="Verdana" size="1">Verlustleistung der LED</font><TD height="1" width="175">
    111. <font color="#FFFFFF" size="1" face="Verdana">
    112. <INPUT name="P1" size="5"></font><font size="1" face="Verdana">
    113. <b>mW</b></font><TR>
    114. <TD height="1" width="259">
    115. <font face="Verdana" size="1">Verlustleitung des Widerstandes</font><TD height="1" width="175">
    116. <font color="#FFFFFF" size="1" face="Verdana">
    117. <INPUT name="P2" size="5"></font><font size="1" face="Verdana">
    118. <b>mW</b></font></TBODY>
    119. </TABLE>
    120. </FORM>
    121. </body>
    122. </html>
    Alles anzeigen