Versuchs doch mal mit
do
toggle portd.5
waitms 300
loop

Dann passiert auf jeden Fall immer was, egal wierum die LED angeklemmt ist...