Just had a look at the code and something jumped out at me. There was a line that read the data for the stored values from the chip, and this still has the structure for when I was using a Byte for the values. So this was corrupting the values for B_MAX and over-riding the manual values set. Commenting out the gosub read data line and the manual values I had set work. So I can set B_MAX to 3000, 4000 or 4095 and when it reaches these values it trips to the DAY case...

Time to look at that data section later tonight I think