How to use writememh in a sequence

You probably declare the memory as static.