Changing port direction during runtim - RL78

Hello,

Initially, the pin is configured as input by Code generator

During runtime, I want to change it output using this code:

PM1 |= _00_PMn4_MODE_OUTPUT;

But I am not able to control the pin after that.

If the pin is initially configured as output, It works as expected.

Any idea?

Thank you