Hserout overides debug and serout2


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2006
    Posts
    13

    Default Hserout overides debug and serout2

    When trying to send serial message to same pin using HSEROUT and DEBUG and SEROUT2.
    I have noted that HSEROUT overides any other messages .
    If HSEROUT is uncommented only it work. If HSEROUT is commented the DEBUG and SEROUT2 works concurrently without problem.

    h= 1234
    main:
    serout2 portb.5,baud96T,["Serout2=", dec4 h, 13,10]
    debug "Debug=", dec4 h,13,10 'configured to same PORTB.5 same baud rate
    'hserout ["HSerout=", dec4 h, 13,10] 'configured by chip to same PORTB.5 same baud rate
    pause 500
    goto main

    Is this behavior normal ? Are there any way to enable and disable HSEROUT in order to have the 3 outputs working in the same pin ?

  2. #2
    Join Date
    Oct 2006
    Posts
    13


    Did you find this post helpful? Yes | No

    Default Re: Hserout overides debug and serout2

    Solved:

    I use:

    TXSTA = $24 ' enable HSEROUT just before use it
    HSEROUT...... here
    TXSTA= $0 ' disable HSEROUT after the use. This will allow Debug and Serout2 be used in the pin


    Solved

  3. #3
    Join Date
    Apr 2014
    Location
    OK
    Posts
    557


    Did you find this post helpful? Yes | No

    Default Re: Hserout overides debug and serout2

    My first question is why would you try to do the same thing 3 different ways in such a way as they conflict with each other?!?

    HSEROUT is Hardware based. If you look at the data sheet for whatever PIC you're using, there is a UART peripheral built in. HSEROUT uses that. Many of the PBP Commands are "bit-banged" where the function (command) is software driven, not hardware. This means that with PBP you can have an SPI function on a PIC that the data sheet claims that function is not available. However, if your PIC has SPI, using certain commands won't use it, choosing to implement everything in software instead (as you've found out).

    What I see is you were attempting to try to do the same thing with software driven commands and hardware driven commands at the same time. Your question suggests the hardware commands over-rode the software commands -- as it should be.

    PBP is magical in many ways. Like Arduino, the software seems to make things happen, even when you don't know why. I suggest you spend some time with the PBP Reference Manual to better understand which commands activate hardware, and which ones make things happen outside of built-in peripherals (part of the magic of PBP). Using certain commands will create a functional output without ever tapping the hardware -- even if it's built into the PIC you're using. Yes, it can get confusing.

    When I bought PBP3.1 many years ago, I spent a few more dollars for the paper copy of the PBP3 Reference Manual. I read through it many times, made notes in the margins, highlighted different things in different colored markers... I tried to get to understand the tool I purchased. I eventually had to laminate the covers and punch new holes because they were falling off. I do many things differently than most folks on this forum because of that experience. I don't rely on software commands when there is hardware already built into the PIC which can do a better job than the software commands. It requires manually manipulating the SFRs the long way. Software commands are awesome when you want to do something the PIC data sheet says can't be done -- and PBP does that quite well at times.

    Ultimately you have to find what works best for you. The more you know -- knowledge is power -- the better you will do with your projects.

Similar Threads

  1. Debug/Serout/Serout2 - please, need advice ...
    By fratello in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 29th May 2015, 16:48
  2. 12f629 serout,debug and serout2 timings
    By Dennis in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 10th January 2010, 04:13
  3. debug vs serout vs serout2
    By mychangl in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 25th March 2007, 06:35
  4. Hserout Versus Serout2
    By bethr in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 21st July 2006, 00:46
  5. SerOut, SerOut2 or HSerOut
    By FrankM in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 1st August 2004, 16:24

Members who have read this thread : 4

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