summaryrefslogtreecommitdiff
path: root/2.3-1/macros/Hardware/AVR/AVRGetTimerValue.sci
diff options
context:
space:
mode:
authorsiddhu89902017-04-19 14:28:34 +0530
committersiddhu89902017-04-19 14:28:34 +0530
commit586db6343e7b472d8dc3e63a82f4c73f99cdcbd7 (patch)
treee74d643b27634303e772074fc61a717ff400ac0a /2.3-1/macros/Hardware/AVR/AVRGetTimerValue.sci
parent645c51daadc9a5c9374b0465ded05f84bca65183 (diff)
downloadScilab2C-586db6343e7b472d8dc3e63a82f4c73f99cdcbd7.tar.gz
Scilab2C-586db6343e7b472d8dc3e63a82f4c73f99cdcbd7.tar.bz2
Scilab2C-586db6343e7b472d8dc3e63a82f4c73f99cdcbd7.zip
Merged Ashish's work
Diffstat (limited to '2.3-1/macros/Hardware/AVR/AVRGetTimerValue.sci')
-rw-r--r--2.3-1/macros/Hardware/AVR/AVRGetTimerValue.sci41
1 files changed, 25 insertions, 16 deletions
diff --git a/2.3-1/macros/Hardware/AVR/AVRGetTimerValue.sci b/2.3-1/macros/Hardware/AVR/AVRGetTimerValue.sci
index ab0146aa..afb47ac8 100644
--- a/2.3-1/macros/Hardware/AVR/AVRGetTimerValue.sci
+++ b/2.3-1/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