Only heats sometimes

Oster brand microwave heats on and off. Oddly enough it seems to hat better if you enter a larger time (ex: 80 minutes instead of 2 minutes). Any suggestions?

oster microwave won’t heat at all just stopped heating light comes on make noise turn table moves door latches closed