summaryrefslogtreecommitdiff
path: root/macros/Hardware/AVR/AVRGetTimerValue.sci
diff options
context:
space:
mode:
Diffstat (limited to 'macros/Hardware/AVR/AVRGetTimerValue.sci')
-rw-r--r--macros/Hardware/AVR/AVRGetTimerValue.sci41
1 files changed, 25 insertions, 16 deletions
diff --git a/macros/Hardware/AVR/AVRGetTimerValue.sci b/macros/Hardware/AVR/AVRGetTimerValue.sci
index ab0146a..afb47ac 100644
--- a/macros/Hardware/AVR/AVRGetTimerValue.sci
+++ b/macros/Hardware/AVR/AVRGetTimerValue.sci
@@ -1,31 +1,40 @@
-function counts = AVRGetTimerValue(timer)
-// Function to set the prescalar for timer.
+// Copyright (C) 2017 - IIT Bombay - FOSSEE
//
-// Calling Sequence
-// AVRgetTimerValue(timer, prescalar)
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+// Organization: FOSSEE, IIT Bombay
+// Email: toolbox@scilab.in
+
+function count = AVRGetTimerValue(timer)
+// Function to get timer count
//
// Parameters
-// timer: timer to be set up (0,1,2)
-// prescalar: prescalar to be used for generating PWM waveform (0-7)
-// ***Refer datasheet for more description about timer
+// timer : timer whose current count is to be returned
+// 0 for timer0
+// 1 for timer1
+// 2 for timer2
//
// Description
-// This function sets prescalr for timers. 'timer' decides which of the
-// three (0,1,2) timers available to be used. The 'prescalar' is needed for
-// deciding timer clock. Select appropriate prescalar depending on MCU clock
-// and requirement.
-//
+// This function returns the count value of a desired timer.By knowing the count value
+// certain interrupt action can be taken.
//
// Examples
-// AVRTimerSetup(0,1) //Timer 0 with no scaling
+// AVRGetTimerValue(0); //returns present count of the TCNT0 counter
//
// See also
-// AVRGetTimerValue
+// AVRTimerSetup
//
// Authors
-// Siddhesh Wani
+// Ashish Kamble
//
-
// This is curretly dummy function. It provides no functionality but is required
// for providing support for generating C code for AVR.
+
+if(timer>=3) then
+disp("Error : Invalid input argument ''timer'' in AVRGetTimerValue function.");
+end
+count = 0;
endfunction