Problem with Serin and On Interrupt


Results 1 to 9 of 9

Threaded View

  1. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    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>
    Last edited by Darrel Taylor; - 11th October 2005 at 21:15.
    DT

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts