This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

8051 Software UART.

You know this should be really easy to find but for some reason I am having no luck. First off, I'm a C programmer and I am really bad at reading Assembler code. I know there is a way to write a software UART for the 8051. I am using a Phillips P89C668 right now and I will be changing it to another soon.

If someone could point me to some sample code how to setup a half-duplex UART I would really appreciate it.

I have two pins and I am going to use one as tx and the other as rx. I don't think I need to do a full duplex but if there is something out there that does it I'll take it at this point!

Thanks.
-stv

Parents
  • "There is a way to do bit twiddling in C. It's not that hard."

    As Erik says, it's not hard for the programmer to write the 'C' code, but bit twiddling in 'C' involves shifting & masking whole bytes.
    You don't really want to do that in a timing-sensitive application like a UART!

    "it would be nice not to have to rewrite something that is already written."

    Again, as Erik says, why would you re-write it? uVision has absolutely no difficulty whatsoever in mixing 'C' and assembler in the same project!

Reply
  • "There is a way to do bit twiddling in C. It's not that hard."

    As Erik says, it's not hard for the programmer to write the 'C' code, but bit twiddling in 'C' involves shifting & masking whole bytes.
    You don't really want to do that in a timing-sensitive application like a UART!

    "it would be nice not to have to rewrite something that is already written."

    Again, as Erik says, why would you re-write it? uVision has absolutely no difficulty whatsoever in mixing 'C' and assembler in the same project!

Children