diff src/wait.asm @ 0:11d4fc797f74

init
author heinrichsweikamp
date Wed, 24 Apr 2013 19:22:45 +0200
parents
children 653a3ab08062
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/wait.asm	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,37 @@
+;=============================================================================
+;
+;   File wait.asm
+;
+;  Wait routines
+;
+;   Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+; HISTORY
+;   2004-01-31 : [chsw] Initial version.
+;   2007-05-11 : Updated (OSTC code).
+;   2011-10-18 : [mH] Timings tested with oscilloscope
+	
+#include "ostc3.inc"
+
+basic       CODE
+
+; ==========================================================
+; 	WAIT 1 MILLISECOND   (Not exact: 1,008ms +/- 30,5µs + worst case ISR latency)
+; ==========================================================
+
+            global  WAITMSX
+WAITMSX		movwf	waitms_temp
+			
+WAITMSX2	setf	TMR5H
+			movlw	.255-.32 			;32 x 31,5µs = 1,008ms
+			movwf	TMR5L
+			bcf		PIR5,TMR5IF			; Clear flag
+WAITMSX3	btfss	PIR5,TMR5IF
+			bra		WAITMSX3			; Wait loop
+			decfsz	waitms_temp,F
+			bra		WAITMSX2
+			return
+
+;=============================================================================
+
+            END
\ No newline at end of file