help me please


Closed Thread
Results 1 to 20 of 20

Thread: help me please

Hybrid View

  1. #1
    MICOCALI's Avatar
    MICOCALI Guest

    Default help me please

    i write this code
    but the program run in loop why


    '************************************************* ******************************
    @ device WDT_OFF, MCLR_OFF, HS_OSC, BOD_OFF, PWRT_ON, CPD_OFF, LVP_OFF
    '************************************************* ******************************
    INCLUDE "modedefs.bas"
    DEFINE OSC 20
    DEFINE HSER_RCSTA 90h
    DEFINE HSER_TXSTA 24h
    DEFINE HSER_BAUD 9600
    DEFINE HSER_CLROERR 1

    CMCON = 7
    VRCON = 0



    ' ************************************************** ****************************
    INIT:
    Pause 2000

    LOOP:
    Pause 500
    HSerout ["AT*EIPS=1,1",13]
    Pause 500

    HSerin 2000,APRI,[WAIT ("*ELIP:")]

    APRI:
    High PORTB.4
    Pause 1000
    Low PORTB.4
    Pause 15000
    GoTo LOOP


    End

  2. #2
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Goto Loop causes your program to run in a continuous loop.

    This line; HSerin 2000,APRI,[WAIT ("*ELIP:")] will WAIT for 2 seconds,
    then jump to the APRI sub-routine if ASCII chars *ELIP: are not received
    within the timeout period.

    Execution will also "fall-through" to APRI even if these characters "are"
    received - so you have a continuous loop no matter what happens.

    If you prefer to only enter the APRI sub-routine once these characters
    are received, then change the timeout "label" from APRI to Loop.
    Code:
    INIT:
       Pause 2000
    
    LOOP: 
       Pause 500
       HSerout ["AT*EIPS=1,1",13]
       Pause 500
    
       HSerin 2000,LOOP,[WAIT ("*ELIP:")]
    
    APRI: ' Land here only when characters are received.
       High PORTB.4
       Pause 1000
       Low PORTB.4
       Pause 15000
       Goto LOOP
    Or or use a local label something like this;
    Code:
    INIT:
       Pause 2000
    
    LOOP: 
       Pause 500
       HSerout ["AT*EIPS=1,1",13]
       Pause 500
    
    Loop2: ' Loop to here until characters are received
       HSerin 2000,Loop2,[WAIT ("*ELIP:")]
    
    APRI: 
       High PORTB.4
       Pause 1000
       Low PORTB.4
       Pause 15000
       Goto LOOP
    Last edited by Bruce; - 24th May 2005 at 19:28.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  3. #3
    MICOCALI's Avatar
    MICOCALI Guest


    Did you find this post helpful? Yes | No

    Default a problem

    thank you for reply but i have one problem:

    HSerin 2000,LOOP,[WAIT ("*ELIP:")] is true when i receve all caracter?(*elip

    if yes what is the command for receve only two caracter for example *e
    thank you carlo

  4. #4
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    HSerin 2000,LOOP,[WAIT ("*ELIP:")] is going to wait until *ELIP: is received.
    If *elip: (note it's in lower case) is received, it will not match.

    If you need to wait for 2 characters, then only use 2 characters.

    HSerin 2000,LOOP,[WAIT ("*E")]
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  5. #5
    MICOCALI's Avatar
    MICOCALI Guest


    Did you find this post helpful? Yes | No

    Default not run

    the telefone send *elip i confirm with hyper terminal ,i write
    HSerin 2000,LOOP,[WAIT ("*E")] in the pic 16f628 but the pin portb4 not
    on.
    wy for you?

  6. #6
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    the telefone send *elip i confirm with hyper terminal

    If you are seeing *elip in hyperterminal, then wait for *e. Not *E.

    i write HSerin 2000,LOOP,[WAIT ("*E")]


    Have you tried this?

    HSERIN 2000,LOOP,[WAIT("*e")]
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

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