;
; din.inc: misc. din sync specific functions
;
; author: Marko Kanala, raato ]a t[ mulletronic.com
;
; LICENSE
; Creative Commons Attribution-NonCommercial-ShareALike 2.5
;
; You are free:
;
; * to copy, distribute, display, and perform the work
; * to make derivative works
;
; Under the following conditions:
;	
; 1. Attribution. You must attribute the work in the manner specified by the 
;    author or licensor.
; 2. Noncommercial. You may not use this work for commercial purposes.
; 3. Share Alike. If you alter, transform, or build upon this work, you may 
;    distribute the resulting work only under a license identical to this one.
;
; * For any reuse or distribution, you must make clear to others the license 
;   terms of this work.
; * Any of these conditions can be waived if you get permission from the 
;   copyright holder.
;
; Your fair use and other rights are in no way affected by the above.
;
; This is a human-readable summary of the Legal Code.
; See full license at http://creativecommons.org/licenses/by-nc-sa/2.5/legalcode
;
; Copyright: Marko Kanala (raato@mulletronic.com).
;

; sends a din clock to sync output
;  timer 0 is enabled to get 2ms clock pulse width
din_clock:
	bsf		DIN_SYNC_PORT, DIN_SYNC_PIN
	; reset and activate timer 0 for 2ms delay
	movlw	din_width_high
	movwf	TMR0H
	movlw	din_width_low
	movwf	TMR0L
	bsf		T0CON, TMR0ON		; enable timer 
	return

; sets the din clock off (called from timer 0 overflow interrupt)
din_clock_off:
	bcf		DIN_SYNC_PORT, DIN_SYNC_PIN
	bcf		T0CON, TMR0ON		; disable timer
	return

External Labels :