Baud Rates

153 views
Skip to first unread message

Interocitor Steve

unread,
Jul 4, 2023, 2:02:18 PM7/4/23
to retro-comp
I know others have blazed a trail before me.
Would you guys take a look at this table and see if it makes sense? Maybe there is a "standard" way of doing this.  -Thanks
=Steve.


Baud Notes.jpg

John Monahan

unread,
Jul 4, 2023, 3:47:35 PM7/4/23
to retro-comp
Using the following initialization code:-
.......
xor          a ; Disable refresh (not really required)
out0 (z180_rcr),a
; To make PHI=Osc Input, set bit 7 of CCR
; To make OHI=2X Osc Input, set bits 7 of CCR and CMR
ld a,CLOCK_VALUE_CMR ; 00H, Set clock speed,(normally 0H)
out0 (z180_cmr),a                      ; set CMR
ld a,CLOCK_VALUE_CCR
out0 (z180_ccr),a ; set CCR
......
ld a,64h ; xmit enable, rcv enable, 8 data bits, no parity
out0 (z180_cntla0),a
ld a,CNTLB0_VALUE
out0 (z180_cntlb0),a
ld a,60h ; dcd0 disable, cts0 disable
out0 (z180_asext0),a
.....

By shooting in the dark I arrived at the following table:-

CLOCK_VALUE_CMR equ    xxH ;For setting CPU clock speed
CLOCK_VALUE_CCR equ yyH ;  "      "
CNTLB0_VALUE        equ     zzH                            ; For setting final baud rate from clock
;
;  (CMR)       (CCR)        (CNTLB0)     Baud       PHI
;  00H          80H            20H               38,400             18.432 MHz           ;Using 18.432MHz Oscillator
;  00H          00H            20H               19,200             9.2 MHz ;Using 18.432MHz Oscillator
;  00H          80H            00H               115,200          18.432 MHz ;Using 18.432MHz Oscillator
;
;  00H          00H            00H               57,600             9.2 MHz ; 18.432MHz Oscillator , Setting for S100 Bus Interface

Does anybody else here care to fill in other values.

John

Interocitor Steve

unread,
Jul 4, 2023, 5:52:18 PM7/4/23
to retro-comp
Am I right in assuming that the SIO needs to be in at least a divide by 16 pre-scalar for ASYNC?  Divide by 1 doesn't work, I think?

Douglas Miller

unread,
Jul 4, 2023, 6:42:49 PM7/4/23
to retro-comp
ASYNC on any UART pretty much requires 16x or greater - if you want reliable communications. I'm sure someone's going to contradict me, but unless the two sides of the serial cable are already synchronized some other way and running at exactly the same baud, you're just asking for trouble.

Mark T

unread,
Jul 4, 2023, 8:10:58 PM7/4/23
to retro-comp

I guess it doesn’t have to be 16x but that does seem to be the standard on all the uarts that I know about. You need to detect the start of the start bit, the count the delay to the middle of the first data bit and sample each data bit. It could probably work with x1 if you could add 0.5 delay and restart the clock.
Message has been deleted

Wayne Warthen

unread,
Jul 4, 2023, 11:02:47 PM7/4/23
to retro-comp
I'm not sure I'm entirely following this message chain, but I have a couple of spreadsheets included with RomWBW that enumerate potential baud rates given a variety of input clocks.  One is for SIO + CTC and the other is for the built-in Z180 UART:

Thanks,

Wayne

On Tuesday, July 4, 2023 at 11:02:18 AM UTC-7 Interocitor Steve wrote:

Interocitor Steve

unread,
Jul 5, 2023, 1:01:20 AM7/5/23
to retro-comp
Thank you Wayne.  I looked at the SIO + CTC doc.  This is what I am looking for.
My question is this. Does the CTC required that a divide by 16 (or 256) pre-scalar be used in Counting mode.  I think it does which would make your chart 16 times faster.
See the new chart below.  The previous one had an error.
If the CTC requires that  pre-scalar be used, then divide by16 for the CTC, and divide by16 for the SIO gives a divisor of 256.
And, there seems to be difference between Timer and Counter mode on this stuff.
=Steve.
clock.jpg

Interocitor Steve

unread,
Jul 5, 2023, 1:03:29 AM7/5/23
to retro-comp
BTW, what is RomWBW?

On Tuesday, July 4, 2023 at 11:02:47 PM UTC-4 Wayne Warthen wrote:

Steve Cousins

unread,
Jul 5, 2023, 11:36:21 AM7/5/23
to retro-comp
These are the settings used by SCM

; Time constant table (7.3728 MHz)
;  +----------+--------------+---------------+---------------+
;  |  Serial  |   Baud rate  |  CTC setting  |  CTC setting  |
;  |    Baud  |        code  |   SIO div 16  |   SIO div 64  |
;  +----------+--------------+---------------+---------------+
;  |  230400  |   1 or 0x23  |            1  |               |
;  |  115200  |   2 or 0x11  |            2  |               |
;  |   57600  |   3 or 0x57  |            4  |               |
;  |   38400  |   4 or 0x38  |            6  |               |
;  |   19200  |   5 or 0x19  |           12  |               |
;  |   14400  |   6 or 0x14  |           16  |               |
;  |    9600  |   7 or 0x96  |               |            6  |
;  |    4800  |   8 or 0x48  |               |           12  |
;  |    2400  |   9 or 0x24  |               |           24  |
;  |    1200  |  10 or 0x12  |               |           48  |
;  |     600  |  11 or 0x60  |               |           96  |
;  |     300  |  12 or 0x30  |               |          192  |
;  +----------+--------------+---------------+---------------+

The baud rate code is just the parameter used within SCM to specify the baud rate.

Steve Cousins

unread,
Jul 5, 2023, 11:37:34 AM7/5/23
to retro-comp
RomWBW info:
https://github.com/wwarthen/RomWBW
Download and take a look at the extensive documentation

Interocitor Steve

unread,
Jul 5, 2023, 6:46:28 PM7/5/23
to retro-comp
It was difficult but not impossible.  Using the CTC Clock 0 to pre-scale an input Clock 1 and Clock 2, I finally have all the baud rates I need for Sync and Async needs.  I have the rates I need down to 45.45 Baud.  Thanks to all for all your help.  I found some documentation on the CTC from 1984 and it well written and explains it all.
See the elaborate scheme below.
=Steve.
Clocks.jpg
Reply all
Reply to author
Forward
0 new messages