Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : Mixing TTL serial lines....
Author | Message | ||||
Grogster Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9083 |
Hi folks. I am wanting to mix two different serial streams into one system. Currently, I have one receiver and that is working fine(as designed), but I want to upgrade the system, and this requires that I use the new receiver as well as the old one, while in the transitional phase. Both receivers output 5v TTL, both output exactly the same baud-rate, 8N1 protocol and message packets. Both receivers output identical data packets, in other words. All I need to be able to do, is connect the data lines from both receivers together, so that the main system will respond to messages from either receiver. Simply connecting the two TXD lines together from both receivers I think is a bit of a no-no, and I expect it won't work, or perhaps even damage one of the receivers when one receiver tries to 'Drive' the other one's TXD output low kind of idea - never a fantastically wonderful idea. Does anyone have any circuits for doing this? Happy to look at anything at this point. Thanks for any replies. Smoke makes things work. When the smoke gets out, it stops! |
||||
Phil23 Guru Joined: 27/03/2016 Location: AustraliaPosts: 1664 |
Hi Grog, Any reason you can't just hang them off different com ports & handle with it in software, or are you out of spare Coms? I'd assume each port cold trigger a different interrupt sub & ultimately pass the message from either device to the rest of the code. Curious also; what are the Old & new receivers? Phil. Edit:- "Handle it within".... Been one of those days; brain warping. |
||||
KeepIS Guru Joined: 13/10/2014 Location: AustraliaPosts: 1401 |
Normally you would use two different comm ports, especially if the receive data is arriving at random times from whatever is sending the data, what happens when both get data at the same time? If only one port is available then you could poll the the sending units one at a time to send data and switch the appropriate transceiver onto the single comm port to do so. Perhaps I'm misunderstanding what it is you are trying to do. Mike. It's all too hard. Mike. |
||||
CaptainBoing Guru Joined: 07/09/2016 Location: United KingdomPosts: 1995 |
Hey Grogs. you well? are you not bothered about data collision - i.e. is the TX from the remotes triggered in some controllable way so you know which one will be talking? I have never done stuff like this - I would try to use different com ports for each one. If I was forced to merge the two signals; assuming a 1 is transmitted as a hi, then as TX tends to "rest" hi, I would expect to only be interested in lo section of comms, so pull the merged signal output high, drive it low and wire-OR the outputs onto a single RX pin on the reciever. Something like this: |
||||
Grogster Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9083 |
Hi chums. Can't use another serial port - all other pins are in use, and I mean ALL of them. System relies on the handy MMBASIC serial-port buffer to catch data and THEN react to it, so Cfunction-type serial ports are no good cos they don't have that sexy buffering. So, yes, I need to combine two receivers on the one com port. Perhaps a diagram would help. This is what I am trying to do: The Radiometrix receiver unit is what I am using now. This works fine. I want to add an HC12 as a receiving node, transmitting HC-12's at the other end which will send exactly the same data packet as the Radiometrix link does now, so I need the Micromite to be able to respond to either one, but not have either receiver upset the other with respect to their data lines. Due to transmitting node retries, data collisions are not an issue. Smoke makes things work. When the smoke gets out, it stops! |
||||
MicroBlocks Guru Joined: 12/05/2012 Location: ThailandPosts: 2209 |
Undetected data collisions would be an issue i think. Microblocks. Build with logic. |
||||
mikeb Senior Member Joined: 10/04/2016 Location: AustraliaPosts: 173 |
Hi Grogs, Why not just drop in a 74xx series 2 input'OR'gate. An input from each receiver and the output to the uMite. About as simple as I can think of and no reason why it shouldn't work. Regards, Mike B. There are 10 kinds of people in the world. Those that understand binary and those that don't. |
||||
VK2MCT Senior Member Joined: 30/03/2012 Location: AustraliaPosts: 120 |
Is the data into the Transmitters the same, and at the same time (exactly)? Are the 2 Transmitters in physical proximity ? John B |
||||
KeepIS Guru Joined: 13/10/2014 Location: AustraliaPosts: 1401 |
To add to what has been said, unless the transmitters only send data once every 900ms or longer, they will tramp on each other. I can duplicate that on the bench right now, two identical transmitters - free running (not synced) packet every 900 ms, anything less and they trash each other. That's a 32 byte packet @ 9600 B. It's a crude way to do it though. Some transceivers normally have an TX / RX buffer and I've used software serial on tiny Microchip 16F series running at 4Mhz with an ISR and never missed a byte. But as you said - no spare pins. Mike. It's all too hard. Mike. |
||||
mikeb Senior Member Joined: 10/04/2016 Location: AustraliaPosts: 173 |
@Grogs, Sorry mate. An 'OR' gate ? (Seniors' moment) That should read 'AND' gate. I take it that the HC modules are set on different channels. Otherwise, how will you resolve which one starts to send data out of its TX line ? Regards, Mike B. There are 10 kinds of people in the world. Those that understand binary and those that don't. |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 5923 |
I have used CaptainBoing's method without issues. (It is a simple AND gate) It does require the data sources to send their data at different times and/or very robust data integrity checks. If you are sending in parallel, data collisions will be frequent. If there is sufficient time between data packets, you could use a micromite as a FIFO buffer to delay one set sufficiently to be sure they don't collide. Jim VK7JH MMedit MMBasic Help |
||||
flip Senior Member Joined: 18/07/2016 Location: AustraliaPosts: 114 |
Hi Grogs, Another idea is if you can derive a CONTROL signal anywhere in your circuit which can determine if one is active, it can be used to drive an A/not-B selector using 74C00 or similar chip as per the following picture (assuming it uploads OK) Sorry that didn't work try this Regards, Phil |
||||
Quazee137 Guru Joined: 07/08/2016 Location: United StatesPosts: 529 |
Grogster From the data sheets it looks like you can just hook them together. As the NRX2 is OC with pullup and the HC12 has a 1k inline. and You said data collisions are not an issue. |
||||
Grogster Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9083 |
Thanks for the ideas, everyone. I will look into this a bit more. Transmitting nodes do NOT transmit at the same time, and they are often hours apart if at all - security alarms on doors and windows at night at a complex. They only ever transmit, if someone opens a door or window at night after lock-down. That having been said, the NRX2 receiver feeds into a PICAXE-08M2 data-filter, the output of which, is connected to the Micromite system. So technically speaking, it is a filtered output of the NRX2 receiver, via a PICAXE 08M2 data-filter chip. The output of the PICAXE filter is TTL 5v, 10k external pull-up to 5v supply. I do rather like the idea of using another Micromite, and hooking both receivers to COM1 and COM2, and outputting the data that way via a Cfunction serial transmitt pin or something. I also like the AND gate idea. Several ideas to think about. Smoke makes things work. When the smoke gets out, it stops! |
||||
isochronic Guru Joined: 21/01/2012 Location: AustraliaPosts: 689 |
Can the hc-12 echo it's serial input to output ? eg maybe the nrx2 serial output could be input to the hc-12 |
||||
Quazee137 Guru Joined: 07/08/2016 Location: United StatesPosts: 529 |
If your not using all the PICAXE pins maybe this will do. 2nd serial in on 0M82 This too maybe of use Daisy Chaining 08M Chips |
||||
Print this page |