Subversion Repositories svn.mios

Rev

Rev 324 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 324 Rev 878
Line 1... Line 1...
1
; $Id: main.asm 324 2008-05-03 20:25:44Z tk $
1
; $Id: main.asm 878 2010-01-02 15:40:58Z tk $
2
;
2
;
3
; A CORE->LCD Module Interconnection Test
3
; A CORE->LCD Module Interconnection Test
4
;
4
;
5
; ==========================================================================
5
; ==========================================================================
6
;
6
;
Line 35... Line 35...
35
#include <mios_mt_table.inc>
35
#include <mios_mt_table.inc>
36
#include <mios_enc_table.inc>
36
#include <mios_enc_table.inc>
37
37
38
;; ---[ Custom LCD driver ]---
38
;; ---[ Custom LCD driver ]---
39
#include <app_lcd.inc>
39
#include <app_lcd.inc>
-
 
40
-
 
41
;; ---[ Debug Message Module ]---
-
 
42
#include <debug_msg.inc>
-
 
43
40
44
41
;; ==========================================================================
45
;; ==========================================================================
42
;;  All MIOS hooks in one file
46
;;  All MIOS hooks in one file
43
;; ==========================================================================
47
;; ==========================================================================
44
48
Line 89... Line 93...
89
    call    MIOS_LCD_Clear
93
    call    MIOS_LCD_Clear
90
94
91
    TABLE_ADDR TEXT_WELCOME_0
95
    TABLE_ADDR TEXT_WELCOME_0
92
    call    MIOS_LCD_PrintString
96
    call    MIOS_LCD_PrintString
93
    call    MIOS_LCD_PrintString
97
    call    MIOS_LCD_PrintString
-
 
98
-
 
99
    call    DEBUG_MSG_SendHeader
-
 
100
    movlw   '\n'
-
 
101
    call    DEBUG_MSG_SendChar
-
 
102
    call    DEBUG_MSG_SendFooter
-
 
103
   
-
 
104
    call    DEBUG_MSG_SendHeader
-
 
105
    call    DEBUG_MSG_SendASMString
-
 
106
    db  "LCD Interconnection Test\n", 0
-
 
107
    call    DEBUG_MSG_SendFooter
-
 
108
   
-
 
109
    call    DEBUG_MSG_SendHeader
-
 
110
    call    DEBUG_MSG_SendASMString
-
 
111
    db  "========================\n", 0
-
 
112
    call    DEBUG_MSG_SendFooter
-
 
113
-
 
114
    call    DEBUG_MSG_SendHeader
-
 
115
    call    DEBUG_MSG_SendASMString
-
 
116
    db  "Please play a note on any MIDI channel.\n", 0
-
 
117
    call    DEBUG_MSG_SendFooter
94
118
   
95
    bsf DISPLAY_UPDATE_REQ, 0
119
    bsf DISPLAY_UPDATE_REQ, 0
96
120
97
    return
121
    return
98
122
Line 125... Line 149...
125
    movf    PRODH, W
149
    movf    PRODH, W
126
    addwfc  TBLPTRH, F
150
    addwfc  TBLPTRH, F
127
    movlw   LCD_PIN_NAMES_LEN
151
    movlw   LCD_PIN_NAMES_LEN
128
    call    MIOS_LCD_PrintPreconfString
152
    call    MIOS_LCD_PrintPreconfString
129
153
-
 
154
-
 
155
    ;; send message to MIOS Terminal
-
 
156
    call    DEBUG_MSG_SendHeader
-
 
157
    call    DEBUG_MSG_SendASMString
-
 
158
    db  "Pin '", 0
-
 
159
-
 
160
    TABLE_ADDR LCD_PIN_NAMES_TABLE
-
 
161
    movf    LCD_PIN_NUMBER, W
-
 
162
    mullw   LCD_PIN_NAMES_LEN
-
 
163
    movf    PRODL, W
-
 
164
    addwf   TBLPTRL, F
-
 
165
    movf    PRODH, W
-
 
166
    addwfc  TBLPTRH, F
-
 
167
-
 
168
    ;; always two chars
-
 
169
    tblrd*+
-
 
170
    movf    TABLAT, W
-
 
171
    call    DEBUG_MSG_SendChar
-
 
172
    tblrd*+
-
 
173
    movf    TABLAT, W
-
 
174
    call    DEBUG_MSG_SendChar
-
 
