Need help with timeout


Closed Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2005
    Location
    New Jersey
    Posts
    425

    Default Need help with timeout

    I have RTFM about serin2 and I think I need a timeout function. The program works fine but if I the communication is lost for a second, the program locks up. I think I need a timeout but it is not fully explained in the manual. When the program "locks" up (I think it's just getting stuck at the serin2 part), I have to cycle the power on the PIC or reload the program and then it's OK. I have searched this forum for related topics and I found some but I am lost. If I was communicating PIC to PIC I would be fine but I am communicating with the Parallax PINK.

    ------------------------code--------------------------------------------

    @ DEVICE PIC16F876, HS_OSC, WDT_On, PWRT_ON, BOD_on, LVP_OFF , DEBUG_OFF, PROTECT_OFF
    define OSC 20
    low portc.3

    PAUSE 1000
    HIGH PORTB.5
    PAUSE 10
    LOW PORTB.5
    TRISC= %00100000
    ADCON1=7
    X VAR BYTE
    X=0

    NBVAR VAR BYTE
    LCD VAR PORTC.5

    MAINLOOP:

    SEROUT2 PORTC.7,396,["!NB0R03"]

    SERIN2 PORTC.6,396,[dec NBVAR]

    serout2 lcd,16468,[254,1," VARIABLE #3: ", DEC nbvar]
    if nbvar=11 then
    HIGH PORTB.5
    ELSE
    LOW PORTB.5
    endif

    GOTO MAINLOOP

  2. #2
    Join Date
    Oct 2005
    Location
    New Jersey
    Posts
    425


    Did you find this post helpful? Yes | No

    Default Found it!

    Nevermind. I found a post from BobK on the 30th of January and his line of code worked perfect!

    SERIN2 serpin,36081,300,Main,[Wait ("A"),dec3 B7]

    Thanks!

Similar Threads

  1. Serin2 Timeout
    By tazntex in forum Serial
    Replies: 15
    Last Post: - 15th August 2008, 15:40
  2. SERIN Timeout
    By George in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 23rd March 2007, 15:06
  3. 16F628A Serin timeout and Timer1
    By Rubicon in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 26th March 2006, 23:20
  4. Serial Port Timeout
    By isaac in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 2nd July 2005, 19:05
  5. Serialin timeout
    By Nick in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 18th April 2005, 15:21

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