Could I be Causing A Slowdown By Using 3 Software Channels?

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
jburrow
Posts: 11
Joined: 03 January 2011, 15:27 PM

Could I be Causing A Slowdown By Using 3 Software Channels?

Post by jburrow »

I have been successfully using a ZX24p with 2 software com channels. Channel 3 is 19k2 inverted, 8, none, 1 and Channel 4 is 2400, 8, none, 1.

I added a Channel 5 at 9600, 8, none, 1. This appeared to cause a significant slow down in the processing.

As an experiment, I moved the communication on software Channel 5 over to hardware Channel 2, and the slow down appeared to go away.

I'm new to this, so I have to ask, does the above scenario seem plausible, or am I doing something wrong??

Can I infer that it would be better to use multiple hardware channels (like on the ZX-1280), on the theory that hardware channels use less processing power than the software channels?

Thanks, John Burrow
dlh
Posts: 395
Joined: 15 December 2006, 12:12 PM
Location: ~Cincinnati

Post by dlh »

From the manual discussion in ComChannels()...
Also note that when supporting two or more channels, there is a small possibility that incoming characters might not be properly recognized at the highest rate. The probability of not being able to properly
synchronize on the incoming character’s start bit increases with each additional channel that is supported. For this reason, it is recommended that the maximum baud rate be limited to 9600 when configured for 2 or more channels.
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Re: Could I be Causing A Slowdown By Using 3 Software Channe

Post by dkinzer »

jburrow wrote:Can I infer that it would be better to use multiple hardware channels (like on the ZX-1280), on the theory that hardware channels use less processing power than the software channels?
Indubitably. The hardware serial channels generate an interrupt once every frame (10 bits when using 8 data bits, 1 stop bit) and the code to service the interrupt is fairly slim. In contrast, when one or more software serial channels is open an interrupt is generated a four times the bit rate of the fastest channel - that's 40 times as often as for a hardware channel running at the same rate. Moreover, the code to service the software channel interrupt is significantly more involved. The net result is that even a single software channel imposes upwards of 100 times the load as compared to a single hardware UART channel.

There was some discussion about the load imposed by software UART channels in a thread early last year:
http://www.zbasic.net/forum/about1295.html
- Don Kinzer
jburrow
Posts: 11
Joined: 03 January 2011, 15:27 PM

Post by jburrow »

Thanks Don.

I went ahead and ordered the ZX-1280, so I can use the extra hardware UARTs.

Previously, we had a discussion about my need to communicate at 19K2, Inverted.

Am I correct in thinking I have to use a software UART for Inverted communication?

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

Post by dkinzer »

jburrow wrote:Am I correct in thinking I have to use a software UART for Inverted communication?
The AVR mega hardware UARTs don't support inverted mode; you'll have to add an external inverter on each line that you need to be inverted.

In contrast, the xmega has the ability to invert the sense of any I/O pin, including those used for the hardware UARTs. To use this capability you need to call DefineCom() to specify inverted mode before you open the Com port.
- Don Kinzer
Post Reply