Page 1 of 1
Using com1 on 328n
Posted: 11 June 2010, 2:42 AM
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 ?
Re: Using com1 on 328n
Posted: 11 June 2010, 8:40 AM
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.
Posted: 11 June 2010, 8:51 AM
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)
Posted: 11 June 2010, 9:13 AM
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