Hi All, I am trying to write software UART in C51. I manage to receive some thing but not the right character I sent. I think I have sync problem but it is hard to debug it. I will be glad if someone can send me such a code (I try to look for it in the net but I didnt found any C code). Thanks KH
<i.but I didnt found any C code Od course, you did not. A bit-bang UART require precise timing and that is impossible in anything but assembler. Erik
A little harsh I found code for the 51' (some where) And wrote it for a PIC in C (and the PIC interupts are slow) google "bit bang uart 8052" or "bit bang uart 8051" It is quite posible for low baud rates. TX is easy. it is RX that is hard.
I should read the Post. send the bits back out another port pin. Then look at both on a scope. That worked for me. I assume you are using and interupt to pick up the start bit. You must unless you have a very fast sample rate. After the start wait 1 and half a bit times then start reading bits. (The PIC loses 1/2 a bit time in the int)
Thanks You All, I manage to operate software UART, in slow baud rate(4800) but it is satisfy. If anyone is working on software UART it is very helpful to toggle another GPIO before and after the sampling and to look at it in a scope. Again thank you all Kobi
One thing not mentioned so far is that a bit bang UART is very "resource hungry". If the pupose is simple e.g. receive on the regular UART and bit bang it out, sure it is possible, but keep adding processing and at some time, surprise your bit-bang UART becomes erratic. Erik
Very True. But in my case it was just waiting for an answer. The Real UART talks to the Host Computer.