On Wed, 9 Jun 1999, pete moss wrote:
>
>
> Tom Zerucha wrote:
> > This leaves two possibilities, both involving high rez timing (there was
> > an article in handheld developers journal). Either you have to double the
> > clock speed to 200Hz/tick (which will have other side effects), or read
> > the timer directly to find the subtick (as I do with my MIDI sequencer
> > code, since I want 600Hz resolution).
>
> reading subticks? can you give more detailed info on how to do this?
#include <Hardware/Hardware.h>
Word *TCMP2 = (Word *) 0xFFFFF610;
// for 600Hz, i.e. how many subticks you want - you would likely use 2
#define CLKMUL 6
#define TCNT2 (&TCMP2[2])
#define hirezclk() ( (TimGetTicks()*CLKMUL+*TCNT2*CLKMUL / *TCMP2 ) - ttbase)
ttbase is a long or unsigned long.
It should be initialized as:
ttbase = hirezclk();
which effectively zeros the count, so hirezclk is the number of "fine"
ticks since this call. I normally use it as a differential, i.e.
nextevent += interval; while( hirezclk() < interval ); doit();
To compensate for the different dragonball processors, before you use
anything referencing the registers, do:
if( !FtrGet(sysFtrCreator,sysFtrNumProductID, &id) && (id >> 16) >= 2)
TCMP2 = &TCMP2[-6];
> > One other possibility is to use the UART - set it to the baud rate
> > corresponding to 5ms/char and check when the character is transmitted (or
> > recieved as IrDA in loopback).
>
> or how about more info on this?
See the dragonball manual, or check out some of my sample code on
www.execpc.com/~tz - particularly the serial tool example.