write mode on PLC implemented, wFlag on sql not cleared yet. Write mote to debug