Peter, There seems to be issue in both the CMM2 and Picomite latest code where an error in an interrupt triggered by SETTICK leaves something behind that prevents the first SETTICK interrupt when the program is run again from triggering. A second one is triggered OK. A CPU RESTART will allow both to be triggered on the next run. > CPU RESTART
> run =============== INT1 TRIGGERED 0 1 INTERRUPT CALLED OK 16 foo =============== INT1 TRIGGERED 0 1 INTERRUPT CALLED OK 16 foo =============== INT6 TRIGGERED Error in line 46: foo
> run =============== 0 INTERRUPT NOT CALLED 16 foo =============== INT1 TRIGGERED 0 1 INTERRUPT CALLED OK 16 foo =============== INT6 TRIGGERED Error in line 46: foo
This code produced the above output ' OPTION EXPLICIT OPTION DEFAULT NONE Dim INTEGER INTERRUPT_CALLED ? "===============" test_error_normal ? "===============" test_error_normal ? "===============" test_interrupt_not_inherit
Sub test_error_normal() 'test error in main not seen in interrupt local i%,eline$ interrupt_called% = 0 On Error Skip 1 Error "foo" SetTick 10, interrupt1 Pause 100 if interrupt_called% then ? interrupt_called% , "INTERRUPT CALLED OK" ELSE ? interrupt_called% , "INTERRUPT NOT CALLED" END IF ? Mm.ErrNo, MM.ERRMSG$ End Sub
Sub interrupt1() SetTick 0, interrupt1 ? "INT1 TRIGGERED" interrupt_called% = 1 ? MM.ERRNO, MM.ERRMSG$ End Sub
' Test that an ON ERROR RESTART is not passed to an interrupt
Sub test_interrupt_not_inherit() 'test_interrupt_does_not_inherit RESTART interrupt_called% = 0 On Error RESTart SetTick 10, interrupt6 Pause 100 if interrupt_called% then ? interrupt_called% , "INTERRUPT CALLED OK" ELSE ? interrupt_called% , "INTERRUPT NOT CALLED" END IF ? Mm.ErrNo, MM.ERRMSG$ End Sub
Sub interrupt6() SetTick 0, interrupt6 ? "INT6 TRIGGERED" interrupt_called% = 1 Error "foo" ? Mm.ErrNo ,MM.ERRMSG$ End Sub
|