B-168 serial comms on other pins?

Hi all!
I am a new user of the B-168 controller. Aside from the pins PD0 and PD1, are there other pins that I can set up for serial communication (Tx and Rx)? If so how do I do that? I read the documentations and could not find anything helpful. Appreciate any help!


You’ve identified the only hardware serial port, so your only other option is to do the serial in software.

- Jan

Sorry perhaps I did not explain it correctly. Is it also possible to use for example PD2 and PD3 for serial communication? I will also use PD0 and PD1 as Tx and Rx. The purpose is to set up multiple serial UARTs on the B-168…


As Jan explained, the mega168 only has a single hardware UART, so you can only use pins PD0 and PD1 for hardware-driven serial communications. If you want multiple UARTs, you will have to implement the rest in software, which is doable but can be a bit hardware intensive (e.g. your code will need to monitor the pins and time the individual bits as they come in). There are several examples of software serial implementations for the mega168 available online if you search around.

- Ben

Are there any suggestions for places to find software UART code (AVR Studio GCC) for an Orangutan Mega 168?

There are many examples for AVR chips but they are all for different chips with different registers and pins and the corresponding pins on the Orangutan are already used by another device.

My preference would be for an interrupt driven UART. I really only need to use the input not the output.


I know Arduinos have a software serial library since the hardware UART is used for programming and debugging. Since Arduinos are based on the ATmega168, it would probably be fairly straightforward to port this to the Orangutan.

- Ben

Hi WJHilliard,

Did you have the software UART working on your B-168 controller?
If yes, please share your experience, and if possible the code.
I am using B-328P which has similar registers and pins as the 168.

Thank you in advance,