Mutliple RS232 devices


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

    Question Mutliple RS232 devices

    Hi all,

    I'm new to PBP and PIC's in general .

    I have an application which I would like to recieve RS232 data from two separate devices at the same time.

    Does anyone know if this is possible , currently I'm using serin2 to recieve data from either device individually no problems but it doesnt work if I try to use serin2 on two different pins at the same time. Perhaps I'm asking too much .

    If anyone has any suggestions on how this might be achieved I'd appreciate it

    thanks

    Gilles

  2. #2
    Join Date
    Feb 2005
    Location
    Kolkata-India
    Posts
    563


    Did you find this post helpful? Yes | No

    Default Use a combination of Hardware USART and Serin

    Hi,

    Since serin is a software based UART you cannot have multiple instances. However you can use the hardware USART for one receive (probably interrupted so you know when your receive buffer is having a new data) and a normal serin on the other.

    Regards

    Sougata

  3. #3
    Lsalt's Avatar
    Lsalt Guest


    Did you find this post helpful? Yes | No

    Default

    Hi Sougata,

    thanks for the response , I must admit doing that never crossed my mind I'm using a 16F628a , it has a hardware UART .

    i have used Hardware UART succesfully with a C based complier before however not with PBP hopefully its not too difficult , will read the manuals and see how I go.

    thanks

    again.

    Gilles

  4. #4
    Join Date
    Feb 2005
    Location
    Kolkata-India
    Posts
    563


    Did you find this post helpful? Yes | No

    Default Thats quite simple though

    Hi,

    PBP supports the HSERIN command that interfaces with the onboard hardware usart of your PIC. However the problem in your app is that you need simultaneous sensing. So just sit in a tight loop with the serial in and poll for the receive buffer full bit to branch to another section using the HSERIN function. However to make it more reliable you can have the entire hardware routine in asm interrupt based. Setup up a ring array and setup interrupts for hardware Rx. You can opt for manual error handling on receive buffer overflow or use an auto clear. Thus you don't miss a byte. Then do the software serial in. However to make it further interesting you can have the serialin routine right in your asm. Or you can use a software (See Darrel's thread on instant interrupts) interrupt source to jump into the serial routine. In this case your serialin pin should tally with a physical interrupt pin.

    Good Luck

    Sougata

  5. #5
    Join Date
    Apr 2005
    Posts
    32


    Did you find this post helpful? Yes | No

    Default

    some pics! has two usart !! as far as i know 18f6620 has rx1/rx2 and tx1 /tx2


    how can we use hserin for control these two channel at the same time !!

Similar Threads

  1. Universal remote and Rs232
    By Michael in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 7th February 2010, 17:55
  2. UART vs software RS232
    By Michael in forum mel PIC BASIC Pro
    Replies: 27
    Last Post: - 5th September 2008, 18:27
  3. RS232 into 2 PC ports
    By manxman in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 30th August 2008, 13:33
  4. PIC18F4680 to PC via MAX232 (RS232 serial) no output
    By opticsteam1 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 14th April 2008, 20:39
  5. Melabs PIC Basic Pro - 16 bit devices support
    By rod27cn in forum PBP Wish List
    Replies: 10
    Last Post: - 21st November 2007, 08:21

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