Hallo,

> l_sensor alias porta.1
> [...]
> if l_sensor=1 then

Du liest nicht den Pin sondern das Output-Latch.
"I_sensor alias pinA.1"

Ciao,
Werner