Software UART using PIC16f887

Discussion in 'Embedded Systems and Microcontrollers' started by nacoolp, May 2, 2013.

  1. nacoolp

    Thread Starter New Member

    Jan 2, 2013
    14
    0
    Hello All,

    I am using software UART on transmitter side and hardware UART on receiver side. I want to send one byte from one 16f887 to another 16f887.

    By doing so, although keeping same baud rate at both the ends, I am getting data but in the multiple of 4 or rather I can say the bits are shifted over to left by two positions. Can anyone suggest me what could be the problem with the communication.

    And also, is it possible to let software UART talk with the hardware UART??

    Thanks in advance.
     
  2. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,394
    1,606
    There shouldn't be any issue with a soft UART talking to a hard one, or vice versa.

    I do not follow your description of what your problem is. If you do not have a scope to view the serial stream you could slow it down to a crawl, put a LED there, and watch the blinks to see the data, but this does nothing to check the rate you send data.

    If you see bad data being sent you need to fix the soft UART. If it's good data going out then the receiver is set wrong. It is also possible that both are wrong.
     
  3. John P

    AAC Fanatic!

    Oct 14, 2008
    1,634
    224
    Some people swear by debuggers for these tough situations, but if you can connect up an oscilloscope, you'd be able to see exactly what's going on.
     
  4. Markd77

    Senior Member

    Sep 7, 2009
    2,803
    594
    Or connect to a PC using ST232 chip or similar. Then you can see if you receive the correct byte from the sending PIC, and also send to the receiving PIC to see if that works.
     
  5. KrisBlueNZ

    Member

    Oct 17, 2012
    111
    14
    It's also possible for asynchronous UARTs to lose bit-sync if characters are sent end-to-end. Try transmitting 0xFF values for all the characters; assuming you don't have parity bits, a 0xFF contains only one 0-bit - the start bit. Transmitting one or two of these will ensure that any bit-sync error is fixed.
     
Loading...