B_MAX is being set somewhere else in your code? Or it would be 4095 surely.I added some diagnostics options to the LCD so I could see what's going on and displaying the decimal value for B_MAX Im getting 65535 which would explain the reason why it was ignoring the comparison as B_PWM would have to equal 65535, but why isn't B_MAX equalling 4095 when the value is set to 4095 in the first part of the code?
Bookmarks