use write_reg()