Interrupts

Interrupts are handled by the user written intserv function. It is defined within an XCSB program as:
proc intserv()
endproc

With program statements added by the user between the proc and endproc statements

The intserv function cannot return a result. If one is supplied it will be discarded.

The intserv function is called when a hardware interrupt occures. On entry to the intserv function the intserv prolog is executed. This section of code is specified as a macro in the startup.asm file which is distributed with the XCSB compiler. On exit from the intserv function the intserv epilog is executed. This is another section of code specified as a macro and also provided in the startup.asm file. By specifying the intserv prolog and epilog code in this way it is possible for the XCSB user to easily tailer this code should the need arise.

The intserv prolog is responsible for maintaining the system heartbeat clock. This clock is configured to run at 0.05 second intervals (it beats 20 a second) on a 4MHz external oscillator. The spead of the clock can be changed by the user by editing the startup.asm file. This system heartbeat is responsible for maintaining the task timers. The task_wait statement depends on the task timer belonging to the task that is waiting. The task_wait statement loads the wait interval as a number of clock ticks into the task timer and then waits for the inteval to be decremented until it is less than 0. The number loaded into the task timer is actually 1 less than the value specified
e.g.

task_wait 5
actually loads 4 into the task timer and waits fro the task timer to go to -1

Some things should be avoided within intserv or any functions called by intserv

These are currently