RX - TX timming


Closed Thread
Results 1 to 6 of 6

Thread: RX - TX timming

  1. #1

    Default RX - TX timming

    Hi all,

    i'm thinking on a circuit capable of receiving data from RS232 and sending it via wireless TX.

    The problem is managing the receiving and transmiting long messages without loosing data.

    How is it possible to receive and send data simultaniously without loosing data in between ?

    Thanks

  2. #2
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default

    Best way -use a chip with a USART.
    Charles Linquist

  3. #3
    Join Date
    Feb 2009
    Posts
    26


    Did you find this post helpful? Yes | No

    Default A little tougher

    Definitely go for the hardware UART definitely. You will however, with all transmitters and receivers run the chance of interference. If your data rate is slow enough you could get a module that uses the ZigBee protocols. I am definitely no expert, but just an idead.

  4. #4


    Did you find this post helpful? Yes | No

    Default

    Thanks guys,

    does that mean that when using the uart ( Hserin and Hserout ) the pic will do the receiving and transmitting directly with no data loss?

    Being this true ( not mentioning the defines and so on ) i only need the lines like :

    Hserin [dat]
    Hserout [dat]

    and the pic will do it by it self ?

    Also, after these lines i can go on with the rest of the code doing something else but internaly the receiving and transmitting continues ?

    Thanks

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


    Did you find this post helpful? Yes | No

    Default

    I would use an interrupt for HSERIN.

    The PIC have a 2 byte input buffer only.
    Steve

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

  6. #6
    Join Date
    Feb 2009
    Posts
    26


    Did you find this post helpful? Yes | No

    Default Something like this

    I agree with Mister_E and I would suggest using his pic multicalc application.
    Code:
    ' From pic multicalc
    RCSTA = $90   ' Enable serial port & continuous receive
    TXSTA = $20   ' Enable transmit, BRGH = 0
    SPBRG = 17    ' 1200 Baud @ 20MHz, 0.0%
    SPBRGH = 4
    BAUDCON.3 = 1 ' Enable 16 bit baudrate generator
    
    ' Your loop code like this:
    
    pTxData       VAR PORTC.6
    RCIF            VAR PIR1.5       ' EUSART Recieve Buffer Full
    
    MainLoop:
      
    WHILE RCIF = %1
        SEROUT pTxData, 5, [RCREG]
    WEND
    
    GOTO MainLoop
    This was just something whipped off the top of my head, so no promises... Some things to note are:

    Make sure you have something to check your transmission was successful.
    Pay attention to your modulation. I use transmitters that use OOK for small data applications. Then use the serout to transmit so I can invert the data. On the OOK transmiter the normal marking state of a UART is 1. This causes it to constantly be transmitting. Thus why I invert with the software transmission. If you recieve inverted data while using the hardware UART, then you must have a hardware inverter (or transistor inverter) setup.

    Also remember you'll probably want to send some sort of transmission start string to signal you are about to transmit. Also and end transmission string.

    If you are using a superheterodyne receiver sometimes it helps to train it by sending a few $55's.

    A crystal or resonator is more accurate in buad rate generating than the internal osc.

    Hope that helps, I kinda was distracted while I wrote this post.

    -Nemesis
    Last edited by nemesis; - 12th February 2009 at 02:40. Reason: Forgot Something!

Similar Threads

  1. Replies: 67
    Last Post: - 8th December 2009, 02:27
  2. RX TX modules - intermitent communication
    By ruijc in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 11th June 2009, 00:13
  3. RX / TX duo
    By mbw123 in forum General
    Replies: 19
    Last Post: - 30th July 2006, 16:07
  4. TX RX Buffer Question
    By shawn in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 14th January 2005, 01:49
  5. Tx and Rx of Single Pin PIC's
    By Dwayne in forum Code Examples
    Replies: 0
    Last Post: - 26th May 2004, 14:55

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