Couple of things going on here. First, by using ON INTERRUPT the program can only be interrupted "In-between" PBP statements. With a PAUSE 1, and serial speed of 2400 baud (.4ms per bit), you can easily lose the first 3-bits before the interrupt even occurs.
Second... Even IF you could get to "myint" faster, the start bit is already gone, because that's what would have triggered the interrupt to begin with.
Since you are using a 16F628, it would be better to use the USART. But, if you don't want to do that ...
Send 1 or 2 extra characters before the string you are waiting for to give it time to get to the serin2 statement. i.e. "xxIB"
Also, serin2 mode 396 is 2400 baud, TRUE. Which means that the RS232 signal idles HIGH, so the first bit coming in will be a transition from HIGH to LOW. It may be better to change the INTEDG bit in the OPTION register to 0 so that it interrupts on the "Falling Edge". It defaults to 1. Saves one more "BIT" period.
<br>
Bookmarks