diff src/wait.asm @ 604:ca4556fb60b9

bump to 2.99beta, work on 3.00 stable
author heinrichsweikamp
date Thu, 22 Nov 2018 19:47:26 +0100
parents b455b31ce022
children c40025d8e750
line wrap: on
line diff
--- a/src/wait.asm	Thu Oct 11 21:06:29 2018 +0200
+++ b/src/wait.asm	Thu Nov 22 19:47:26 2018 +0100
@@ -1,19 +1,32 @@
 ;=============================================================================
 ;
-;   File wait.asm														V2.98
+;   File wait.asm														V2.98c
 ;
 ;   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
+;   2004-01-31 : [chsw] initial version
+;   2007-05-11 : updated (OSTC code)
+;   2011-10-18 : [mH] timings tested with oscilloscope
 
 #include "hwos.inc"
 
-basic	CODE
+wait		CODE
+
+
+; ==========================================================
+; WAIT 1 second (Warning: Do not use for time critical routines. Can be between 0 and 1 sec!)
+; ==========================================================
+	global	wait_1s
+wait_1s:
+	; Wait until "next second" flag is set
+	bcf		onesecupdate
+	btfss	onesecupdate
+	bra		$-2
+	return
+
 
 ; =============================================================================
 ; WAIT 1 MILLISECOND   (Not exact: 1,008ms +/- 30,5µs + worst case ISR latency)
@@ -24,12 +37,12 @@
 	movwf	wait_counter
 WAITMSX2:
 	setf	TMR5H
-	movlw	.255-.32 			;32 x 31,5µs = 1,008ms
+	movlw	.255-.32 			; 32 x 31,5µs = 1,008ms
 	movwf	TMR5L
-	bcf		PIR5,TMR5IF			; Clear flag
+	bcf		PIR5,TMR5IF			; clear flag
 WAITMSX3:
 	btfss	PIR5,TMR5IF
-	bra		WAITMSX3			; Wait loop
+	bra		WAITMSX3			; wait loop
 	decfsz	wait_counter,F
 	bra		WAITMSX2
 	return