1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-02-19 07:31:15 +00:00

Corrects both style and content.

Thomas Harte 2018-08-08 10:15:18 -04:00
parent aaac55b703
commit 973f11627d

@ -1,11 +1,16 @@
There is one capacitor per input.
If you access `C070` then all the input capacitors will be allowed to start charging. Each analogue input at `C064` to `C067` will then read b7=1 until its corresponding capacitor has fully charged. Upon any capacitor becoming fully charged, the corresponding b7 will change to 0 and the capacitor will begin to discharge.
If you access `C070` then all the input capacitors will be allowed to start charging. Each analogue input at `C064` to `C067` will then read b7=0. When any capacitor becomes fully charged, the corresponding b7 will change to 1 and the capacitor will be permitted to discharge.
Discharges take 250ns, less than a processor cycle.
Charges take an amount of time proportional to the analogue input; the built-in routine `PREAD` is implemented so that 2.82ms is assumed to be the longest the capacitor might want to charge, and integer values between 0 and 255 are spread linearly across the time range. E.g. a value of 64 implies approximately 1/4 of 2.82ms passed.
So the only caveat is that you can't inherently assume whether each capacitor is already charging when you access `C070`. If it is, it will be fully charged sooner than the input suggests it should be.
# Triggering close charges
The workaround is either to check whether the channels you're interested in are charging before triggering `C070`, or else just leave a long enough period for your application between accesses. With paddles and joysticks, any period longer 2.82ms should do.
Some capacitors may already be in the process of charging when you access `C070`. If so then they will be fully charged sooner than expected.
So either:
* check whether the channels you're interested in are charging before triggering `C070`; or
* make sure you always leave a sufficiently long period between triggers so that all capacitors can be assumed to have completed their charge and discharge cycle. With paddles and joysticks, any period longer 2.82ms should do.