Puttin 2 devices on mega8A usart.

Go To Last Post
2 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am new to microcotrolers. Can I put two devices on the usart pins of a mega8A. And if I can what do I need to do C++ wise.

Device 1 is an RF transmitter module from Sparkfun.

Devie 2 is a rangefinder module that puts out a serial output, and needs a 2byte command.

What other info do you guys need to help me sort it out?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

That depends, are you talking about asynchronous serial or something like SPI?

For async, there are two main problems:

#1 the end-device's transmit pin being active driven, preventing either device from transmitting

#2 sending data to the corresponding device from the microcontroller, without the other device doing anything with it.

SPI solves this by allowing multiple slaves, selected by a chip-select pin.

You can emulate this behaviour for async by using a quad-buffer with grouped or individual output enable pins. By enabling the correct two ports of the buffer, you can select which device to talk to.