Hserout, multitasking?


Closed Thread
Results 1 to 5 of 5
  1. #1
    toalan's Avatar
    toalan Guest

    Default Hserout, multitasking?

    Hi guys for some reason I though the Hserout was multitasking, meaning if I Hserout a value the MCU would not need to wait until the task was fully executed to carry on with the next line of code.

    In testing I found that the MCU has to finish executing the HSEROUT command in order to continue the next line of code. If I were to use assembly would that still be the case?

  2. #2
    Join Date
    Jul 2003
    Location
    Sweden
    Posts
    237


    Did you find this post helpful? Yes | No

    Post

    The HSEROUT command will wait until it has stuffed the last character into the 2 byte transmit buffer. That means that all strings longer than 2 characters will do some waiting. It will always be faster than any software serial routine like SEROUT, SEROUT2 or DEBUG who will be busy until the bitter end.

    Since the buffersize is set in hardware there is no way of getting it bigger, assembler will be affected in just the same way. You can ofcource use interrupts to handle a bigger softwarebuffer in the background.

  3. #3
    toalan's Avatar
    toalan Guest


    Did you find this post helpful? Yes | No

    Default

    ahh that makes alot of sense.

    I assume you can directly or indirectly check to see if the buffer is full or not. Any idea which registers to check? I know read the datasheet, but if anyone happens to know it off the of their head then please do tell. Thanks again

    Regards,

    Alan To

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


    Did you find this post helpful? Yes | No

    Default

    mmmm can't say you can do it elsewhere than in a interrupt handler routine... try TXSTA=0

    OR do a loop to send your data byte/byte, do a test after each HSEROUT that say to continue or stop HSEROUT.

    Code:
    for SEndData = x to y
         Hserout [Myvar[SendData]]
         ' set your stop/continue flag here and after that
         ' 
         If ContinueOrStop = Stop then SendData = y ' to get out of the loop
    next
    Last edited by mister_e; - 25th February 2005 at 03:44.
    Steve

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

  5. #5
    toalan's Avatar
    toalan Guest


    Did you find this post helpful? Yes | No

    Default

    TY for the info

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. hserin and sms controller
    By xxxxxx in forum mel PIC BASIC Pro
    Replies: 25
    Last Post: - 10th February 2010, 15:49
  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. Is HSEROUT corrupting bit 7 ?????
    By Robert Wells in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 23rd October 2008, 16:26
  5. Controlling an 240x128 LCD Touchpanel Display
    By Vincent in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 7th June 2006, 23:36

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