Write and erase mechanism of surface controlled bistable nematic pixel