I am using a ATMEGA32HVB microcontroller which has a facility for cell balancing by which we can connnect 4 batteries in series and use one at a time. That is very useful for power management so I can't use a different microcontroller. Please suggest some methods to add a UART to it so I can easily interface to serial devices.
If you are looking for a hardware solution, Maxim has several UART ICs with an SPI interface to the microcontroller (which is included in your part). Look at MAX3100 or the other options here: http://www.maximintegrated.com/products/interface/controllers-expanders/uart.cfm |
|||
|
As others have noted, you can either add additional hardware to your system to provide the UART functionality, or you can emulate one in software. If you have control of the overall hardware design and adding another IC is an option, I would strongly consider the hardware-based approach. You can certainly make a software UART work using bit-banging, but you might not want to dedicate the CPU resources to generating the required timing. From a glance at the datasheet, it appears that your microcontroller has both SPI and I2C (which Atmel calls a Two-Wire Interface (TWI)). These would probably be the best interfaces to use in order to attach an external UART. Said devices are available from a number of manufacturers. Some examples:
|
|||
|
You will need to use a software UART driver. Depending on exactly what you expect from this UART, you could use AVR305 (extremely compact, but no features beyond blocking half-duplex send/receive), AVR274 (interrupt driven, fairly feature complete), you could write your own software UART driver or you can use one you find on the internet, for instance by googling 'avr software uart' |
|||
|