Where is the 2nd h/w uart on a zx24n ?

Discussion of issues related specifically to writing code for native mode devices. This includes ZBasic code as well as assembly language code and C code, both inline and standalone.
Post Reply
FFMan
Posts: 502
Joined: 09 January 2010, 12:52 PM

Where is the 2nd h/w uart on a zx24n ?

Post by FFMan »

can any pins be used to make use of the 2nd h/w uart on the zx24n or are there specific pins ?

I can't locate any documentation giving the answer.

thanks
pdubinsky
Posts: 70
Joined: 24 November 2005, 18:19 PM
Location: South Carolina
Contact:

Zbasic Native Mode Com2

Post by pdubinsky »

Com2 pins are hardware assigned. See USART chart on page 17 of the ZBasic System Library Reference Manual.

P
FFMan
Posts: 502
Joined: 09 January 2010, 12:52 PM

Post by FFMan »

great thanks

I see an interesting little foot-note that appplies to zx24n of:-

¹For these devices, the Com1 signals are logically inverted, the Com2 signals are not, however

so does that mean that if i convert code from zx24 using a software usart that i need to invert the signals or does does this mean the h/w usart behaviour is the same as the s/w usart ?
pdubinsky
Posts: 70
Joined: 24 November 2005, 18:19 PM
Location: South Carolina
Contact:

Zbasic Native Mode Com2

Post by pdubinsky »

so does that mean that if i convert code from zx24 using a software usart that i need to invert the signals or does does this mean the h/w usart behavior is the same as the s/w usart ?
I'm not sure exactly what you are asking but you cannot change the invert state on comm2. See page 70, DefineCom(). If the receiving end is expecting an inverted signal, you'll have to add hardware inverters b/n h/w comm2 and the receiving end since you can't invert the signal in software.

P
FFMan
Posts: 502
Joined: 09 January 2010, 12:52 PM

Post by FFMan »

ok i see - so i can't set/change the invert on a h/w usart but i can on a s/ware one.

So its possible I will need to add h/w to invert my signals if the h/w usart is opposite to my device (a GPS module). I need to go take a look....
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Post by dkinzer »

FFMan wrote:so i can't set/change the invert on a h/w usart but i can on a s/ware one.
That is correct. You must always check the datasheet for the device you're connecting to find out if it uses inverted or non-inverted serial signals. If you are using a SW UART on the ZX , you then select the matching polarity in the DefineCom() call. If you are using a HW UART on the ZX, you must add external inversion if the polarity does not match that of the external device. The issue is the same in both cases; the only difference is in how you implement the matching polarity.
- Don Kinzer
FFMan
Posts: 502
Joined: 09 January 2010, 12:52 PM

Post by FFMan »

so, if i open my current sw port with a mask of

by_Mask=bx00001000

will i need external inverting h/w or not ?

thanks
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Post by dkinzer »

FFMan wrote:will i need external inverting h/w or not ?
If you are using a SW UART (Com3 to Com6) you never need an external inverter, assuming the device operates at TTL signal levels. Rather, if you need inverted logic just add &H80 to the flags for DefineCom(). Note, however, that if the external device uses standard RS-232 signal levels you'll have to use an external level converter (which includes a signal inversion).

An external inverter is needed in these cases:
  • You're using Com1 on a 24-pin ZX device and the device with which you're communicating requires non-inverted signals.
  • You're using Com1 on a ZX device other than one of the 24-pin series and the device with which you're communicating requires inverted signals.
  • You're using Com2, Com7, Com8, etc. and the device with which you're communicating requires inverted signals.
If a device has a serial output signal, you can generally determine whether it uses inverted or non-inverted signals by checking the state of its serial transmit line when idle. If it is at logic 1 when idle then it is non-inverting. If it is is at logic 0 when idle then it is inverting.

If you're not sure whether the device outputs TTL signal levels or RS-232 signal levels, use a voltmeter to measure the voltage on the serial transmit line. If the voltage is 3 to 5 volts when idle, it is probably non-inverted TTL signal levels. On the other hand, if the idle voltage is -3 to -15 volts when idle, then it is using standard inverted RS-232 levels. In the latter case, you'll need an RS-232 level converter (which includes an inversion) to get non-inverted TTL signal levels.
- Don Kinzer
FFMan
Posts: 502
Joined: 09 January 2010, 12:52 PM

Post by FFMan »

thanks don

what i was asking was that given the mask in my previous post works with my gps on a s/w channel, do you think i will be able to use a h/w channel without inverters ?

i ask because the project i'd like to modify to use he zx24n doesn't have any room for an inverter.

thanks
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Post by dkinzer »

FFMan wrote:do you think i will be able to use a h/w channel without inverters ?
If communication with the external device works on a SW UART channel with the flags value of &H08, then it means that that device uses non-inverted, TTL-level I/O for its serial communication. That being the case, you should be able to use Com2 without external inversion. This conclusion is consistent with my earlier description of when you need inversion and/or level conversion.
- Don Kinzer
Post Reply