Hserin/hserout ?


Closed Thread
Results 1 to 7 of 7
  1. #1
    Scott's Avatar
    Scott Guest

    Default Hserin/hserout ?

    What is wrong with the following code?

    HSEROUT ["AT+CGDCONT=1", 34, "IP", 34, ",", 34, "myserver.address", 34,13,10,13,10,13,10] ' 34 is for "
    HSERIN 5000, setup, [WAIT("OK")]

    I am able to check the device I am communicating with using HyperTerminal. I am able to get the CONNECT back from the device.

    I am using a PIC16F876A with an RS-232 driver. PORTC.6 is my TX and PORTC.7 is my RX.

    Thanks for your help,
    Scott

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Scott
    I am able to check the device I am communicating with using HyperTerminal. I am able to get the CONNECT back from the device.
    Since it looks like you're able to do everything... what's the problem?

    are you really use Hyperterminal? OH MY GOD another victim of this crap software!

    have you try with MicroCode Studio in the serial communication window?
    Last edited by mister_e; - 27th April 2005 at 03:44.
    Steve

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

  3. #3
    Scott's Avatar
    Scott Guest


    Did you find this post helpful? Yes | No

    Default

    I have this working with another board using Serin/Serout no problem. Once I tried my new hardware that is setup with the USART pins C6 and C7 it does not work. My hardware has a DB15HD that is to connect to my modem I cannot connect directly to my PC.

    Another question: Can I use Serin/Serout and not Hserin/Hserout on the USART pins C6 and C7?

    I use hyperterminal to debug the modem not my hardware.

    Thanks

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


    Did you find this post helpful? Yes | No

    Default

    for sure you can use serin/serout on those pins. But if you send us your code or a snip with your DEFINE, TRIS and others, we can help you to make it work
    Steve

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

  5. #5
    Scott's Avatar
    Scott Guest


    Did you find this post helpful? Yes | No

    Default

    Here is some of my code:

    ' Setup Crystal Frequency in mHz
    DEFINE OSC 20 ' Set Xtal Frequency

    ' Setup Auto Epic Settings
    @ DEVICE PIC16F876A
    @ DEVICE HS_OSC ' System Clock Options
    @ DEVICE WDT_OFF ' Watchdog Timer
    @ DEVICE PWRT_OFF ' Power-On Timer
    @ DEVICE BOD_OFF ' Brown-Out Detect
    @ DEVICE LVP_OFF ' Low-Voltage Programming
    @ DEVICE CPD_OFF ' Data Memory Code Protect
    @ DEVICE PROTECT_OFF ' Program Code Protection

    ' Setup Hardware for uart
    DEFINE HSER_BAUD 9600
    DEFINE HSER_RCSTA 90h
    DEFINE HSER_TXSTA 24h
    DEFINE HSER_SPBRG 129
    DEFINE HSER_CLROERR 1 ' automatic clear the overflow

    TRISC.6 = 0
    TRISC.7 = 1

    ipaddress var byte[15]

    'Setup Modem for No Flow Control
    hserout ["at+ifc=0,0", 13]

    checkip:
    hserout ["at*e2ipi=0", 13] ' Check the IP Session
    hserin 20000, setup, [WAIT("*E2IPI: "),STR ipaddress]

    main:
    Hserout ["at+cgdcont=1,", 34, "IP", 34, ",", 34, "myserver.address", 34,13]

    Hserin 20000, setup, [WAIT("OK")]
    Hserout ["at*e2ipa=1,1", 13]
    Hserin 20000, setup, [WAIT("OK")]
    goto main

    I have been able to connect my board to my pc and the hserout is working as it should. I am not able to get anything back from the pc or modem.

    Is the hserin setup correctly?

    Thanks again, Scott

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


    Did you find this post helpful? Yes | No

    Default

    mmm. Actually you don't need this DEFINE HSER_BAUD since DEFINE HSER_SPBRG do the same job but i don't think it's the problem source.

    What about if you remove the timeout label?

    Did you try Hyperterm or else to send the expected string to the PIC?
    Steve

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

  7. #7
    Scott's Avatar
    Scott Guest


    Did you find this post helpful? Yes | No

    Default

    mister_e,

    Yes, I have been successfull connecting and sending the expected strings back to the PIC from the PC. Again, I do the same thing with the modem to hyperterminal and send the at commands and get the correct response.

    This is the first time I have tried to connect to the modem using the USART a MAX232 transceiver. Usually I utilize other pins and use SERIN/SEROUT inverted and non-inverted and it has been working well with some of my other hardware.

    I have changed the 232 transceiver with a ST232 and a MAX332 with the same results.

    Tonight I will use the same hardware then remove the trace to the USART and connect to PORTC.4 for my TX and PORTB.3 for RX and see if this works.

    Thanks, Scott

Similar Threads

  1. Help understanding HSERIN/HSEROUT
    By jmbanales21485 in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 9th March 2021, 07:47
  2. Rs485 Using Hserin/hserout
    By koossa in forum mel PIC BASIC Pro
    Replies: 27
    Last Post: - 31st January 2008, 09:42
  3. Hserin/Hserout question
    By Philley in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 7th May 2007, 13:17
  4. Bit/Byte array for Hserin/Hserout
    By mrx23 in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 1st September 2006, 23:07
  5. Replies: 1
    Last Post: - 16th June 2005, 02:56

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