Programmable Interval Timer

The Roland Juno used a Programmable Interval Timer, the 82C54 to divide the master clock into a usable note frequency.
These are designed as baud rate generators for serial driver chips, but can be used for synths by generating a perfect square wave.
In my design the master clock runs at 4MHz, the Juno 106 ran at 8MHz and I think the earlier Junos were 2MHz (but I’ve not studied those machines)

The counter is 16 bits, so you send 2 bytes LSB and MSB to the counter with the frequency you want to output.

Nice 80s style interface, data bus, address RD, WR and CS lines. You can read certain information from the chip, but I’m just pulling this high and not using it.

Above is the 8253, the newest version is the 82C54 and NEC make the uPD71054, but they’re pin compatible and do the same job. Some accept higher frequencies up to 12MHz, usually denoted by a -10 etc on the part number

If you read the datasheet we’re interested in Mode 3, Square wave.. The gate pins are high to enable counting and low to disable, the clock inputs are connected together and to the master clock.

The chips address is as follows:
0 0: Counter 0
0 1: Counter 1
1 0: Counter 2
1 1: Control word

The chip is setup using address 1 1 (3) and then a single byte sets up a single counter.
To write a count you send LSB first then MSB

Frequency Calculations

It’s easy to calculate the output, there’s 2 ways

Counter Value = Master Clock / Frequency
Frequency = Master Clock / Counter Value

So at 2MHz the lowest frequency we can generate is : 2,000,000 / 65,535 = 30.51Hz

 

The output is a perfect square wave, even if the input is a bit more triangular.