You should drop out of the While...wend loop when the button is pushed or if the x variable exceeds 300. AH HA! In your code, X is a byte so never exceeds 255. Either change

(x<300) to (x<253) or change x to a word variable.

X<253 will give you a 2.5 second delay

Duncan