Hi Merlin, Rolf and Gunter,
Thanks for all the feedback.
I agree that it's a bit odd to put the manipulation of TickTimer in the interrupt.
Especially as this takes some time to complete. No longer being used.
However I did some more tests and I still find that in the simulator TickTimer, if already started, does no stop and does not need a new implicit TickTimerStart after the use of TickTimerTime.
Not a problem as I am using a TickTimerStop where required.
I include the 3 bits of code that I have tried in the testing.
Again many thanks for the support of the team and other users
Regards
Crusty.
program TTT_2;
{$NOSHADOW}
{ $WG} {global Warnings off}
Device = mega328p, VCC=5;
{ $BOOTRST $03800} {Reset Jump to $03800}
Define_Fuses
// Override_Fuses;
NoteBook = A;
COMport = USB;
LockBits0 = [];
FuseBits0 = [];
FuseBits1 = [];
FuseBits2 = [];
Import SysTick, TickTimer;
From System Import LongWord;
Define
ProcClock = 16000000; {Hertz}
SysTick = 10; {msec}
StackSize = $0064, iData;
FrameSize = $0064, iData;
TickTimer = Timer1;
Implementation
{$IDATA}
{--------------------------------------------------------------}
{ Type Declarations }
type
{--------------------------------------------------------------}
{ Const Declarations }
{--------------------------------------------------------------}
{ Var Declarations }
{$IDATA}
Var
Dummy, Flag : Boolean;
{--------------------------------------------------------------}
{ functions }
Interrupt TIMER1COMPA; // TickTimer
begin
Flag := True; //set breakpoint in simulator here
end;
{--------------------------------------------------------------}
{ Main Program }
{$IDATA}
{
begin
Dummy := False;
TickTimerTime(40); //TickTimer does not interrupt as never started
EnableInts;
loop
While Dummy = False Do
NOP;
EndWhile;
endloop;
end TTT_2.
}
{
begin
Dummy := False;
TickTimerTime(40);
TickTimerStart; //TickTimer Interrupts always as no stop
EnableInts;
loop
While Dummy = False Do
NOP;
EndWhile;
endloop;
end TTT_2.
}
begin
Dummy := False;
Flag := False;
TickTimerTime(40);
TickTimerStart;
EnableInts;
loop
While Dummy = False Do
If Flag = True then TickTimerTime(60); //TickTimer interrupts even after new value set.
Flag := False;
Endif;
EndWhile;
endloop;
end TTT_2.