That's what the resistor is there for, it's basic Ohms law (look it up if you don't know about it, it's fundamental in electronics)
The PIC outputs 5V, the forward voltage of the LED is 1.5V at 10mA. So you need to drop 3.5V across the resistor when 10mA flows thru it.
R=U/I or 3.5V/0.01A=350Ohm. For a LED this is not at all critical, a 220Ohm resistor will work and so will a 680Ohm resistor.
EDIT: Oh, another thing that might confuse you. LEDs (being diodes basically) are highly non linear, they're not meant to be driven by a low impedence voltage source. They are current driven devices and the Vf figure is the voltage that is being dropped across the LED at a specified current.
Bookmarks