HSERIN and XOUT command


Closed Thread
Results 1 to 21 of 21

Hybrid View

  1. #1
    Join Date
    May 2008
    Location
    Italy
    Posts
    825

    Default HSERIN and XOUT command

    I am facing a singolar behaviour using a pic 16F628 working @ 3.3 Volts.

    I am receiving a string of 9 characters via Xbee, the string is serially collected in an array using HSERIN command. The string is than decoded and an X10 command is generated via XOUT. Everything work fine only for two strings sent, with the third string the HSERIN doesn't work anymore, I need to reset the pic to get HSERIN to work again (but still for two strings only)

    Using SERIN2 the problem disappear and the system works fine, but since I want to use the chip USART capability, I did try to understand the reason for such a behaviour, but with no luck.

    Here the USART setting
    Code:
    DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive
    DEFINE HSER_TXSTA 24h ' Enable transmit, BRGH = 1
    DEFINE HSER_SPBRG 25  ' 9600 Baud @ 4MHz, 0,16%
    DEFINE HSER_CLROERR 1 ' Clear overflow automatically
    Here the X10 command code
    Code:
    High TxEnable ' enable pwr line transmission
    pause 5
    Xout X10Tx,Zcrox,[House\Unit,House\Unit2]
    low TxEnable
    Does anybody know if there is any incompatibility between the two commands "HSERIN and XOUT"?

    Al.
    All progress began with an idea

  2. #2
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default Solution

    Adding to the code : INCLUDE "Modedefs.bas", HSERIN and XOUT now work!

    Fantastic, but the question remains, why.

    Al.
    All progress began with an idea

  3. #3
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by aratti View Post
    Adding to the code : INCLUDE "Modedefs.bas", HSERIN and XOUT now work!

    Fantastic, but the question remains, why.

    Al.
    Hi Al, if you open MODEDEFS.BAS you find the following code
    Code:
    ' Xout Commands
    Symbol UnitOn = %10010
    Symbol UnitOff = %11010
    Symbol UnitsOff = %11100
    Symbol LightsOn = %10100
    Symbol LightsOff = %10000
    Symbol Dim = %11110
    Symbol Bright = %10110
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  4. #4
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    Hi Joe, thank you for your reply.
    My perplexity still remain, I don't think anything in MODEDEFS.BAS can interfere with HSERIN command.

    The XOUT command was working without MODEDEFS.BAS file (because I am using my own X10 coding), the only problem was that I had to use SERIN2 instead of HSERIN .

    Al.
    All progress began with an idea

  5. #5
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Hi Al,
    It was HSERIN that didn't work . . . Thought it was the x10 code . . . I should have read it through . . . might have something to do with the RX ports idle state, perhaps the code in modedefs.bas affected it that way. I DO know hserin likes to idle high.
    Last edited by Archangel; - 9th May 2009 at 20:00.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

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


    Did you find this post helpful? Yes | No

    Default

    Are you using the TX pin for XOUT? If so, yes It may give you some weird problem, because XOUT may try to modify the TRIS setting, and/could disable the USART.
    Try
    RCSTA=0 before XOUT
    RCSTA=$90 after Xout
    and see how good, worst it is.

    From what I know, there's no good reason why MODEDEFS should solve the problem. If it wasn't there, you would probably have some compilation error but not much.
    Steve

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

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