HP Forums
Calculate RL resistor for LEDs diodes - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: HP Prime Software Library (/forum-15.html)
+--- Thread: Calculate RL resistor for LEDs diodes (/thread-274.html)



Calculate RL resistor for LEDs diodes - ArielPalazzesi - 12-29-2013 07:56 PM

Hello!

I leave the link to a small program I wrote to calculate the current limiting resistor for a given number of LED diodes in series.

http://www.ucontrol.com.ar/forosmf/tutoriales-guias-y-cursos-en-ucontrol/calculo-de-resistencia-limitadora-para-leds-en-serie-con-hp-prime/msg82727/#msg82727

It's in Spanish, but if you think you need someone can translate it to English language.
I hope you find it useful.

[Image: ?action=dlattach;attach=16081][Image: ?action=dlattach;attach=16083][Image: ?action=dlattach;attach=16079]

Code:

EXPORT resistencia_led()
BEGIN

//Declaro variables:
local RL, VLED, NLED, ILED,VCC,POT;
local lista1, lista2;

lista1 := {"Vcc:", "VLED:", "ILED:","nLED:"};
lista2 := {"Tensión de la fuente (V)","Tensión del LED (V)","Corriente del LED (A)","Número de LEDs conectados en serie"};

INPUT ({VCC,VLED, ILED,NLED},"Cálculo resistencia limitadora (Ohms)",lista1, lista2);

RL := (VCC-VLED*NLED)/ILED;

IF RL<0 THEN
  MSGBOX("El número de LEDs excede la tensión de la fuente.");
ELSE
  POT := (ILED^2)*RL;
  RL := ROUND(RL,0);
  POT := ROUND(POT,1);
  print (RL);
  print (POT);
  MSGBOX("La resistencia limitadora debe ser de "+ RL +" Ohm(s) y al menos " + POT+ " Watt(s).");
END;

END;


Greetings.