Serial Mishaps


Closed Thread
Results 1 to 3 of 3

Thread: Serial Mishaps

Hybrid View

  1. #1
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    970


    Did you find this post helpful? Yes | No

    Default

    When I try this code and send abcdefgh with MCS serial communicator, I get back ab followed by a bunch of garbage
    Yes of course. Your interrupts should be as short and sweet as possible (ISR = KISS). You are doing time-intensive functions in the interrupt like writing to the LCD. Since you have your data in a SerialData buffer, you should move the LCDout part to your mainline routine. You should also consider taking the RCIF interrupt and exiting after saving to the array. Waiting in the ISR seems to me like a bad idea.

    Another idea worth considering if you want to ruggedize your code is to use DT interrupts or ASM interrupts in place of the ON INTERRUPT of PBP which only branches to the ISR between PBP statements.

  2. #2
    Join Date
    Dec 2004
    Location
    nebraska
    Posts
    79


    Did you find this post helpful? Yes | No

    Default

    Jerson,
    Understand and appreciete what your saying, Lcd should not be down there, however I think if the code worked right I just still receive all 8 bytes of data to my array.
    If I uderstand the code right this.................
    while RCif
    SerialData[index]=RCREG ' load receive buffer into array until RCIF = 0
    Index = Index + 1
    wend
    should load incoming data into the array and not leave the while routine until the buffer rx buffer is empty,am i right or wrong.
    I have also tryed this.....................
    while RCif
    HSERIN [SerialData[index]] ' load receive buffer into array until RCIF = 0
    Index = Index + 1
    wend
    I get The same result nomatter what I do.

Members who have read this thread : 0

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