Hi Barry,
First suggestion is very minor but still, clear IOCAF immediately after reading it, ie
Code:
IOCA = IOCAF ' Save IOCAF to IOCA
IOCAF = 0 ' Reset IOCAF
IOCB = IOCBF ' Save IOCBF to IOCB
IOCBF = 0 ' Reset IOCBF
The longer the time is between reading it and clearing it is the bigger the risk of missing an "event" is. In this case, as I said, very minor but still.
Next suggestion is to really try to tweak the display routine. Measure how long it takes now, then tweak it and compare. You want to make it as quick as you possibly can.
With tweaking I mean things like not rewriting static information each update. Instead, write the static information ONCE and then only update/overwrite what's actually needs to be updated.
You could, for example, use the bits in IOCA and IOCB to determine which counters content actually needs updating on the display. A possible drawback of doing this is that the execution time of the routine isn't constant so it's hard to tell exactly how fast the system will be able to detects consecutive events on the same "line". At the very least, don't rewrite that [ Fault Status ] - waste of time ;-)
As the code is currently written, I think you can skip the DisplayFlag semaphore and just do
Code:
IF IOCA > 0 OR IOCB > 0 THEN ' Test if IOC Flags have changed
GOSUB Display
ENDIF
But you may have something else in there preventing you from doing that, I don't know.
Another possible option to flip it around and have the Display routine as part of your main code (with the flag indicating it needs updating) and then GOSUB the code that checks the interrupt flags. That way can insert a GOSUB at various places WITHIN the Display routine (and the rest of the main loop) in an effort to really catch multiple events on the same line.
/Henrik.
Bookmarks