Using com1 on 328n

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
FFMan
Posts: 502
Joined: 09 January 2010, 12:52 PM

Using com1 on 328n

Post by FFMan »

I'm moving a GPS project from my prototype zx24p to a 328. On the zx24 i used h/w com2 to keep up with the gps output.

If i understand this correctly, I can use h/w com1 on the 328 exactly as i would have used com2 on the zx24p, so long as i don't use debug.print which would corrupt the comms.

If i want debug output, i can use a s/w com2 i assume and write my own routines to output to it ?
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Re: Using com1 on 328n

Post by dkinzer »

FFMan wrote:If i understand this correctly, I can use h/w com1 on the 328 exactly as i would have used com2 on the zx24p, so long as i don't use debug.print which would corrupt the comms.
That is correct but you should note that Com1 on all 24-pin ZX devices has inverted logic levels while they will are non-inverted at the ZX-328n pins. The only issue with using Com1 in your application is that you have to provide a way to switch the received data line between the PC and the other application device - they cannot both be driving the ZX RxD pin at the same time. The simplest way to handle this is to add some jumpers or a switch.
FFMan wrote:If i want debug output, i can use a s/w com2 i assume and write my own routines to output to it ?
The software UART ports are 3-6 so I presume you mean Com3. You can produce output for any com port (including Com1) by adding characters to the output queue. Both PutQueueStr() and PutQueueByte() may be useful for this purpose.
- Don Kinzer
FFMan
Posts: 502
Joined: 09 January 2010, 12:52 PM

Post by FFMan »

> That is correct but you should note that Com1 on all 24-pin ZX devices has inverted logic levels while they will are non-inverted at the ZX-328n pins

is that to say then that com1 on the 328 is the same as com2 on zx24 in terms of inversion ? (I don't use com1 on zx24)
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Post by dkinzer »

FFMan wrote:is that to say then that com1 on the 328 is the same as com2 on zx24 in terms of inversion ?
Yes. To recapitulate:
  • Com1 has inverted logic levels on all 24-pin ZX devices, non-inverted on all other ZX devices
  • All other HW USART ports (Com2, Com7, Com8, etc.) have non-inverted levels at the chip pins
  • All SW UART ports (Com3-Com6) are configurable for either inverted or non-inverted levels
- Don Kinzer
Post Reply