help me please


Closed Thread
Results 1 to 20 of 20

Thread: help me please

  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

  7. #7
    MICOCALI's Avatar
    MICOCALI Guest


    Did you find this post helpful? Yes | No

    Default re

    I write:
    HSERIN 2000,LOOP,[WAIT("*e")]
    but not run
    I connect the pic with two resistore of 4,7 kohm direct at the phone if possible is this? not max 232

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


    Did you find this post helpful? Yes | No

    Default

    Does your phone output RS232 or TTL level voltage?

    Does your phone send serial data inverted or true?
    Regards,

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

  9. #9
    MICOCALI's Avatar
    MICOCALI Guest


    Did you find this post helpful? Yes | No

    Default i think

    but is not important because the command Hserout is run very well i think

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


    Did you find this post helpful? Yes | No

    Default

    It definitely "is" important if you want your PIC to communicate
    with or receive serial data from your phone.
    Regards,

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

  11. #11
    MICOCALI's Avatar
    MICOCALI Guest


    Did you find this post helpful? Yes | No

    Default ok

    I have ericsson 9600/8/n/1

  12. #12
    MICOCALI's Avatar
    MICOCALI Guest


    Did you find this post helpful? Yes | No

    Default supposed

    I supposed TTL level voltage can you teach me what is the method

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


    Did you find this post helpful? Yes | No

    Default

    Sorry I don't know anything about this phone.

    When you connect the phone to your PC to verify it's sending
    data to hyperterminal, how are you connecting the phone to
    your PC serial port?

    When you connect your phone to the PIC, how are you making
    this connection?
    Regards,

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

  14. #14
    MICOCALI's Avatar
    MICOCALI Guest


    Did you find this post helpful? Yes | No

    Default re

    I connect phone with hyper... with convertitor rs 232 ttl (max 232 ) and
    i set Hyper.. with 9600 8 N 1
    but when i send command at+cmss=1 the phone send message very well
    WY for you

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


    Did you find this post helpful? Yes | No

    Default

    OK, but how are you connecting the phone to your PIC?
    Regards,

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

  16. #16
    MICOCALI's Avatar
    MICOCALI Guest


    Did you find this post helpful? Yes | No

    Default re

    direct with two resistor

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


    Did you find this post helpful? Yes | No

    Default

    Miiiiiiiiiip this is why. you must still use the Max232 ic to invert the serial data. OR, but it bet that will not work 100%, use serin/serout in inverted mode.
    Steve

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

  18. #18
    MICOCALI's Avatar
    MICOCALI Guest


    Did you find this post helpful? Yes | No

    Default re

    the bit 14 is the register for setting the serial comunication at inverted mode but wich is the parameter for setting 9600 baud,no parity ,inverted.
    For example mode=84 is 9600,no parity,true
    thank you.
    where is if possible search this parameter ,because i search in the data sheet but i dont watch never

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


    Did you find this post helpful? Yes | No

    Default

    so now it imply that you use SERIN2/SEROUT2 or else. chances are that you'll never find anything in the datasheet since it's a PBP statement. You'll find the result in the APPENDIX A at the end of your PBP manual... there you'll find the right setting for SERIN2/SEROUT2 wich is.....16468

    For SERIN/SEROUT you'll use 6

    You can't tell to HSERIN/HSEROUT to drive inverted since it use the internal PIC hardware.
    Steve

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

  20. #20
    MICOCALI's Avatar
    MICOCALI Guest


    Did you find this post helpful? Yes | No

    Default re

    I write this code and now run but not very well . sometime run at first ring , sometime run at five ring , wy for you?
    '************************************************* ******************************
    @ device WDT_OFF, MCLR_OFF, HS_OSC, BOD_OFF, PWRT_ON, CPD_OFF, LVP_OFF
    '************************************************* ******************************
    INCLUDE "modedefs.bas"
    DEFINE OSC 4
    DEFINE HSER_RCSTA 90h
    DEFINE HSER_TXSTA 24h
    DEFINE HSER_BAUD 9600
    DEFINE HSER_CLROERR 1
    DEFINE DEBUGIN_MODE 1
    DEFINE DEBUG_MODE 1
    DEFINE DEBUGIN_REG PORTB
    DEFINE DEBUGIN_BIT 4

    CMCON = 7
    VRCON = 0

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

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

    Loop2

    DebugIn [wait("*")]

    APRI:
    High PORTA.1
    Pause 1000
    Low PORTA.1
    Pause 10000
    GoTo LOOP


    End

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