Go Down

Topic: Interrupt and softserial (Read 1 time) previous topic - next topic

Madeleine

I'd like to do serial communication "sporadically" with two different external units. As I understand, the softserial library is blocking, right? So I guess using interrupts is a way to "circumvent" this.

I do have pins that go low when the external unit sends something, and  I know for a fact that these won't interrupt simultaneously. (I.e. 1 pin for the interrupt and one for reading serial data from the external part).

I am not sending anything to the external unit.

Can anyone point to a brief example of how to do this with two units? Is it possible to do with three?





mem

Perhaps you haven't had a response because what you want to do is not easily done. I would guess an implementation would need to have the interrupt code monitor a clock counter to build up a snapshot of the incoming pulse timing for the one or more serial streams. It sounds doable, particularly if the data rate was low enough, but it's real tricky even if you have experience with interrupts, timers and serial bit banging.  I don't recall seeing any code posted that does what you want but you may be able to find something in a search with one or more of the following keywords:
  Software serial receive bit banging interrupt.

Good luck.

CasNet

Greetings,

Although this might be an interesting programming exercise, and possibly even useful for a company who intended to make a bazillion of these things, but for a normal user, it might be a good place to use some external UARTs to receive the external serial streams and buffer them in parallel FIFOs. Then the Arduino could poll the status of the UARTs and read the received data. It's not a requirement that everything be done inside the arduino. Sometimes support hardware is the best way to accomplish something.

Regards,
David

Go Up