Serialin timeout


Closed Thread
Results 1 to 6 of 6
  1. #1
    Nick's Avatar
    Nick Guest

    Default Serialin timeout

    Hi Team,

    I’m using PBP 2.45a and I’m trying to get a PIC 16F628
    to do some LED blinking and then go in stand by until it
    receives an “OK” on the serial in or a large timeout goes by.
    I’m using variable index to control this timeout.
    This is how I thought of doing it but it does not seem to work (at list the
    timeout part). After the initial shot on power ON it just hangs up and does nothing.

    Code:

    INCLUDE "bs2defs.bas"
    @ device pic16F628, intrc_osc, wdt_on, pwrt_on,mclr_off,protect_off



    red VAR PORTB.4
    green VAR PORTB.5
    serial_in VAR PORTB.0
    password VAR BYTE
    index VAR BYTE

    cmcon=7
    TRISB=%10000001
    Pause 1000

    loop:
    index=0
    High red
    Pause 500
    High green
    Pause 500
    Low red
    Pause 500
    Low green

    main_loop:
    index=index+1
    SerIn serial_in,T2400,100,again,["O"],password
    IF password="K" Then
    GoTo loop
    Else
    again:
    IF index>99 Then
    GoTo loop
    Else
    GoTo main_loop
    EndIF
    EndIF

    End
    Any ideas what I’m doing wrong?
    Thank you for your attention.

  2. #2
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    762


    Did you find this post helpful? Yes | No

    Default

    Nick,

    since you haven't told us which device is sending the "OK"
    and I don't know what your schematic looks like,
    all I can do is guessing.

    It Looks like your SERIN never times out.
    are you sure T2400 is the correct mode?
    Try N2400.

    Search the board for SERIN or SERIN2 you'll find many examples.
    regards

    Ralph

    _______________________________________________
    There are only 10 types of people:
    Those who understand binary, and those who don't ...
    _______________________________________________



  3. #3
    Nick's Avatar
    Nick Guest


    Did you find this post helpful? Yes | No

    Default

    Hi Ralph,
    Thank you for your input
    I'm using an other PIC to send the "OK" with the Serout T2400 mode.
    This part works.
    I'm having problems with the SerIn timeout only.
    I will also try the search.

  4. #4
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Also look to your config fuse... there's a error. You should use MCLRE_OFF instead or tie your MCLR pin to VDD
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  5. #5
    Nick's Avatar
    Nick Guest


    Did you find this post helpful? Yes | No

    Default

    Thanks Team.
    I made the suggested changes and some resoldering and it all works now.
    Thank you again.

  6. #6
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    You're welcome.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

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. Need help with timeout
    By Christopher4187 in forum General
    Replies: 1
    Last Post: - 10th June 2006, 15:38
  4. 16F628A Serin timeout and Timer1
    By Rubicon in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 26th March 2006, 23:20
  5. SERIN & Timeout
    By BigWumpus in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 30th October 2004, 07:33

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