Hserin


Closed Thread
Results 1 to 7 of 7

Thread: Hserin

  1. #1
    egberttheone's Avatar
    egberttheone Guest

    Cool Hserin

    1ste post!

    hello all. I seem to have a problem with serial receive.


    this is the code that I use for sending the data, I already used +10 because it seems that it doesn't do any thing when sending a zero
    Code:
    HSerout [day + 10]
    HSerout [month + 10]
    HSerout [year + 10]
    HSerout [hour + 10]
    HSerout [minute + 10]
    HSerout [second + 10]

    and this is the code that I use for receiving

    Code:
    HSerin 3000,TimeOut, [CurrendDate(0)]
    HSerin 100,TimeOut, [CurrendDate(1)]
    
    HSerin 100,TimeOut, [CurrendDate(2)] '?
    HSerin 100,TimeOut, [CurrendTime(0)] '?
    
    HSerin 100,TimeOut, [CurrendTime(1)]
    HSerin 100,TimeOut, [CurrendTime(2)]


    the problem is that if I send "10,11,12,13,14,15" I'll receive "10,11,13,13,14,15" any explanation for this? I tryed every thing
    Last edited by egberttheone; - 9th November 2004 at 20:49.

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


    Did you find this post helpful? Yes | No

    Default

    Welcome to the forum.

    Here's a few suggestions you may find useful for synchronizing serial communications, and shrinking your code size in the process.

    1. Try using the STR modifier with HSEROUT/HSERIN to send/receive strings of data rather than using multiple HSEROUT/HSERIN lines to send/receive.

    2. Use some type of synchronization character to lock onto the first byte or "synch up" with the 1st character.

    Note: This is just a simple example. Change whatever you need to like the TimeOut value, label, array size, baud rate, etc,,.
    Code:
    DEFINE  OSC 20
    DEFINE  HSER_BAUD 9600  ' Use 9600 baud
    DEFINE  HSER_CLROERR 1  ' Auto clear over-run errors
    RCSTA = $90 ' SPEN & CREN = 1	          
    TXSTA = $24  ' TXEN & BRGH = 1                    
    TimeDate VAR BYTE[6]
    
    Main
        HSERIN 5000,TimeOut,[WAIT("A"),STR TimeDate\6]
        HSEROUT ["Rcvd string: ", STR TimeDate\6,13,10]    
        GOTO Main
    
    TimeOut:
        HSEROUT ["Nada",13,10]
        GOTO Main
    Use a terminal program to send A369621 to your PIC. If all's well, you'll see;

    Rcvd string: 369621

    If all's not well, you'll see;

    Nada

    This will save you a TON of code space, and it's much easier to manage.
    Regards,

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

  3. #3
    egberttheone's Avatar
    egberttheone Guest


    Did you find this post helpful? Yes | No

    Default

    well it seems to work now but i already got a other problem:

    if i try to put a value of a variable into the array, then the interrupt routine(timer) stops working!

    Code:
    TimeDate(1) = DayREC			
    TimeDate(2) = MonthREC
    TimeDate(3) = yearREC
    TimeDate(4) = HourREC
    TimeDate(5) = MinuteREC
    TimeDate(6) = SecondREC
    i don't understand why it does the variables are bove byte's accept that the other varaible is in a array

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


    Did you find this post helpful? Yes | No

    Default

    For array you must use bracket instead of parenthesis but it's maybe a typing error...

    if not, can you post your whole code ?
    Last edited by mister_e; - 15th November 2004 at 19:30.
    Steve

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

  5. #5
    EShatara's Avatar
    EShatara Guest


    Did you find this post helpful? Yes | No

    Question Hserin Syntax

    What is the "5000" used for in the following statement



    Main
    HSERIN 5000,TimeOut,[WAIT("A"),STR TimeDate\6]
    HSEROUT ["Rcvd string: ", STR TimeDate\6,13,10]
    GOTO Main


    Looking all through the PBP manual doesn't shed light on this question.

    thanks...chris

  6. #6
    EShatara's Avatar
    EShatara Guest


    Did you find this post helpful? Yes | No

    Lightbulb Figured it out?

    After rereading the discription of the HERIN command, it would appear that the syntax:

    Herin 5000, Timeout, [.....]

    indicates that parity is turned on and that the parity error routine is at address "5000".

    Is this corrrect?

    /chris

  7. #7
    egberttheone's Avatar
    egberttheone Guest


    Did you find this post helpful? Yes | No

    Default

    Thx for your help all, i changed some things and it works !

Similar Threads

  1. Hserin with Instant Interrupts.
    By ronjodu in forum Serial
    Replies: 17
    Last Post: - 30th December 2014, 20:17
  2. HSERIN and XOUT command
    By aratti in forum General
    Replies: 20
    Last Post: - 12th May 2009, 11:58
  3. Instant Interrupts and HSERIN
    By Rob in forum mel PIC BASIC Pro
    Replies: 26
    Last Post: - 31st January 2009, 05:13
  4. TMR0 interrupt and HSERIN
    By boban in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 2nd September 2008, 11:48
  5. 16F877a Interupt driven Hserin
    By RFsolution in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 3rd November 2006, 00:38

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