Communication betewwen Zx24 and Zx1281 question

Discussion about the ZBasic language including the System Library. If you're not sure where to post your message, do it here. However, do not make test posts here; that's the purpose of the Sandbox.
Post Reply
hakha4
Posts: 47
Joined: 01 June 2009, 21:23 PM
Location: Moholm Sweden

Communication betewwen Zx24 and Zx1281 question

Post by hakha4 »

I have a project with multiple relay's,sensor's and Ds1820's for reading temp's. I want to offload the Zx1281 from reading temp's since it takes quite a lot of time for conversion and use a Zx24 for that job. On demand I then get temp stored in variable's from zx24. I want to use Com1 on zx24 to communicate to a port on Zx1281. I'm a bit confused about the hardware bit. Can Com1 on zx24 ('slave') communicate directly without converting to Rs232 to my 'master' micro ? If conversion is a must what method is easiest and reliable ( I've seen suggestions using 74hc04,just resistors or Max232)
Any help is appreciated
Regards Hucke
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Re: Communication betewwen Zx24 and Zx1281 question

Post by dkinzer »

hakha4 wrote:Can Com1 on zx24 ('slave') communicate directly without converting to Rs232 to my 'master' micro ?
Whenever you want to connect two devices using asynchronous serial communication you have to ensure that the signals are compatible. This includes
  • ensure that the signals have compatible logic level (i.e. 0 to Vcc or +V to -V)
  • ensure that the signals are the same logical sense (inverted or non-inverted)
  • ensure that the UARTs are configured for the same baud rate, number of data bits, parity, number of stop bits, etc.
Your question, I believe, relates to the first two items.

On all 24-pin ZX devices, the Com1 signals are inverted and have a voltage range of 0 to Vcc. If you want to connect those signals to a "software UART" port on the ZX-1281, you could connect the ZX-24 Com1 signals directly to the ZX-1281 pins but you would need to configure the software UART on the ZX-1281 to use inverted mode. If you prefer, you could also use external inverters and configure the software UART for non-inverted mode. Direct connection at "TTL" levels should work reliably over short distances (up to a few feet) in a relatively "quiet" environment. The noisier the environment, the shorter the maximum distance.

If you want to connect two devices that are farther apart (perhaps up to a few hundred feet) you would need to use RS-232 level converters on each end. (Since level converters generally invert, the end-to-end result is no inversion.) For even longer distances, RS-485 would be more appropriate.
- Don Kinzer
hakha4
Posts: 47
Joined: 01 June 2009, 21:23 PM
Location: Moholm Sweden

Post by hakha4 »

Thank's. Is schematic below correct for noninverted mode ?
Attachments
74hc04.png
74hc04.png (7.6 KiB) Viewed 6062 times
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Post by dkinzer »

hakha4 wrote:Is schematic below correct for noninverted mode ?
There isn't enough information to say for certain. If the ZX-24 pins are 1 (Tx) and 2 (Rx) and the pins on the ZX-1281 are SW UART pins, then you would configure the SW UART for non-inverted mode. It would also work if the ZX-1281 pins are HW UART pins (directly connected, no inverters or level shifters).

Are you using a ZX-1281, ZX-1281n, ZX-1281e or ZX-1281ne?
- Don Kinzer
hakha4
Posts: 47
Joined: 01 June 2009, 21:23 PM
Location: Moholm Sweden

Post by hakha4 »

I'm using ZX-1281e . In schematic Pin1 = Tx and pin 2 = Rx on ZX-24. Com1 on ZX-1281e is used for communication with a pc so I'll use either a SW Comport or HW Com 2 to communicate with Zx-24p. Did I understand You right ? If using HW port2 I get non-inverted mode without the 74Hc04?
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Post by dkinzer »

hakha4 wrote:If using HW port2 I get non-inverted mode without the 74Hc04?
Hardware UART channels are always non-inverted except for Com1 on the 24-pin ZX devices. Except for the USB devices, Com1 on Oak Micros ZX devices is inverted with RS-232 levels but in most cases there is access to the TTL level (non-inverted) signals.

With the external inverters on the ZX-24 Com1 signals, you'll have non-inverted signals at the ZX-1281. Consequently, you can connect them directly to the HW UART pins (which are never inverted) or to the pins for a SW UART configured for non-inverted mode.
- Don Kinzer
mikep
Posts: 796
Joined: 24 September 2005, 15:54 PM

Post by mikep »

hakha4 wrote:I'm using ZX-1281e . In schematic Pin1 = Tx and pin 2 = Rx on ZX-24. Com1 on ZX-1281e is used for communication with a pc so I'll use either a SW Comport or HW Com 2 to communicate with Zx-24p. Did I understand You right ? If using HW port2 I get non-inverted mode without the 74Hc04?
If you are using a ZX-24P then you can connect COM2 on the ZX-24P to COM2 on the ZX-1281e without the need for any inverters.

<<Fixed negation as noted by Don below>>
Last edited by mikep on 13 May 2010, 17:15 PM, edited 1 time in total.
Mike Perks
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Post by dkinzer »

mikep wrote:If you are using a ZX-24P then you cannot connect [...]
Did you mean can connect? I believe that the statement would be correct with that change.
- Don Kinzer
hakha4
Posts: 47
Joined: 01 June 2009, 21:23 PM
Location: Moholm Sweden

Post by hakha4 »

Thank's for help,I think I've got the idea now.
Regards Hucke
Post Reply