[GreenKeys] Model 15 C-64 rate question

John Nagle nagle at animats.com
Sun Jul 5 15:54:24 EDT 2015


> On 07/04/2015 11:33 AM, drlegendre . wrote:
>>
>> >>Thinking about trying to use a C-64 to communicate with a model 15 that
>> >>should be arriving in a couple of months. The native RS-232 routine on
>> >>the Commodore has a minimum baud rate of 50, whereas the 15 wants 45.45
>> >>or so I've heard.
>> >>
>> >>Will the 15 tolerate 50 baud? FWIW the C-64 routine sets a pair of
>> >>256-byte FIFO I/O buffers for RS-232 communications, not sure how that
>> >>might come into play.
>> >>
>> >>If it can't take continuous data at 50 baud, what if I only send one
>> >>character at a time, with a slight delay such that the total CPM doesn't
>> >>exceed the max char rate of 50 baud? IOW, can it take one character's
>> >>worth of bits a little faster, so long as the next character doesn't
>> >>arrive too soon?
>> >>
>> >>Thanks for any input.

    The speed tolerance of a model 15 is about 7%, so it might work.
But you can easily set the baud rate for a Commodore 64 to 45 baud.
See page 350 of the manual, for the Open command.

http://www.commodore.ca/manuals/c64_programmers_reference/c64-programmers_reference_guide-06-input_output_guide.pdf

OPEN Ifn,2,O,"<control register> <command register> <opt baud low> <opt 
baud high>"

"If the lower 4 bits of the baud rate is equal to 0, the
<opt baud low> <opt baud high> characters give you a rate
based on the following:

   <opt baud low>=<system frequency/rate/2-100-<opt baud high>*256

   <opt baud high>=INT(<system frequency/rate/2-100)/256)

   System frequency is 1.02273E6 for US NTSC units and
   O.98525E6 for European PAL units.

So, for an NTSC unit,

   <system frequency>/rate/2-100
= 1022730/45.45/2-100
= 11147

which is the clock divisor to be used.

The basic concept in classic UARTs is that there's a "divisor" and a 
counter driven from the system clock. The counter counts at the
system clock rate until it is equal to the divisor registor. Then
the  UART does a bit cycle and the counter resets.
The clock divisor is fed to the UART as two bytes, because this
is a machine with an 8-bit bus width.

   <opt-baud-high> = INT(divisor/256) = 43
   <opt-baud-low> = divisor - <opt-baud-high>*256 = 139

The "control register" should be 1110000 binary, for
2 stop bits, 5 data bits, user-selected speed.
This is decimal 224.

The "command register" should be 00010000, for
no parity, full duplex, no handshake.
This is decimal 16.

So try

OPEN 1,2,O,"224 16 139 43"

which should give you a 45.45 baud 5 bit no parity
full duplex serial port as file #1.

This is untested, but it's all in the manual.

				John Nagle


More information about the GreenKeys mailing list