Receiving data from more than one serial Port


Closed Thread
Results 1 to 4 of 4
  1. #1
    PICtron's Avatar
    PICtron Guest

    Question Receiving data from more than one serial Port

    I have an application (16F876@20MHz) where I have to deal with more than one serial Port.

    The HWUSART of the PIC is connected to some device that sends Data @9600Baud.
    The PIC receives this data does some math
    and logs the results to an external EEPROM.

    Some of the logged data is send out on PortB.7 @ 4800Baud to
    a Terminal (serial LCD) for monitoring purposes.

    So far everything works fine.

    Now I have got to connect a PC to a third Port @4800 Baud
    to be able to read / modify / clear the log memory.

    I have only two wires (besides GND) to the PC (RX & TX)

    The issue is timing,
    how do I get the PIC into the "communicate with PC" routine?
    timewise I can't afford to sit in a SERIN2 loop and wait for a "SYNCH" character
    while the MainLoop is supposed to do other tasks.

    Any ideas?

  2. #2
    Join Date
    Dec 2003
    Location
    Wichita KS
    Posts
    511


    Did you find this post helpful? Yes | No

    Default

    Hello Jerry,

    Jerry>>how do I get the PIC into the "communicate with PC" routine?
    timewise I can't afford to sit in a SERIN2 loop and wait for a "SYNCH" character
    while the MainLoop is supposed to do other tasks.<<

    I don't know your full setup, but can you do a "on interupt" when you press the PC keyboard? then you can turn off all interputs, process your PC with your SERIN2, finsh, turn on all interputs (if that is what you are using) and return to your mainLoop.

    Dwayne
    Ability to Fly:
    Hurling yourself towards the ground, and missing.

    Engineers that Contribute to flying:
    Both optimists and pessimists contribute to the society. The optimist invents the aeroplane, the pessimist the parachute

    Pilots that are Flying:
    Those who know their limitations, and respect the green side of the grass...

  3. #3
    Join Date
    Jul 2003
    Location
    USA - Arizona
    Posts
    156


    Did you find this post helpful? Yes | No

    Default

    You could either poll the (software) RX pin from the PC at defined intervals, or you could use a pin with an 'interrupt-on-change (IOC)' function. Once the pin is active you can immediately jump to the SERIN/SERIN2 with a timeout (in case there is some junk on the line).

    You have to take care when using the IOC function so that it does not disturbs the HSERIN, more important the other SEROUT (to LCD). If you go with the polling method, you should poll it at every tenth of a bit time (IIRC).

  4. #4
    PICtron's Avatar
    PICtron Guest


    Did you find this post helpful? Yes | No

    Default

    Thanks for the replies!

    I think simply polling the RX-pin will be too time consuming.

    I have not used IOC yet, but I will give it a try a try, even though I would have to disable and re-enable Interrupts at many places in code to not disturb time critical tasks.

Similar Threads

  1. Using Nokia LCD
    By BobP in forum mel PIC BASIC Pro
    Replies: 300
    Last Post: - 3rd May 2018, 04:47
  2. Nokia 3310 display text
    By chai98a in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 26th August 2007, 03:39
  3. Big characters on HD44780 4x20
    By erpalma in forum mel PIC BASIC Pro
    Replies: 23
    Last Post: - 7th January 2007, 02:21
  4. LCD + bar graph
    By DynamoBen in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 5th October 2005, 14:50
  5. Sinus calculating !
    By Don Mario in forum mel PIC BASIC Pro
    Replies: 29
    Last Post: - 28th November 2004, 23:56

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