[comp.sys.amiga.tech] CIAB Timer Questions

dbk@teroach.UUCP (Dave Kinzer) (06/20/89)

   First let me thank Karl Lehnbauer, Paul Higgenbottom, et.al. for
the CIAB timer code.  I have substantially modified the code for my
own application, but it was a great starting point, saving me days
of time.  8^)

   I am trying to determine the exact timing of the counts but I cannot
get what I see in the documentation to agree with what was in the code.

   Problem: The code given appears to inherit whatever was in the
"inmode" bits of control register B (bits 6 and 5).  This might not
be a good assumption, since a previous task could set these to whatever
it wanted while it had the hardware.

  Assuming (go ahead, correct me 8^) ) that both bits are zero (the
only thing sensible to me), we are counting 02 clocks.  Of course, the
schematic does not have an 02 clock pin on the device, but us old 6800
hackers know that that is the E pin.  The E pin is generated by the
68000, and will be 1/8 the clock frequency.  Now, the analysis proceeds
like this.

   NTSC system crystal frequency:      28.63636 MHz
   7M clock = above/4 (68000 clock):    7.15909 MHz
   E clock = above/8  (02 pin):       894.88625 KHz

   Yeilding an E clock period of:     1.11746 uS


   Unfortunately, all the documentation for the code says the CIAB timer
runs at 1.396825 uS/clock.


So, HELP!!!    Where have I gone wrong?


   I would also like to make this work correctly for PAL machines, so I 
would like to know the exact frequency of the PAL machine's clock.


|    // GOATS - Gladly Offering All Their Support  Dave Kinzer (602)897-3085|
|   //  >> In Hell you need 4Mb to Multitask!  <<  uunet!mcdphx!teroach!dbk |
| \X/   #define policy_maker(name) (name->salary > 3 * dave.salary)         |

rsbx@cbmvax.UUCP (Raymond S. Brand) (06/20/89)

in article <11118@mcdphx.phx.mcd.mot.com>, dbk@teroach.UUCP (Dave Kinzer) says:
> Keywords: CIAB, Timer, Frequency
> Summary: Where does clock come from?
> 

[...]

> 
>   Assuming (go ahead, correct me 8^) ) that both bits are zero (the
> only thing sensible to me), we are counting 02 clocks.  Of course, the
> schematic does not have an 02 clock pin on the device, but us old 6800
> hackers know that that is the E pin.  The E pin is generated by the
> 68000, and will be 1/8 the clock frequency.  Now, the analysis proceeds
                    ^^^^^
                   this should be 1/10

> like this.
> 
>    NTSC system crystal frequency:      28.63636 MHz
>    7M clock = above/4 (68000 clock):    7.15909 MHz
>    E clock = above/8  (02 pin):       894.88625 KHz
> 
>    Yeilding an E clock period of:     1.11746 uS
> 
> 
>    Unfortunately, all the documentation for the code says the CIAB timer
> runs at 1.396825 uS/clock.
>

The E clock from a 68000 runs at 1/10 the rate of the processor clock and
this is what the 02 clock on the 8520s is. On an NTSC Amiga, the EClock is
715909Hz, and on a PAL Amiga it is 709379Hz.

These clock rates are also part of the bus spec, so they shouldn't change
when new machines are introduced.

WARNING: If you have a genlock in you system, the master clock (28MHz) is
supplied by the genlock. This means that the EClock will be 1/40 of that
clock rate.

----------------------------------------------------------------------
Raymond S. Brand		Commodore-Amiga
...!uunet!cbmvax!rsbx		1200 Wilson Drive
(215)-431-9100			West Chester PA 19380