Hserout Versus Serout2


Closed Thread
Results 1 to 9 of 9
  1. #1
    Join Date
    Jul 2006
    Posts
    22

    Default Hserout Versus Serout2

    Hi all, I have a unexpected fail, porting some code from HSEROUT to SEROUT2
    I mean, in my PCB I have a MAX232 with a PIC18f452, using this lines of code working OK :

    DEFINE OSC 10
    DEFINE HSER_CLROERR 1
    DEFINE HSER_RCSTA 90H
    DEFINE HSER_TXSTA 24H
    DEFINE HSER_SPBRG 64
    HSEROUT ["HELLO WORLD",13,10]
    (in the hyperterminal appear "HELLO WORLD")

    And this Doesn't work in the same board!

    DEFINE OSC 10
    symbol RXD=PORTC.7
    symbol TXD=PORTC.6
    TRISC.7=1
    TRISC.6=0
    TXD=1
    SEROUT2 TXD,84,["HELLO WORLD",13,10]
    (in the hyperterminal nothing appear!)

    I can't figure a mistake.... Can Anyone Helpme?

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    bethr,

    Both versions work here. 18F452/MAX232 20mhz.

    However, the SEROUT version won't work if you still have either an HSERIN or HSEROUT somewhere in the program. The HSER statement doesn't even need to execute. Simply being in the program is enough. Since you are trying to convert it, it's a possibility.

    With any HSER statements in the program, the USART will be initialized on power-up. Which makes it so only the USART can access the TX pin.
    <br>
    DT

  3. #3
    Join Date
    Jul 2006
    Posts
    22


    Did you find this post helpful? Yes | No

    Default

    Is right Darrel!,
    I start a small program, and this works!, I will do a further search to any instruction using the on chip USART, may be a hserout 'hidden' or a LET statement using some Register related to the serial port...
    (but looks strange, I already replace all HSEROUT to SEROUT2 instructions)

  4. #4
    Join Date
    Jul 2006
    Posts
    22


    Did you find this post helpful? Yes | No

    Default

    is strange that happen,
    look, I have my subroutines in another file called "subs.bas", When I compile the main file called "main.bas" I call the subs file, (include "subs.bas"),
    compile ok but... doesn't work! (no send data over serial port)

    when I compile without (include "subs.bas"), it Works!.
    Why? I am confused...

    then I comment ALL lines file subs.bas, for ensure that these code doesn't take part of program memory, doing this still doesn't working...

    at least I put the two files to form one single, compile it and voila! its working
    I don't understand that happen....

  5. #5
    Join Date
    Feb 2003
    Posts
    432


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by bethr
    (but looks strange, I already replace all HSEROUT to SEROUT2 instructions)
    Have you left any DEFINES in there that relate the USART ???
    Keith

    www.diyha.co.uk
    www.kat5.tv

  6. #6
    Join Date
    Jul 2006
    Posts
    22


    Did you find this post helpful? Yes | No

    Smile

    Quote Originally Posted by bethr

    DEFINE OSC 10
    symbol RXD=PORTC.7
    symbol TXD=PORTC.6
    TRISC.7=1
    TRISC.6=0
    TXD=1
    SEROUT2 TXD,84,["HELLO WORLD",13,10]
    (in the hyperterminal nothing appear!)
    no I sure!..

  7. #7
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    compile ok but... doesn't work! (no send data over serial port)

    when I compile without (include "subs.bas"), it Works!.
    In the INCLUDE file. Do you jump over the subroutines with a GOTO?

    You have to make sure execution doesn't "fall" into a subroutine.
    <br>
    DT

  8. #8
    Join Date
    Jul 2006
    Posts
    22


    Did you find this post helpful? Yes | No

    Default

    No I think, because the Hserout version Works OK,

  9. #9
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Ok, well we can continue playing 20 questions, or...

    It might help to see the code.
    <br>
    DT

Similar Threads

  1. I2C Slave with a PIC
    By ralfmayr in forum mel PIC BASIC Pro
    Replies: 129
    Last Post: - 21st August 2016, 17:44
  2. Serout and 18F87J50
    By Glenn_Webber in forum Serial
    Replies: 8
    Last Post: - 20th November 2009, 14:26
  3. HSEROUT and Commas, What? Help Me Understand
    By altech6983 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 20th July 2009, 19:12
  4. SLOW Serin2 and Serout2
    By dragons_fire in forum General
    Replies: 3
    Last Post: - 26th June 2009, 02:38
  5. Advantages of HSerout over Serout2 and a problem
    By rpstroj in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 11th August 2004, 22:19

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