Forum Index
HomeZBasic Home   Forum RulesForum Rules   Forum FAQForum FAQ   MemberlistMemberlist   UsergroupsUsergroups   RSS FeedRSS Feed
Site SearchSite Search   LinksLinks   DownloadDownload   Digests and SubscriptionsDigests and Subscriptions
ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in   RegisterRegister
Communication betewwen Zx24 and Zx1281 question

 
Post new topic   Reply to topic    Forum Index -> ZBasic Language
Author Message
hakha4



Joined: 02 Jun 2009
Posts: 38
Location: Moholm Sweden

Posted: 13 May 2010, 16:55 PM    Post subject: Communication betewwen Zx24 and Zx1281 question Reply with quote

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
Back to top
dkinzer
Site Admin


Joined: 03 Sep 2005
Posts: 2593
Location: Portland, OR

Posted: 13 May 2010, 17:33 PM    Post subject: Re: Communication betewwen Zx24 and Zx1281 question Reply with quote

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.
Back to top
hakha4



Joined: 02 Jun 2009
Posts: 38
Location: Moholm Sweden

Posted: 13 May 2010, 18:07 PM    Post subject: Reply with quote

Thank's. Is schematic below correct for noninverted mode ?


74hc04.png
 Description:
 Filesize:  7.6 KB
 Viewed:  5092 Time(s)

74hc04.png


Back to top
dkinzer
Site Admin


Joined: 03 Sep 2005
Posts: 2593
Location: Portland, OR

Posted: 13 May 2010, 18:23 PM    Post subject: Reply with quote

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?
Back to top
hakha4



Joined: 02 Jun 2009
Posts: 38
Location: Moholm Sweden

Posted: 13 May 2010, 18:49 PM    Post subject: Reply with quote

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?
Back to top
dkinzer
Site Admin


Joined: 03 Sep 2005
Posts: 2593
Location: Portland, OR

Posted: 13 May 2010, 19:03 PM    Post subject: Reply with quote

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.
Back to top
mikep



Joined: 24 Sep 2005
Posts: 771
Location: Austin, TX

Posted: 13 May 2010, 20:28 PM    Post subject: Reply with quote

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 14 May 2010, 0:15 AM; edited 1 time in total
Back to top
dkinzer
Site Admin


Joined: 03 Sep 2005
Posts: 2593
Location: Portland, OR

Posted: 13 May 2010, 21:19 PM    Post subject: Reply with quote

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.
Back to top
hakha4



Joined: 02 Jun 2009
Posts: 38
Location: Moholm Sweden

Posted: 14 May 2010, 14:18 PM    Post subject: Reply with quote

Thank's for help,I think I've got the idea now.
Regards Hucke
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Forum Index -> ZBasic Language Time synchro. with the server - Timezone/DST with your computer
Page 1 of 1

 


All content Copyright © 2005-2012 Elba Corp. All Rights Reserved.
Opinions expressed in posts are those of the author and not necessarily those of Elba Corp.
Powered by phpBB © 2001, 2005 phpBB Group