HSerin waits indefinetely


+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2005
    Posts
    35

    Default HSerin waits indefinetely

    Hi,

    Noted a issue with using either the HSerin or the serin command, if the pin associated RX is held low (which could occur if the RX pin is open circuit), the wait command of HSerin will wait indefinetely until the pin returns to a high state or a character is received.
    Solved this by using a pull up resistor on the RX pin, but looking for a more robust solution that regardless of the state of the RX pin, the microprocessor will continue to operate.
    Haven't testes this as yet but I've since found a possible way around this issue is to use check the state of PIR1.5 before executing the HSERIN command.
    Any other suggestions?


    Thanks,

    Rob.

  2. #2
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,970


    Did you find this post helpful? Yes | No

    Default Re: HSerin waits indefinetely

    Software will stay in the waiting state.

    Hserin will not. Also you can use the timout parameter and after a predefined time (in ms) it will jump to a label if something is wrong.

    Ioannis

  3. #3
    Join Date
    Nov 2005
    Posts
    35


    Did you find this post helpful? Yes | No

    Default Re: HSerin waits indefinetely

    Thanks Ioannis,


    My setup is as follows:
    DEFINE HSER_RCSTA 90h
    DEFINE HSER_TXSTA 24h
    INTCON = 0
    DEFINE HSER_CLROERR 1
    HSERIN 1000,nodata,[datareceived]

    If the RX input pin has held low it would not break out from waiting.
    It doesn't make sense why it's not jumping out of the wait state aas the HSERIN is reading the buffer as opposed to serin is bit banging.
    Anyway if you state it does break out regardless of the pin state, I'll double check my code again tomorrow morning.

    Rob.

  4. #4
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,970


    Did you find this post helpful? Yes | No

    Default Re: HSerin waits indefinetely

    The plus in using the hardware USART instead of the software Serin/Serin2 is that it does not hang there if there is a problem in the state since the hardware reads based on an internal clock. If data is at 0 or at 1, then the data read is just nonsense.

    More, the ardware USART does have 2 bytes buffer and Interrupt support.

    Your code would jump to the label nodata after 1 sec, if there is no communication on the Rx line. What nodata does, I do not know. Please show your complete code.

    Ioannis

Similar Threads

  1. HSerin
    By GatorGuy in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 14th October 2011, 05:04
  2. hserin
    By jcleaver in forum mel PIC BASIC Pro
    Replies: 28
    Last Post: - 21st February 2007, 18:15
  3. Hserin
    By Christopher4187 in forum General
    Replies: 3
    Last Post: - 20th March 2006, 23:09
  4. Hserin
    By MICOCALI in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 22nd May 2005, 09:09
  5. Hserin
    By egberttheone in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 27th November 2004, 15:42

Members who have read this thread : 7

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