Oops! It appears that you have disabled your Javascript. In order for you to see this page as it is meant to appear, we ask that you please re-enable your Javascript!

Reply To: Ping pong game in C

Home Forums MPLAB XC8 Project Discussions Ping pong game in C Reply To: Ping pong game in C

#3035

Bitahwa Bindu
Keymaster

In your code you didn’t enable internal pull-up resistors and you are not using external pull-up resistors, how are you going to read the status of the buttons to generate interrupts? You are just connecting them to ground!!! What will drive them high?

You said you are using 2 interrupts, INTO and INT2. INTO is on PORTB0 where you connected one button but INT2 is on PORTB2 and nothing is connected to it, why did you connect your other button to PORTA.5 ? Not all pins have interrupts features, you must only connect your buttons to those pins with interrupts.

What is the purpose of this code: GOTO My_ISR?

You don’t jump to an ISR from your code, and you don’t define an interrupt like that.

This clearly shows that you don’t understand how interrupts work and you said you have already watched the Interrupt video, it shows either you ignored it you didn’t watch it or you did not understand anything in it.

Please learn first how interrupts and how to connect push buttons to PIC before you continue with your project. You can’y jump steps.