[comp.sys.mac] EXACT screen refresh rate, and other items

duc@wjh12.UUCP (05/29/87)

Everywhere in Inside Mac I see that the Mac redraws the screen every
60th of a second (60 Hz).  Now I read in an article describing
PsychLib from Rice University that the screen refresh rate is 60.15Hz.
Does anyone know where this figure come from?  Are they wrong?

Is there an authoritative source of information on Mac hardware, to tell
you things like how long it takes for a keystroke to be read (using GetKeys,
not GetNextEvent), how come Button() looks for posted mouse events, and
not look at the low memory global (MBState) (does it??  does MBState
only get updated every 60th of a second? In sum, how come Button() only
returns a TRUE at tick boundaries? )  I'm interested in answers in the
millisecond range.

-dan costin

zben@umd5.umd.edu (Ben Cranston) (05/31/87)

In article <71@wjh12.HARVARD.EDU> duc@wjh12.UUCP (Dan Costin) writes:

> ... In sum, how come Button() only returns a TRUE at tick boundaries?

The tick is probably used to debounce the button, otherwise you would
see many hundreds of buttonpresses each time the contacts break or make.

I was reading the Vertical Retrace Manager section of IM last night, and
I'm quite sure it said "button down for at least 4 ticks"...  If you want
more accuracy you could do the debouncing yourself.  Look at the hardware
button indicator.  When it changes state, wait awhile and check it again.
Don't accept a change till it settles down.  If your program has nothing
better to do you could use a timing loop, but perhaps each cycle of your
event loop would be fast enough to get reliable debouncing AND the better
than "tick" resolution you imply you require...
-- 
Copyright 1987 Ben Cranston (you may redistribute ONLY if your recipients can).
       umd5.UUCP    <=      {seismo!mimsy,ihnp4!rlgvax}!cvl!umd5!zben
zben @ umd2.UMD.EDU         Kingdom of Merryland UniSys 1100/92
       umd2.BITNET          "via HASP with RSCS"

hughes@endor.harvard.edu (Brian Hughes) (05/31/87)

In article <1719@umd5.umd.edu> zben@umd5.umd.edu.UUCP (Ben Cranston) writes:
> ... The tick is probably used to debounce the button, ...

	I don't have my mac yet, nor IM, nor schematics, so this might
be a dumb question, but - hardware switch debouncing circuits have been
around for longer than micros. You can make one with part of a real
dumb chip. Why does Apple use/need software to debounce the switch ??

wetter@tybalt.caltech.edu (Pierce T. Wetter) (06/02/87)

>
>	I don't have my mac yet, nor IM, nor schematics, so this might
>be a dumb question, but - hardware switch debouncing circuits have been
>around for longer than micros. You can make one with part of a real
>dumb chip. Why does Apple use/need software to debounce the switch ??

    One thing that de-bouncing chips require is a debounce clock. Debouncer 
chips work by remembering if the input lines have been toggled in the last
x clock periods - about what the software does. Personally I'm not
surprised they didn't put one in just for debouncing the mouse. 
   Pierce Wetter

The USA is so enormous, and so numerous are its schools, colleges and
religious seminaries, many devoted to special religious beliefs ranging
from the unorthodox to the dotty, that we can hardly wonder at its
yielding a more bounteous harvest of gobbledygook than the rest of the
world put together.
		-- Sir Peter Medawar

--------------------------------------------

wetter@tybalt.caltech.edu

--------------------------------------------

cetron@utah-cs.UUCP (06/03/87)

In article <2895@cit-vax.Caltech.Edu> wetter@tybalt.caltech.edu.UUCP (Pierce T. Wetter) writes:
>    One thing that de-bouncing chips require is a debounce clock. Debouncer 
>chips work by remembering if the input lines have been toggled in the last
>x clock periods - about what the software does. Personally I'm not

	wrongo, a good switch debouncer can be made with a single quad nand
gate as I recall (ttl 7400??) and two jumpers...no clock not nothing, you
could also use a 555 timer in monostable mode, or even a one-shot......and
these chips in quantity aren't more than a penny or a dime..

-ed

wetter@tybalt.caltech.edu (Pierce T. Wetter) (06/03/87)

In article <4619@utah-cs.UUCP> cetron@utah-cs.UUCP (Edward J Cetron) writes:
>
>	wrongo, a good switch debouncer can be made with a single quad nand
>gate as I recall (ttl 7400??) and two jumpers...no clock not nothing, you
>could also use a 555 timer in monostable mode, or even a one-shot......and
>these chips in quantity aren't more than a penny or a dime..

     The Mc14490 is specifically a Hex switch debouncer which works as I 
described. _Yes_ it is possible to debounce a switch any of a millon different
ways. One Shots, RC networks and inverters, latches etc. All of those require
other components such as resistors and capacitors or must be initialized 
(latches). These all make the board a little more complicated. If you realize
that doing the debounce in software using the 60Hz interrupt costs you maybe
absolutely nothing since for most purposes knowing the button state more 
accuatly then 1/60th of a second is rediculous. (The Mac doesn't actually 
debounce the mouse it only reads it once every 60th. If the mouse has changed
state it posts an event.) If you really need to know the mouse state more 
accuratly then that, read the Via...
Pierce Wetter

Politician, n.:
	From the Greek "poly" ("many") and the French "tete" ("head" or
"face," as in "tete-a-tete": head to head or face to face).  Hence
"polytetien", a person of two or more faces.
		-- Martin Pitt

--------------------------------------------

wetter@tybalt.caltech.edu

--------------------------------------------

straka@ihlpf.UUCP (06/04/87)

In article <4619@utah-cs.UUCP> cetron@utah-cs.UUCP (Edward J Cetron) writes:
>In article <2895@cit-vax.Caltech.Edu> wetter@tybalt.caltech.edu.UUCP (Pierce T. Wetter) writes:
>>    One thing that de-bouncing chips require is a debounce clock. Debouncer 
>>chips work by remembering if the input lines have been toggled in the last
>>x clock periods - about what the software does. Personally I'm not

>could also use a 555 timer in monostable mode, or even a one-shot......and
>these chips in quantity aren't more than a penny or a dime..

Yes, the individual part is cheap.  Now add the 3 or 4 discretes to hang
on to it, the extra 1/3 to 1/2 sq. in. of board space, and its cost on a
4-layer board, potential extra cabinet volume (with additional plastic
cost), the extra cost of board failures (from random defects on the
board itself, assembly (soldering) or doa chips), the extra power to
supply the chip, extra heat to get rid of, ... Need I go on?  You can
nickel and dime a machine to death, unfortunately. 

There are a lot of overhead costs in electronic design and assembly.  I
still consider it amazing that Apple was able to integrate all the Mac
functionality on that tiny little board, anyway.  My desk also
appreciates it. 
-- 
Rich Straka     ihnp4!ihlpf!straka

Advice for the day: "MSDOS - just say no."