Imho it is not possible to exactly match your design without complete information.
Part of your project is not only the code excerpt you provided, but all the settings for pins, CPU, interrupts and so on.
Best is always to create a project that is able to re-produce the error and upload it here. To do so, use the "Archive Project" feature of Designer 5.3 and upload the resulting .Zip file here using ms Internet Explorer (Not Chrome!! leads to errors).
Forget former post, if interrupt is set to rising edge, the first interrupt will be used to only set the previous value.
I posted this, not a project of mine, as an error I saw in ap note taking
care of another thread. Its for Cypress to fix.
port0_prevValue does not take on a value until an ISR occurs, and then only after it was
tested does it get its first value.
You can blame on me that I did not realize at first that this post was from you or I would have reacted differently. After re-reading I saw that and it came to my mind that especially you wouldn't have asked such a question.