my aim is to create a sort of Fx function for the MIDIBox AY application - following the conception of sound tracker.
the USER_Timer is in use by the SM_DebounceTimer (c64 keyboard / 8x8 sm driver).
so i thought it might be a good idea to work with the timer0
i’m new to timer and interrupt programming. i read some lines about the basic concept of the timer in general but i don’t know where to start in the context of MIOS.
basic concept of the Fx function:
[midi event note on] ==> toggle timer0 on
after timer0 cycle 1) Fx 01 write x to reg a
after timer0 cycle 2) Fx 02 write y to reg a
after timer0 cycle 3) Fx 03 write z to reg a
after timer0 cycle 4).Fx 04 write w to reg c
etc.
[midi event note off] ==> toggle timer0 off
so now my question:
how to initialize and activate timer0?
what is to consider in relation to interrupts?
is there already some code with timer0 in action? (where i can learn from)
the PIC based MIOS doesn’t allow you to add interrupt handlers (this has changed in MIOS32)
This means, that the timer overrun flag has to be polled by a routine which is executed periodically (e.g. from the USER_Timer hook, if it is called more often than the target interval of TMR0)