SEROUT being unreliable


Closed Thread
Results 1 to 19 of 19

Hybrid View

  1. #1
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Kamikaze47 View Post
    The reason I need this is I need at least 2 serial outputs and this PIC only has 1 hardware USART.
    Semi-silly idea for you...but might be easier than you think. Might even be able to write a macro to handle the switching for you...
    Use the HSEROUT for your serial out as you've already planned it out...
    Get your hands on a couple of AND gates, or whatever works...
    Use another PIC pin or two as STEERING LOGIC.

  2. #2
    Join Date
    Nov 2005
    Location
    Perth, Australia
    Posts
    429


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    Semi-silly idea for you...but might be easier than you think. Might even be able to write a macro to handle the switching for you...
    Use the HSEROUT for your serial out as you've already planned it out...
    Get your hands on a couple of AND gates, or whatever works...
    Use another PIC pin or two as STEERING LOGIC.
    Thats a pretty good idea.
    "I think fish is nice, but then I think that rain is wet, so who am I to judge?" - Douglas Adams

  3. #3
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Kamikaze47 View Post
    Thats a pretty good idea.
    Well, heck, glad I could help...
    Generally I'm useless
    Does your program have any interrupts running in it?

  4. #4
    Join Date
    Nov 2005
    Location
    Perth, Australia
    Posts
    429


    Did you find this post helpful? Yes | No

    Default

    Actually, i do have 3 interrupts in this program. Maybe SEROUT is getting interrupted and thats messing with the data.

    I'm gonna try disabling the interrupts while I run SEROUT... Not the best long term solution as It wouldnt be good to miss one of those interrupt events, but its worth a try to see if thats whats causing my problem.
    "I think fish is nice, but then I think that rain is wet, so who am I to judge?" - Douglas Adams

  5. #5
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Kamikaze47 View Post
    Actually, i do have 3 interrupts in this program. Maybe SEROUT is getting interrupted and thats messing with the data.

    I'm gonna try disabling the interrupts while I run SEROUT... Not the best long term solution as It wouldnt be good to miss one of those interrupt events, but its worth a try to see if thats whats causing my problem.
    Are you using assembly int's (i.e. DT's fast ints) or the ON INTERRUPT types?

  6. #6
    Join Date
    Nov 2005
    Location
    Perth, Australia
    Posts
    429


    Did you find this post helpful? Yes | No

    Default

    I tried to test the interrupt theory with a simple GIE=0 before SEROUT and GIE=1 after it, but disabling the interrupts makes my program do unexpected things and makes it impossible to test. But i'd say its a high probability that the interrupts are the issue.

    So I guess i'll have to stick with the hardware USART and, as skimask suggested, multiplex its output.


    *edit*: Using ASM interrupts as timing is important.
    Last edited by Kamikaze47; - 3rd March 2008 at 15:24.
    "I think fish is nice, but then I think that rain is wet, so who am I to judge?" - Douglas Adams

  7. #7
    Join Date
    Mar 2006
    Location
    Pennsylvania, USA.
    Posts
    130


    Did you find this post helpful? Yes | No

    Default

    I've used serout and debug out to run to two different Double-Talk boards at 9600 baud, both performed perfectly, so I'd have to say that you're right, it's probably the interrupts. I tried it using two different LabX-Usb boards, with 18f4550's, with a DEFINE OSC 48. The boards have 20 Mhz crystals, and the oscillator selection is for HS_PLL.

    Jerry.
    If your oscilloscope costs more than your car...

  8. #8


    Did you find this post helpful? Yes | No

    Default condition the data line first.

    My serial data errors all went away as soon as I started presetting the data line before transmission.

    For example, RS-232 defines the IDLE or MARK state to be negative volts at the RS-232 connector. That means positive volts at the PIC before the MAX232 inverter.

    Try something like

    HIGH TxData
    pause 2
    Serout/Serout2/Hserout your message.

    It works for me.

    HTH
    BrianT

  9. #9
    Join Date
    Nov 2005
    Location
    Perth, Australia
    Posts
    429


    Did you find this post helpful? Yes | No

    Default

    BrianT: I previously tried a non-true driven mode and tied the line to +5 with a 10k resistor, which did not help reliability.

    b1arrk5: Yep, in the end I did manage to test it with my interrupts disabled, and it worked, so thats the issue. Disabling the interrupts while I send isn't an option, so no software serial comms for me I guess.
    "I think fish is nice, but then I think that rain is wet, so who am I to judge?" - Douglas Adams

Similar Threads

  1. A Serial GLCD 128x64 Simple Project
    By Oldspring in forum Off Topic
    Replies: 0
    Last Post: - 8th March 2010, 20:58
  2. Serout to serial servo
    By azmax100 in forum mel PIC BASIC Pro
    Replies: 20
    Last Post: - 12th August 2009, 16:46
  3. Advice-scrutiny for my serial controller
    By kevlar129bp in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 13th December 2008, 17:11
  4. Keypad unlock (as in garage door possibly)
    By Fred in forum Code Examples
    Replies: 5
    Last Post: - 2nd April 2006, 04:26
  5. Replies: 11
    Last Post: - 13th July 2005, 19:26

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