NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.
Microcontroller Programming » More than one UART on Atmega168? Or...
December 30, 2011 by mouse |
Does the ATMega168 that comes with the nerd kit have more than one uart? If so, how do i do this? If this isn't possible, can I receive at a certain baud rate, and send at another baud rate? Basically, i need to receive data from a controller program, and the only baud rate that is available is 4800. I then send data to another device that is connected, but that baud rate is 57600, and can't be changed. They are both 8N1 Any ideas of how to accomplish this with the 168? I suppose i could implement a "SoftwareSerial" solution and use another PIN, but i would like to be as elegant as possible. Thanks, all. -andy. |
---|---|
December 31, 2011 by Ralphxyz |
andy, would you need to receive and send at the same time? If so that would imply using two mcus. Or if you can receive, store the data in a buffer and then send it you "should" be able to use one 168. Now i.e.
I think Noter's I2C Master/Slave concept is the most "elegant" Intelligent Port Expander example! Imagine not just only having a Port Expander but having a programable/intelligent Port Expander. The possibilities there are endless and Paul (Noter, I sure miss him) did all of the heavy lifting for us. So with two (or more) 168 mcus as Master/Slave you could do near real time synchronous serial communications. Now that would be "elegant". Ralph |
December 31, 2011 by Rick_S |
Ralph, Do you know what happened to Paul?? I've noticed as well that he hasn't been in the forums for some time now. (sorry to get off topic) Andy, Another option to what Ralph brought up is using a differnt micro-controller that has two uarts such as an ATmega32 or similar. I have a write up on using an ATmega324 here on the forum to show how to install a bootloader to it to make it behave similarly to the NK micro you are used to. Rick |
December 31, 2011 by mouse |
OK cool... I will take a look at using two MCUs. Is the ATMega32 the only mega that has 2+ UARTS? I also have the 328. I suppose i could stop being lazy and look at the data sheets myself :) Thanks for the feedback! |
December 31, 2011 by treymd |
There are many Megas with multiple UARTs, not sure how many come in the DIP package though. The 100 pin QFP MEGA2560 I think it is, has 4 UARTs and a whole lot of IO. It is used in the Arduino Mega board, along with the Mega16U2 which has native USB and acts as the USB-UART converter. |
December 31, 2011 by Rick_S |
The 16U2 only will emualate a USB-UART converter if programmed to do so. However, there is a library (LUFA Project) that provides sample code to do it. Rick |
December 31, 2011 by Ralphxyz |
The "advantage" to using two mcus, even two dip 168s is that you can have true parallel processing. Each mcu can have it's own distinct processes running so you can be doing different things at the same time. Even using a four port UART device you can only do one thing at a time so "theoretically" (at least according to my thinking) the more "elegant" solution would be to use multiple mcus. Now if we want to pass on the elegance concept and just concentrate on getting the job done using a multi port mcu would definitely be the quicker method. Ralph |
Please log in to post a reply.
Did you know that our customers love us? Learn more...
|