Scor­pio News

  

April–June 1987 – Volume 1. Issue 2.

Page 13 of 51

on the ZC/TOn pin. This stream of pulses is then fed as a clock to the appropriate channel of the SIO. This situation covers the MAP CPU with the default links as provided:

LB2/2   – LB2/10LB2/3   – LB2/9LB2/13 – LB2/12LB2/1   – LB2/14
LB1/18 – LB1/4LB1/19 – LB1/3LB1/17 – LB1/5+6LB1/16 – LB1/7
LB1/20 – LB1/1

One other point which should be mentioned. Always use the assembler to calculate byte counts and ratios as far as possible. Remember that it does only 16 bit arithmetic, so we can’t use it to compute the division ration, but we certainly can and should use it to work out the byte count.

Suppose we require to use a modem? The CCITT V23 standard will require that we can receive and transmit at different baud rates (1200/75). Under the set up above, we have the receive and transmit clocks for SIO channel A tied to the same channel of the CTC (LB1/17 - LB1/5+6), so we can’t manage just as we are presently linked. We have spare CTC channel 2, and we could use channels 1 and 2 to provide 1200 baud and 75 baud clocks, and channel 2 to feed the second SIO channel. First of all, we must remake the links a follows:

LB2/1   – LB2/14LB2/12 – LB2/13LB2/1      – LB2/11LB2/2   – LB2/9+10
LB1/1 – LB1/20LB1/2   – LB1/19LB1/3+4 – LB1/18LB1/5   – LB1/17
LB1/6   – LB1/16LB1/7   – LB1/15

(These are as taken from my system Work. them out carefully – you may not need them all!). If we feed CTC channels 0 and 1 from the same clock (2MHz external) can we get the baud rates required? We have already done the calculation for the 1200 baud and know that 104 is the divisor. How about 75 baud?

2000000
divisor = -----------= 1666.7
75*16

We can’t fit that into one byte. Even using 64* mode on our SIO, we can’t do it. If we went to a 1 MHz clock, we can just manage. Unfortunately, I like to drive printers very fast, and for computer/​computer links, with no modems, I like 9600 baud. If we use 1 MHz clock, I can’t get 9600 baud. Is there another way?

Suppose we consider using the timer mode and consider first the 1200/75 baud problem. If we divide the system clock (4Mhz) by 256 in the prescaler, could we get the 75 baud we need? Let’s try:

4000000
divisor = -----------= 13
75*16*256

Lovely! Now we try for the 1200 baud. Immediately we realise that we’ll have to use the /16 prescaler rather than the /256.

4000000
divisor = -----------= 13
1200*16*16

No problems here! How about 9600 baud?

4000000
divisor = -----------= 1.6
9600*16*16

So that won’t work for 9600 baud. We are in the position that we can get 1200/75 baud clocks by using the divider mode of the CTC, but can’t get 9600 baud. If we apply a 2 MHz external clock, we can get 9600 baud clock, and slower, but not 75 baud. What do we do? We set up the links as above, supplying a 2 MHz clock to the CLK/​TRG pins of the appropriate channels, and

Page 13 of 51