CPC8 - Part II - The ICM7207
The ICM 7207 and CTC Channel 3
The Hardware
The ICM 7207 is a CMOS frequency divider IC, labeled "RTC" on the PCB[^rtc]. It's driven by a 6.5536 MHz crystal and that frequency is not accidental. 6,553,600 Hz = 100 × 2¹⁶, which means the ICM 7207 can divide it cleanly to produce standard real-time clock frequencies.
The Physical Connection
The ICM 7207's pulse output appears on J4 pin 9. CTC Channel 3's external clock input (CLK/TRG3, chip pin 20) appears on J4 pin 10. These two pins are adjacent on a pin header, jumping between pin 9 and pin 10 routes the RTC pulses directly into CTC Ch3.
The CTC Configuration
CTC Channel 3 is configured in counter mode (control word bit 6 = 1), not timer mode. In counter mode the CTC ignores the system clock entirely and counts the external pulses arriving on CLK/TRG3. With a time constant of TC=1, every single incoming pulse fires a zero-count interrupt. Jumping pins 13 and 14, the ICM 7207 outputs 50 Hz and you get exactly 50 interrupts per second, which is 20 ms per tick.
Phew so now I understand what is going into the CTC I can now setup Fuzix to use that timer to do our timing calculation for our dhrystone test.
And yes, here we go the results! A whooping 31.64 Dhrystones/s
# /bin/dhrystone
Dhrystone 2.2 CPC-8 Z80
CTC Ch3 ICM7207: 50 Hz Tick: 10/sec CLK: 2.4 MHz
Runs: 1000
Running...
Done.
Time: 31.6 s (316 ticks)
Dhrystones/s: 31.64
DMIPS: 0.018
--- Verification ---
Int_Glob: 5
Bool_Glob: 1
Ch_1_Glob: A
Ch_2_Glob: B
Arr_1[8]: 7
Arr_2[8][7]: 10
Ptr->Discr: 0
Ptr->Enum: 2
Ptr->Int: 17
Ptr->Str: DHRYSTONE PROGRAM, SOME STRING
Nxt->Discr: 0
Nxt->Enum: 1
Nxt->Int: 18
Nxt->Str: DHRYSTONE PROGRAM, SOME STRING
Int_1_Loc: 7
Int_2_Loc: 39
Int_3_Loc: 9
Enum_Loc: 1
Str_1_Loc: DHRYSTONE PROGRAM, 1'ST STRING
Str_2_Loc: DHRYSTONE PROGRAM, 2'ND STRING
#