Instead of using a dedicated variable in RAM it's simpler to use the relevant bits in the DWT register.