175
-
 
176
    call    DEBUG_MSG_SendASMString
-
 
177
    db  "' of MBHP_CORE::J15 set to 5V, all other data/control pins set to 0V", 0
-
 
178
    call    DEBUG_MSG_SendFooter
-
 
179
-
 
180
    ;; IMPORTANT!!!
130
    ;; now set the LCD pin again (they have been toggled by the LCD driver)
181
    ;; Since a LCD message could overwrite the data/address/control
-
 
182
    ;; line value, we update the pins again
131
    goto    LCD_SetPin
183
    goto    LCD_SetPin
132
   
184
   
133
   
185
   
134
186
135
LCD_PIN_NAMES_LEN   EQU 2
187
LCD_PIN_NAMES_LEN   EQU 2
Line 158... Line 210...
158
USER_MPROC_NotifyReceivedEvent
210
USER_MPROC_NotifyReceivedEvent
159
    ;; if modulation wheel received: set new pin
211
    ;; if modulation wheel received: set new pin
160
    movf    MIOS_PARAMETER1, W
212
    movf    MIOS_PARAMETER1, W
161
    andlw   0xf0
213
    andlw   0xf0
162
    xorlw   0xb0
214
    xorlw   0xb0
163
    bnz USER_NotifyReceivedEvent_End
215
    bnz USER_NotifyReceivedEvent_ChkNote
164
    movf    MIOS_PARAMETER2, W
216
    movf    MIOS_PARAMETER2, W
165
    xorlw   0x01
217
    xorlw   0x01
166
    bnz USER_NotifyReceivedEvent_End
218
    bnz USER_NotifyReceivedEvent_ChkNote
167
219
168
    movf    MIOS_PARAMETER3, W
220
    movf    MIOS_PARAMETER3, W
169
    movwf   LCD_PIN_NUMBER
221
    movwf   LCD_PIN_NUMBER
170
    movlw   LCD_PIN_NAMES_NUM
222
    movlw   LCD_PIN_NAMES_NUM
171
    cpfslt  LCD_PIN_NUMBER, ACCESS
223
    cpfslt  LCD_PIN_NUMBER, ACCESS
172
    clrf LCD_PIN_NUMBER
224
    clrf LCD_PIN_NUMBER
173
    bsf DISPLAY_UPDATE_REQ, 0
225
    bsf DISPLAY_UPDATE_REQ, 0
174
226
175
    ;; set the pin depending on selected pin number
227
    ;; set the pin depending on selected LCD number
176
    call    LCD_SetPin
228
    call    LCD_SetPin
-
 
229
    rgoto   USER_NotifyReceivedEvent_End
-
 
230
-
 
231
-
 
232
USER_NotifyReceivedEvent_ChkNote
-
 
233
    ;; alternative control via MIDI keyboard (Note On Events with velocity > 0)
-
 
234
    movf    MIOS_PARAMETER1, W
-
 
235
    andlw   0xf0
-
 
236
    xorlw   0x90
-
 
237
    bnz USER_NotifyReceivedEvent_End
-
 
238
    movf    MIOS_PARAMETER3, W
-
 
239
    bz  USER_NotifyReceivedEvent_End
-
 
240
    ;; normalize note to 0..11 range
-
 
241
    movf    MIOS_PARAMETER2, W
-
 
242
USER_NotifyReceivedEvent_NoteNor
-
 
243
    addlw   -12
-
 
244
    BRA_IFCLR WREG, 7, ACCESS, USER_NotifyReceivedEvent_NoteNor
-
 
245
    addlw   12      ; now in range 0..11
-
 
246
    movwf   LCD_PIN_NUMBER
-
 
247
   
-
 
248
    movlw   LCD_PIN_NAMES_NUM
-
 
249
    cpfslt  LCD_PIN_NUMBER, ACCESS
-
 
250
    clrf LCD_PIN_NUMBER
-
 
251
    bsf DISPLAY_UPDATE_REQ, 0
-
 
252
-
 
253
    ;; set the pin depending on selected LCD number
-
 
254
    call    LCD_SetPin
-
 
255
    ;;  rgoto   USER_NotifyReceivedEvent_End
-
 
256
177
USER_NotifyReceivedEvent_End
257
USER_NotifyReceivedEvent_End
178
    return
258
    return
179
259
180
260
181
;; --------------------------------------------------------------------------
261
;; --------------------------------------------------------------------------