Subversion Repositories svn.mios

Rev

Rev 52 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
53 tk 1
; $Id: mios_dout.inc 53 2008-01-30 22:52:41Z tk $
1 tk 2
;
3
; MIOS Service Routines for the DOUT chain
4
;
5
; ==========================================================================
6
;
7
;  Copyright 1998-2006 Thorsten Klose (tk@midibox.org)
8
;  Licensed for personal non-commercial use only.
9
;  All other rights reserved.
10
;
11
; ==========================================================================
12
 
13
;; --------------------------------------------------------------------------
14
;;  FUNCTION: MIOS_DOUT_SRSet
15
;;  C_DECLARATION: void MIOS_DOUT_SRSet(unsigned char sr, unsigned char sr_value)
16
;;  DESCRIPTION: sets value of DOUT shift register
17
;;  IN:	  number of shift register in WREG
18
;;        value in MIOS_PARAMETER1
19
;;  C_IN:  number of shift register in <sr>
20
;;        value in <sr_value>
21
;;  OUT:  pointer to shift register in FSR1
22
;;  C_OUT: -
23
;;  USES: FSR1 and BSR
24
;; --------------------------------------------------------------------------
25
MIOS_DOUT_SRSet
26
	andlw	0x0f
27
	lfsr	FSR1, MIOS_SR_DOUT_0
28
	addwf	FSR1L, F
29
	movff	MIOS_PARAMETER1, INDF1
30
	return
31
 
32
;; --------------------------------------------------------------------------
33
;;  FUNCTION: MIOS_DOUT_SRGet
34
;;  C_DECLARATION: unsigned char MIOS_DOUT_SRGet(unsigned char sr)
35
;;  DESCRIPTION: returns value of DOUT shift register
36
;;  IN:	  number of shift register in WREG
37
;;  C_IN:  number of shift register in <sr>
38
;;  OUT:  value of shift register in WREG and MIOS_PARAMETER1,
39
;;        pointer to shift register in FSR1
40
;;  C_OUT: value of shift register
41
;;  USES: FSR1 and BSR
42
;; --------------------------------------------------------------------------
43
MIOS_DOUT_SRGet
44
	andlw	0x0f
45
	lfsr	FSR1, MIOS_SR_DOUT_0
46
	addwf	FSR1L, F
47
	movf	INDF1, W
48
	movwf	MIOS_PARAMETER1
49
	return
50
 
51
;; --------------------------------------------------------------------------
52
;;  FUNCTION: MIOS_DOUT_PinGet
53
;;  C_DECLARATION: unsigned char MIOS_DOUT_PinGet(unsigned char pin)
54
;;  DESCRIPTION: returns value from a DOUT Pin
55
;;  IN:	  Pin number in MIOS_PARAMETER1 and WREG
56
;;  C_IN: Pin number in <pin>
57
;;  OUT:  1 if pin is +5V, 0 if pin is 0V
58
;;  C_OUT:  1 if pin is +5V, 0 if pin is 0V
59
;;  USES: FSR1 and BSR
60
;; --------------------------------------------------------------------------
61
MIOS_DOUT_PinGet
62
	andlw	0x7f
63
	lfsr	FSR1, MIOS_SR_DOUT_0
64
	rgoto	MIOS_SRIO_Get
65
 
66
;; --------------------------------------------------------------------------
67
;;  FUNCTION: MIOS_DOUT_PinSet0
68
;;  C_DECLARATION: void MIOS_DOUT_PinSet0(unsigned char pin)
69
;;  DESCRIPTION: set pin to 0V
70
;;  IN:	  Pin number in WREG
71
;;  C_IN:  Pin number in WREG
72
;;  USES: FSR1 and BSR
73
;; --------------------------------------------------------------------------
74
MIOS_DOUT_PinSet0
75
	andlw	0x7f
76
	lfsr	FSR1, MIOS_SR_DOUT_0
77
	rgoto	MIOS_SRIO_Set0
78
 
79
;; --------------------------------------------------------------------------
80
;;  FUNCTION: MIOS_DOUT_PinSet1
81
;;  C_DECLARATION: void MIOS_DOUT_PinSet1(unsigned char pin)
82
;;  DESCRIPTION: set pin to 5V
83
;;  IN:	  Pin number in WREG
84
;;  C_IN: Pin number in <pin>
85
;;  USES: FSR1 and BSR
86
;; --------------------------------------------------------------------------
87
MIOS_DOUT_PinSet1
88
	andlw	0x7f
89
	lfsr	FSR1, MIOS_SR_DOUT_0
90
	rgoto	MIOS_SRIO_Set1
91
 
92
;; --------------------------------------------------------------------------
93
;;  FUNCTION: MIOS_DOUT_PinSet
94
;;  C_DECLARATION: void MIOS_DOUT_PinSet(unsigned char pin, unsigned char value)
95
;;  DESCRIPTION: set pin to 0 or 5V
96
;;  IN:	  Pin number in WREG, value in MIOS_PARAMETER1
97
;;  C_IN: Pin number in <pin>, value in <value>
98
;;  USES: FSR1 and BSR
99
;; --------------------------------------------------------------------------
100
MIOS_DOUT_PinSet
101
	BRA_IFSET MIOS_PARAMETER1, 0, ACCESS, MIOS_DOUT_PinSet1
102
	rgoto	MIOS_DOUT_PinSet0