You need add a memory variable and compare the value now to the memory. If different do some action and then copy now value to the memory variable
This is very generic and the syntax is Allen Bradly
if variable <> mem_variable then
output := 1;
mem_variable := variable;
else
output := 0;
end_if;
I'm not sure if this is what you are after?
Steve