Software UART using PIC16f887

Thread Starter

nacoolp

Joined Jan 2, 2013
14
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.
 

ErnieM

Joined Apr 24, 2011
8,377
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.
 

John P

Joined Oct 14, 2008
2,025
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.
 

Markd77

Joined Sep 7, 2009
2,806
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.
 

KrisBlueNZ

Joined Oct 17, 2012
111
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.
 
Top