ShaunRWs Commands
TMR_StartCounter

This command will start a counter.

  Syntax
TMR_StartCounter ID, StartingTime, Type
  Parameters
ID
Byte
This is the ID of the timer, This can only be a whole number between 0 and 255.
StartingTime
DWORD
This parameter is used to set the starting value of the counter.
Type
Boolean
This flag is used to set the counter to count up or down.
- 0 = Count Up
- 1 = Count Down

  Returns

This command does not return a value.

  Description

This command will start a counter with the ID number given.
The Counter will count up or down from the given starting time.

  Example Code
// Starts a count up and count down
TMR_StartCounter 1,0,0
TMR_StartCounter 2,10000,1

Do
	
	CLS
	
	// Get the counter values (milliseconds)
	CountUp = TMR_GetCounter(1)
	CountDown = TMR_GetCounter(2)
	
	Print "ShaunRWs Counter Commands."
	Print ""
	
	// Display counter 1 data
	Print "Counting up:"
	Print "Exist: " + str$(TMR_CounterExist(1))
	Print "Type: " + str$(TMR_GetCounterType(1))
	Print "Milliseconds: " + str$(CountUp)
	Print "Seconds: " + str$(TMR_GetSeconds(CountUp))
	Print "Minutes: " + str$(TMR_GetMinutes(CountUp))
	Print "Hours: " + str$(TMR_GetHours(CountUp))
	Print ""
	
	// Display counter 2 data
	Print "Counting Down:"
	Print "Exist: " + Str$(TMR_CounterExist(2))
	Print "Type: " + str$(TMR_GetCounterType(2))
	Print "Milliseconds: " + str$(CountDown)
	Print "Seconds: " + str$(TMR_GetSeconds(CountDown))
	Print "Minutes: " + str$(TMR_GetMinutes(CountDown))
	Print "Hours: " + str$(TMR_GetHours(CountDown))
	
	// Reset the count down to 10 seconds when it reaches 0
	If CountDown =< 0
		TMR_SetCounter 2,10000
	EndIf
	
	// Kill Timers If space bar was pressed
	If Spacekey()
		TMR_KillCounter 1
		TMR_KillCounter 2
	Endif
	
Loop
  See also

Counter Commands Menu
ShaunRW`s Commands