MPASM 5.35 MIDIPULSEHOLD_SIMBA3.ASM 8-12-2010 19:01:20 PAGE 1 LOC OBJECT CODE LINE SOURCE TEXT VALUE 00001 00002 ; Specs: 00003 ; 00004 ; - midi input (31250 bps) 00005 ; - 8 pulse outputs, pulse duration controlled by note-on velocity 00006 ; - 16 bit pulse counter resolution, full velocity->duration lookup table 00007 ; per output 00008 ; - pulse counter clock: 25us (?) 00009 ; - 100% deterministic pulse duration 00010 ; - 8 hold outputs 00011 00012 ;============================================================================= 00013 ; Filename: midima.asm 00014 ;============================================================================= 00015 ; Author: Johannes Taelman 00016 ; Company: Johannes Taelman 00017 ; Revision: Godfried-Willem Raes 04.07.2007 00018 ; Date: May 2005 00019 ;============================================================================= 00020 ; Include Files: p18f2525.inc V1.3 00021 ;============================================================================= 00022 00023 Warning[215]: Processor superseded by command line. Verify processor symbol. 00024 list p=18f2525 ;list directive to define processor 00025 #include ;processor specific definitions 00001 LIST 00002 00003 ;========================================================================== 00004 ; $Id: P18F2525.INC,v 1.11.2.3 2005/10/23 23:50:04 curtiss Exp $ 00005 ; MPASM PIC18F2525 processor include 00006 ; 00007 ; (c) Copyright 1999-2005 Microchip Technology, All rights reserved 00008 ;========================================================================== 00009 Message[301]: MESSAGE: (Processor-header file mismatch. Verify selected processor.) 01186 LIST 00026 ; #include ;processor specific definitions 00027 00028 ; #define simulate 1 ; enable simulation 00029 ; #define heartbeat 1 ; enable heatbeats 00030 ;****************************************************************************** 00031 ;Configuration bits 00032 ; The __CONFIG directive defines configuration data within the .ASM file. 00033 ; The labels following the directive are defined in the P18F2525.INC file. 00034 ; The PIC18FXX2 Data Sheet explains the functions of the configuration bits. 00035 ; Change the following lines to suit your application. 00036 Warning[230]: __CONFIG has been deprecated for PIC18 devices. Use directive CONFIG. Error[113] : Symbol not previously defined (_OSCS_OFF_1H) Error[113] : Symbol not previously defined (_HSPLL_OSC_1H) 300000 00FF 00037 __CONFIG _CONFIG1H, _OSCS_OFF_1H & _HSPLL_OSC_1H Warning[230]: __CONFIG has been deprecated for PIC18 devices. Use directive CONFIG. MPASM 5.35 MIDIPULSEHOLD_SIMBA3.ASM 8-12-2010 19:01:20 PAGE 2 LOC OBJECT CODE LINE SOURCE TEXT VALUE Error[113] : Symbol not previously defined (_BOR_ON_2L) 00038 __CONFIG _CONFIG2L, _BOR_ON_2L & _PWRT_ON_2L Warning[230]: __CONFIG has been deprecated for PIC18 devices. Use directive CONFIG. 300002 FE00 00039 __CONFIG _CONFIG2H, _WDT_OFF_2H Warning[230]: __CONFIG has been deprecated for PIC18 devices. Use directive CONFIG. Error[113] : Symbol not previously defined (_CCP2MX_OFF_3H) 300004 00FF 00040 __CONFIG _CONFIG3H, _CCP2MX_OFF_3H Warning[230]: __CONFIG has been deprecated for PIC18 devices. Use directive CONFIG. Error[113] : Symbol not previously defined (_STVR_OFF_4L) 300006 FF00 00041 __CONFIG _CONFIG4L, _STVR_OFF_4L & _LVP_OFF_4L & _DEBUG_OFF_4L Warning[230]: __CONFIG has been deprecated for PIC18 devices. Use directive CONFIG. Error[113] : Symbol not previously defined (_CP3_OFF_5L) 00042 __CONFIG _CONFIG5L, _CP0_OFF_5L & _CP1_OFF_5L & _CP2_OFF_5L & _CP3_OFF_5L Warning[230]: __CONFIG has been deprecated for PIC18 devices. Use directive CONFIG. 300008 FF00 00043 __CONFIG _CONFIG5H, _CPB_OFF_5H & _CPD_OFF_5H Warning[230]: __CONFIG has been deprecated for PIC18 devices. Use directive CONFIG. Error[113] : Symbol not previously defined (_WRT3_OFF_6L) 00044 __CONFIG _CONFIG6L, _WRT0_OFF_6L & _WRT1_OFF_6L & _WRT2_OFF_6L & _WRT3_OFF_6L Warning[230]: __CONFIG has been deprecated for PIC18 devices. Use directive CONFIG. 30000A FF00 00045 __CONFIG _CONFIG6H, _WRTC_OFF_6H & _WRTB_OFF_6H & _WRTD_OFF_6H Warning[230]: __CONFIG has been deprecated for PIC18 devices. Use directive CONFIG. Error[113] : Symbol not previously defined (_EBTR3_OFF_7L) 00046 __CONFIG _CONFIG7L, _EBTR0_OFF_7L & _EBTR1_OFF_7L & _EBTR2_OFF_7L & _EBTR3_OFF_7L Warning[230]: __CONFIG has been deprecated for PIC18 devices. Use directive CONFIG. 30000C FF00 00047 __CONFIG _CONFIG7H, _EBTRB_OFF_7H 00048 00049 #define Timer1Out OutsA,1; 00050 #define Timer2Out OutsA,3; 00051 #define Timer3Out OutsA,5; 00052 #define Timer4Out OutsB,6; 00053 #define Timer5Out OutsB,4; 00054 #define Timer6Out OutsB,2; 00055 #define Timer7Out OutsB,0; 00056 #define Timer8Out OutsC,4; 00057 #define Timer9Out OutsC,1; 00058 #define Timer10Out OutsC,3; 00059 00060 #define Note1Hold OutsA,2; 00061 #define Note2Hold OutsA,0; 00062 #define Note3Hold OutsA,4; 00063 #define Note4Hold OutsB,7; 00064 #define Note5Hold OutsB,5; 00065 #define Note6Hold OutsB,3; 00066 #define Note7Hold OutsB,1; 00067 #define Note8Hold OutsC,5; 00068 #define Note9Hold OutsC,0; 00069 #define Note10Hold OutsC,2; 00070 00071 ;---------------------------------------------------------------------------- 00072 ;Constants 00073 0000004F 00074 SPBRG_VAL EQU 04Fh ;set baud rate 31250 for 40Mhz clock 00075 MPASM 5.35 MIDIPULSEHOLD_SIMBA3.ASM 8-12-2010 19:01:20 PAGE 3 LOC OBJECT CODE LINE SOURCE TEXT VALUE 00000010 00076 TX_BUF_LEN EQU 010h ;length of transmit circular buffer 00000010 00077 RX_BUF_LEN EQU TX_BUF_LEN ;length of receive circular buffer 00078 00079 ;---------------------------------------------------------------------------- 00080 ;Bit Definitions 00081 00000000 00082 TxBufFull EQU 0 ;bit indicates Tx buffer is full 00000001 00083 TxBufEmpty EQU 1 ;bit indicates Tx buffer is empty 00000002 00084 RxBufFull EQU 2 ;bit indicates Rx buffer is full 00000003 00085 RxBufEmpty EQU 3 ;bit indicates Rx buffer is empty 00086 00087 ;---------------------------------------------------------------------------- 00088 ; Variables 00089 ; memory map 00090 ;---------------------------------------------------------------------------- 00091 00092 CBLOCK 0x000 00000000 00093 WREG_TEMP ;to save WREG during interrupt 00000001 00094 STATUS_TEMP ;to save STATUS during interrupt 00000002 00095 BSR_TEMP ;to save BSR during interrupt 00000003 00096 FSR0H_TEMP ;to save FSR0H during interrupt 00000004 00097 FSR0L_TEMP ;to save FSR0L during interrupt 00000005 00098 FSR0H_SHADOW ;to save FSR0H during high interrupt 00000006 00099 FSR0L_SHADOW ;to save FSR0L during high interrupt 00000007 00100 MidiInByte ; Rcv'd Byte 00000008 00101 MidiByte0 ; status 00000009 00102 MidiByte1 ; data1 0000000A 00103 MidiByte2 ; data2 0000000B 00104 MidiCurData ; current data byte index 0000000C 00105 MidiNumData ; expected data bytes 0000000D 00106 MidiTestByte ; for testing only 0000000E 00107 TmpM ; non-ISR scratch 0000000F 00108 TmpT ; non-ISR scratch 00000010 00109 OutsA ; output port A internal states 00000011 00110 OutsB ; output port B internal states 00000012 00111 OutsC ; output port C internal states 00112 ENDC 00113 00114 CBLOCK 0x020 ; DO NOT MOVE THIS BLOCK 00000020 00115 Timer1Msb 00000021 00116 Timer1Lsb 00000022 00117 Timer2Msb 00000023 00118 Timer2Lsb 00000024 00119 Timer3Msb 00000025 00120 Timer3Lsb 00000026 00121 Timer4Msb 00000027 00122 Timer4Lsb 00000028 00123 Timer5Msb 00000029 00124 Timer5Lsb 0000002A 00125 Timer6Msb 0000002B 00126 Timer6Lsb 0000002C 00127 Timer7Msb 0000002D 00128 Timer7Lsb MPASM 5.35 MIDIPULSEHOLD_SIMBA3.ASM 8-12-2010 19:01:20 PAGE 4 LOC OBJECT CODE LINE SOURCE TEXT VALUE 0000002E 00129 Timer8Msb 0000002F 00130 Timer8Lsb 00000030 00131 Timer9Msb 00000031 00132 Timer9Lsb 00000032 00133 Timer10Msb 00000033 00134 Timer10Lsb 00135 ENDC 00136 00137 CBLOCK 0x40 ; 00000040 00138 Flags ;byte for indicator flag bits 00000041 00139 TempData ;temporary data in main routines 00000042 00140 TempRxData ;temporary data in Rx buffer routines 00000043 00141 TempTxData ;temporary data in Tx buffer routines 00000044 00142 TxStartPtrH ;pointer to start of data in Tx buffer 00000045 00143 TxStartPtrL ;pointer to start of data in Tx buffer 00000046 00144 TxEndPtrH ;pointer to end of data in Tx buffer 00000047 00145 TxEndPtrL ;pointer to end of data in Tx buffer 00000048 00146 RxStartPtrH ;pointer to start of data in Rx buffer 00000049 00147 RxStartPtrL ;pointer to start of data in Rx buffer 0000004A 00148 RxEndPtrH ;pointer to end of data in Rx buffer 0000004B 00149 RxEndPtrL ;pointer to end of data in Rx buffer 0000004C 00150 TxBuffer:TX_BUF_LEN ;Tx buffer for data to transmit 0000005C 00151 RxBuffer:RX_BUF_LEN ;Rx buffer for received data 00152 ENDC 00153 00154 ; DO NOT MOVE THIS BLOCK 000000EE 00155 CmdBuff0RdIndx equ 0EEh 000000EF 00156 CmdBuff0WrIndx equ 0EFh 00157 000000F4 00158 CmdBuff0Timer equ 0F4h 000000F5 00159 CmdBuff0TimerValMSB equ 0F5h 000000F6 00160 CmdBuff0TimerValLSB equ 0F6h 00161 000000F7 00162 CmdBuff1Timer equ 0F7h 000000F8 00163 CmdBuff1TimerValMSB equ 0F8h 000000F9 00164 CmdBuff1TimerValLSB equ 0F9h 00165 000000FA 00166 CmdBuff2Timer equ 0FAh 000000FB 00167 CmdBuff2TimerValMSB equ 0FBh 000000FC 00168 CmdBuff2TimerValLSB equ 0FCh 00169 000000FD 00170 CmdBuff3Timer equ 0FDh 000000FE 00171 CmdBuff3TimerValMSB equ 0FEh 000000FF 00172 CmdBuff3TimerValLSB equ 0FFh 00173 00174 ; ... and incrementing this last adress wraps it to zero. 00175 ; don't change this property! 00176 00177 ;---------------------------------------------------------------------------- 00178 ; end of memory map 00179 ;---------------------------------------------------------------------------- 00180 00181 MPASM 5.35 MIDIPULSEHOLD_SIMBA3.ASM 8-12-2010 19:01:20 PAGE 5 LOC OBJECT CODE LINE SOURCE TEXT VALUE 00182 ;---------------------------------------------------------------------------- 00183 ;This code executes when a reset occurs. 00184 000000 00185 ORG 0x0000 ;place code at reset vector 00186 000000 00187 ResetVector: 000000 D056 00188 bra Main ;go to beginning of program 00189 00190 ;---------------------------------------------------------------------------- 00191 ;This code executes when a high priority interrupt occurs. 00192 000008 00193 ORG 0x0008 00194 000008 00195 HighInt: 000008 D02B 00196 bra HighIntCode ;go to high priority interrupt routine 00197 00198 ;---------------------------------------------------------------------------- 00199 ;This code executes when a low priority interrupt occurs. 00200 000018 00201 ORG 0x0018 00202 000018 00203 LowInt: 000018 CFD8 F001 00204 movff STATUS,STATUS_TEMP ;save STATUS register 00001C CFE8 F000 00205 movff WREG,WREG_TEMP ;save working register 000020 CFE0 F002 00206 movff BSR,BSR_TEMP ;save BSR register 000024 CFEA F003 00207 movff FSR0H,FSR0H_TEMP ;save FSR0H register 000028 CFE9 F004 00208 movff FSR0L,FSR0L_TEMP ;save FSR0L register 00209 00210 ;test other interrupt flags here 00211 00002C AA9E 00212 btfss PIR1,RCIF ;test for RCIF receive interrupt flag 00002E D002 00213 bra LowInt1 ;if RCIF is not set, done with test 000030 BA9D 00214 btfsc PIE1,RCIE ;else test if Rx interrupt enabled 000032 D01F 00215 bra GetData ;if so, go get received data 000034 00216 LowInt1: 000034 A89E 00217 btfss PIR1,TXIF ;test for TXIF transmit interrupt flag 000036 D002 00218 bra LowInt2 ;if TXIF is not set, done with test 000038 B89D 00219 btfsc PIE1,TXIE ;else test if Tx interrupt is enabled 00003A D001 00220 bra PutData ;if so, go transmit data 00221 00222 ;can do special error handling here - an unexpected interrupt occurred 00223 00003C 00224 LowInt2: 00003C 00FF 00225 reset ;error if no valid interrupt so reset 00226 00227 ;------------------------------------ 00228 ;Read data from the transmit buffer and put into transmit register. 00229 00003E 00230 PutData: 00003E A240 00231 btfss Flags,TxBufEmpty ;check if transmit buffer is empty 000040 D002 00232 bra PutDat1 ;if not then go transmit 000042 989D 00233 bcf PIE1,TXIE ;else disable Tx interrupt 000044 D002 00234 bra EndLowInt MPASM 5.35 MIDIPULSEHOLD_SIMBA3.ASM 8-12-2010 19:01:20 PAGE 6 LOC OBJECT CODE LINE SOURCE TEXT VALUE 00235 000046 00236 PutDat1: 000046 D8BE 00237 rcall GetTxBuffer ;get data from transmit buffer 000048 6EAD 00238 movwf TXREG ;and transmit 00239 00240 ;------------------------------------ 00241 ;End of low priority interrupt routine restores context. 00242 00004A 00243 EndLowInt: 00004A C004 FFE9 00244 movff FSR0L_TEMP,FSR0L ;restore FSR0L register 00004E C003 FFEA 00245 movff FSR0H_TEMP,FSR0H ;restore FSR0H register 000052 C002 FFE0 00246 movff BSR_TEMP,BSR ;restore BSR register 000056 C000 FFE8 00247 movff WREG_TEMP,WREG ;restore working register 00005A C001 FFD8 00248 movff STATUS_TEMP,STATUS ;restore STATUS register 00005E 0010 00249 retfie 00250 00251 ;---------------------------------------------------------------------------- 00252 ;High priority interrupt routine. 00253 000060 00254 HighIntCode: 000060 CFEA F005 00255 movff FSR0H,FSR0H_SHADOW ;save FSR0H register 000064 CFE9 F006 00256 movff FSR0L,FSR0L_SHADOW ;save FSR0L register 00257 ;test other interrupt flags here 000068 A2A1 00258 btfss PIR2,TMR3IF ;test for Timer3 receive interrupt flag 00006A D002 00259 bra HighInt1 ;if RCIF is not set, done with test 00006C B2A0 00260 btfsc PIE2,TMR3IE ;else test if Timer3 interrupt enabled 00006E D0F6 00261 bra Timer3ISR ;if so, go get received data 00262 ;can do special error handling here - an unexpected interrupt occurred 000070 00263 HighInt1: 000070 00FF 00264 reset ;error if no valid interrupt so reset 00265 00266 ;------------------------------------ 00267 ;Get received data and write into receive buffer. 00268 000072 00269 GetData: 000072 B2AB 00270 btfsc RCSTA,OERR ;if overrun error 000074 D007 00271 bra ErrOERR ;then go handle error 000076 B4AB 00272 btfsc RCSTA,FERR ;if framing error 000078 D00A 00273 bra ErrFERR ;then go handle error 00007A B440 00274 btfsc Flags,RxBufFull ;if buffer full 00007C D00E 00275 bra ErrRxOver ;then go handle error 00007E 50AE 00276 movf RCREG,W ;get received data 000080 D884 00277 rcall PutRxBuffer ;and put in buffer 000082 D7E3 00278 bra EndLowInt 00279 00280 ;error because OERR overrun error bit is set 00281 ;can do special error handling here - this code simply clears and continues 00282 000084 00283 ErrOERR: 000084 98AB 00284 bcf RCSTA,CREN ;reset the receiver logic 000086 88AB 00285 bsf RCSTA,CREN ;enable reception again 000088 0EFA 00286 movlw 0xFA; ; MIDI RT Start 00008A D85F 00287 rcall PutTxBuffer ;put data in transmit buffer MPASM 5.35 MIDIPULSEHOLD_SIMBA3.ASM 8-12-2010 19:01:20 PAGE 7 LOC OBJECT CODE LINE SOURCE TEXT VALUE 00008C D7DE 00288 bra EndLowInt 00289 00290 ;error because FERR framing error bit is set 00291 ;can do special error handling here - this code simply clears and continues 00292 00008E 00293 ErrFERR: 00008E 50AE 00294 movf RCREG,W ;discard received data that has error 000090 98AB 00295 bcf RCSTA,CREN ;reset the receiver logic 000092 88AB 00296 bsf RCSTA,CREN ;enable reception again 000094 0EFB 00297 movlw 0xFB; ; MIDI RT Continue 000096 D859 00298 rcall PutTxBuffer ;put data in transmit buffer 000098 D7D8 00299 bra EndLowInt 00300 00301 ;error because receive buffer is full 00302 ;can do special error handling here - this code checks and discards the data 00303 00009A 00304 ErrRxOver: 00009A 50AE 00305 movf RCREG,W ;discard received data 00009C 8012 00306 bsf OutsC,0; error LED 00009E 0EFB 00307 movlw 0xFB; ; MIDI RT Start 0000A0 D854 00308 rcall PutTxBuffer ;put data in transmit buffer 0000A2 D7D3 00309 bra EndLowInt 00310 00311 ;------------------------------------ 00312 ;End of high priority interrupt routine restores context. 00313 0000A4 00314 EndHighInt: 0000A4 C006 FFE9 00315 movff FSR0L_SHADOW,FSR0L ;restore FSR0L register 0000A8 C005 FFEA 00316 movff FSR0H_SHADOW,FSR0H ;restore FSR0H register 0000AC 0011 00317 retfie FAST ;return and restore context 00318 00319 ;---------------------------------------------------------------------------- 00320 ;Main routine checks for for reception of a and then calls a routine to 00321 ; move the data to transmit back. 00322 0000AE 00323 Main: 0000AE 6A89 00324 clrf LATA ; All outputs low 0000B0 6A8A 00325 clrf LATB ; All outputs low 0000B2 6A8B 00326 clrf LATC ; All outputs low 0000B4 6A92 00327 clrf TRISA ; Config PORTA as all outputs 00328 #ifdef ICD 00329 movlw 0xE0 00330 movwf TRISB 00331 #else 0000B6 6A93 00332 clrf TRISB ; Config PORTB as all outputs 00333 #endif 0000B8 0E80 00334 movlw 0x80 ; 0000BA 6E94 00335 movwf TRISC ; Config PORTC all outputs + tristate for serial rx 0000BC 0E07 00336 movlw 0x07 ; init adc 0000BE 6EC1 00337 movwf ADCON1 ; init adc 0000C0 6AC2 00338 clrf ADCON0 ; poweroff adc 0000C2 6A10 00339 clrf OutsA; 0000C4 6A11 00340 clrf OutsB; MPASM 5.35 MIDIPULSEHOLD_SIMBA3.ASM 8-12-2010 19:01:20 PAGE 8 LOC OBJECT CODE LINE SOURCE TEXT VALUE 0000C6 6A12 00341 clrf OutsC; 00342 0000C8 9C8B 00343 bcf LATC,6 ; Light error LED on powerup 00344 ; Wait a second with ALoop and BLoop 0000CA 680E 00345 setf TmpM 0000CC 00346 BLoop1: 0000CC 0EFF 00347 movlw 0xff; 0000CE 00348 ALoop1: 0000CE 2EE8 00349 decfsz WREG; 0000D0 EF67 F000 00350 goto ALoop1 0000D4 2E0E 00351 decfsz TmpM; 0000D6 EF66 F000 00352 goto BLoop1 0000DA 8C8B 00353 bsf LATC,6 ; Been patient enough, dim error LED and start 00354 0000DC 0EF4 00355 movlw CmdBuff0Timer; 0000DE 6FEE 00356 movwf CmdBuff0RdIndx; 0000E0 6FEF 00357 movwf CmdBuff0WrIndx; 0000E2 EE00 F000 00358 lfsr FSR0 ,0000h 0000E6 EE10 F000 00359 lfsr FSR1 ,0000h 0000EA D80A 00360 rcall SetupSerial ;set up serial port and buffers 0000EC D8B2 00361 rcall SetupTimer3 00362 0000EE 0E90 00363 movlw 0x90; 0000F0 6E08 00364 movwf MidiByte0 0000F2 0E0F 00365 movlw 0x0F; 0000F4 6E09 00366 movwf MidiByte1 0000F6 0E40 00367 movlw 0x40; 0000F8 6E0A 00368 movwf MidiByte2 00369 00370 ;testloop: 00371 ; nop 00372 ; call MidiInNoteOn 00373 ; bra testloop 00374 0000FA 00375 MainLoop: 00376 #ifdef simulate 00377 nop; your chance to schedule midi cmd 00378 movff MidiTestByte,WREG; 00379 rcall MidiInParser; 00380 rcall Timer3ISR 00381 #endif 0000FA EC8C F001 00382 call PollMidiIn; 0000FE D7FD 00383 bra MainLoop ;go wait for more data 00384 00385 ;---------------------------------------------------------------------------- 00386 ;Set up serial port and buffers. 00387 000100 00388 SetupSerial: 000100 0EC0 00389 movlw 0xc0 ;set tris bits for Tx and RX 000102 1294 00390 iorwf TRISC,F 000104 0E4F 00391 movlw SPBRG_VAL ;set baud rate 000106 6EAF 00392 movwf SPBRG 000108 0E24 00393 movlw 0x24 ;enable transmission and high baud rate MPASM 5.35 MIDIPULSEHOLD_SIMBA3.ASM 8-12-2010 19:01:20 PAGE 9 LOC OBJECT CODE LINE SOURCE TEXT VALUE 00010A 6EAC 00394 movwf TXSTA 00010C 0E90 00395 movlw 0x90 ;enable serial port and reception 00010E 6EAB 00396 movwf RCSTA 000110 6A40 00397 clrf Flags ;clear all flags 00398 000112 D809 00399 rcall InitTxBuffer ;initialize transmit buffer 000114 D811 00400 rcall InitRxBuffer ;initialize receive buffer 00401 000116 0E30 00402 movlw 0x30 ;enable Tx and Rx interrupts 000118 6E9D 00403 movwf PIE1 00011A 0E00 00404 movlw 0x00 ;set Rx low and Tx low priority 00011C 6E9F 00405 movwf IPR1 00011E 8ED0 00406 bsf RCON,IPEN ;enable interrupt priorities 000120 0EC0 00407 movlw 0xc0 ;enable global high and low ints 000122 6EF2 00408 movwf INTCON 000124 0012 00409 return 00410 00411 ;---------------------------------------------------------------------------- 00412 ;Circular buffer routines. 00413 00414 ;---------------------------------------------------------------------------- 00415 ;Initialize transmit buffer. 00416 000126 00417 InitTxBuffer: 000126 0E00 00418 movlw HIGH TxBuffer ;take high address of transmit buffer 000128 6E44 00419 movwf TxStartPtrH ;and place in transmit start pointer 00012A 6E46 00420 movwf TxEndPtrH ;and place in transmit end pointer 00012C 0E4C 00421 movlw LOW TxBuffer ;take low address of transmit buffer 00012E 6E45 00422 movwf TxStartPtrL ;and place in transmit start pointer 000130 6E47 00423 movwf TxEndPtrL ;and place in transmit end pointer 000132 9040 00424 bcf Flags,TxBufFull ;indicate Tx buffer is not full 000134 8240 00425 bsf Flags,TxBufEmpty ;indicate Tx buffer is empty 000136 0012 00426 return 00427 00428 ;---------------------------------------------- 00429 ;Initialize receive buffer. 00430 000138 00431 InitRxBuffer: 000138 0E00 00432 movlw HIGH RxBuffer ;take high address of receive buffer 00013A 6E48 00433 movwf RxStartPtrH ;and place in receive start pointer 00013C 6E4A 00434 movwf RxEndPtrH ;and place in receive end pointer 00013E 0E5C 00435 movlw LOW RxBuffer ;take low address of receive buffer 000140 6E49 00436 movwf RxStartPtrL ;and place in receive start pointer 000142 6E4B 00437 movwf RxEndPtrL ;and place in receive end pointer 000144 9440 00438 bcf Flags,RxBufFull ;indicate Rx buffer is not full 000146 8640 00439 bsf Flags,RxBufEmpty ;indicate Rx buffer is empty 000148 0012 00440 return 00441 00442 ;---------------------------------------------------------------------------- 00443 ;Add a byte (in WREG) to the end of the transmit buffer. 00444 00014A 00445 PutTxBuffer: 00014A 989D 00446 bcf PIE1,TXIE ;disable Tx interrupt to avoid conflict MPASM 5.35 MIDIPULSEHOLD_SIMBA3.ASM 8-12-2010 19:01:20 PAGE 10 LOC OBJECT CODE LINE SOURCE TEXT VALUE 00014C B040 00447 btfsc Flags,TxBufFull ;check if transmit buffer full 00014E D01B 00448 bra ErrTxBufFull ;go handle error if full 000150 C046 FFEA 00449 movff TxEndPtrH,FSR0H ;put EndPointer into FSR0 000154 C047 FFE9 00450 movff TxEndPtrL,FSR0L ;put EndPointer into FSR0 000158 6EEE 00451 movwf POSTINC0 ;copy data to buffer 00452 ;test if buffer pointer needs to wrap around to beginning of buffer memory 00015A 0E00 00453 movlw HIGH (TxBuffer+TX_BUF_LEN) ;get last address of buffer 00015C 62EA 00454 cpfseq FSR0H ;and compare with end pointer 00015E D005 00455 bra PutTxBuf1 ;skip low bytes if high bytes not equal 000160 0E5C 00456 movlw LOW (TxBuffer+TX_BUF_LEN) ;get last address of buffer 000162 62E9 00457 cpfseq FSR0L ;and compare with end pointer 000164 D002 00458 bra PutTxBuf1 ;go save new pointer if at end 000166 EE00 F04C 00459 lfsr 0,TxBuffer ;point to beginning of buffer if at end 00016A 00460 PutTxBuf1: 00016A CFEA F046 00461 movff FSR0H,TxEndPtrH ;save new EndPointer high byte 00016E CFE9 F047 00462 movff FSR0L,TxEndPtrL ;save new EndPointer low byte 00463 00464 ;test if buffer is full 00465 000172 5044 00466 movf TxStartPtrH,W ;get start pointer 000174 6246 00467 cpfseq TxEndPtrH ;and compare with end pointer 000176 D004 00468 bra PutTxBuf2 ;skip low bytes if high bytes not equal 000178 5045 00469 movf TxStartPtrL,W ;get start pointer 00017A 6247 00470 cpfseq TxEndPtrL ;and compare with end pointer 00017C D001 00471 bra PutTxBuf2 00017E 8040 00472 bsf Flags,TxBufFull ;if same then indicate buffer full 00473 000180 00474 PutTxBuf2: 000180 9240 00475 bcf Flags,TxBufEmpty ;Tx buffer cannot be empty 000182 889D 00476 bsf PIE1,TXIE ;enable transmit interrupt 000184 0012 00477 return 00478 00479 ;error because attempting to store new data and the buffer is full 00480 ;can do special error handling here - this code simply ignores the byte 00481 000186 00482 ErrTxBufFull: 000186 889D 00483 bsf PIE1,TXIE ;enable transmit interrupt 000188 0012 00484 return ;no save of data because buffer is full 00485 00486 ;---------------------------------------------- 00487 ;Add a byte (in WREG) to the end of the receive buffer. 00488 00018A 00489 PutRxBuffer: 00018A B440 00490 btfsc Flags,RxBufFull ;check if receive buffer full 00018C D01A 00491 bra ErrRxBufFull ;go handle error if full 00492 00018E C04A FFEA 00493 movff RxEndPtrH,FSR0H ;put EndPointer into FSR0 000192 C04B FFE9 00494 movff RxEndPtrL,FSR0L ;put EndPointer into FSR0 000196 6EEE 00495 movwf POSTINC0 ;copy data to buffer 00496 00497 ;test if buffer pointer needs to wrap around to beginning of buffer memory 00498 000198 0E00 00499 movlw HIGH (RxBuffer+RX_BUF_LEN) ;get last address of buffer MPASM 5.35 MIDIPULSEHOLD_SIMBA3.ASM 8-12-2010 19:01:20 PAGE 11 LOC OBJECT CODE LINE SOURCE TEXT VALUE 00019A 62EA 00500 cpfseq FSR0H ;and compare with end pointer 00019C D005 00501 bra PutRxBuf1 ;skip low bytes if high bytes not equal 00019E 0E6C 00502 movlw LOW (RxBuffer+RX_BUF_LEN) ;get last address of buffer 0001A0 62E9 00503 cpfseq FSR0L ;and compare with end pointer 0001A2 D002 00504 bra PutRxBuf1 ;go save new pointer if not at end 0001A4 EE00 F05C 00505 lfsr 0,RxBuffer ;point to beginning of buffer if at end 00506 0001A8 00507 PutRxBuf1: 0001A8 CFEA F04A 00508 movff FSR0H,RxEndPtrH ;save new EndPointer high byte 0001AC CFE9 F04B 00509 movff FSR0L,RxEndPtrL ;save new EndPointer low byte 00510 ;test if buffer is full 0001B0 5048 00511 movf RxStartPtrH,W ;get start pointer 0001B2 624A 00512 cpfseq RxEndPtrH ;and compare with end pointer 0001B4 D004 00513 bra PutRxBuf2 ;skip low bytes if high bytes not equal 0001B6 5049 00514 movf RxStartPtrL,W ;get start pointer 0001B8 624B 00515 cpfseq RxEndPtrL ;and compare with end pointer 0001BA D001 00516 bra PutRxBuf2 0001BC 8440 00517 bsf Flags,RxBufFull ;if same then indicate buffer full 00518 0001BE 00519 PutRxBuf2: 0001BE 9640 00520 bcf Flags,RxBufEmpty ;Rx buffer cannot be empty 0001C0 0012 00521 return 00522 00523 ;error because attempting to store new data and the buffer is full 00524 ;can do special error handling here - this code simply ignores the byte 00525 0001C2 00526 ErrRxBufFull: 0001C2 0012 00527 return ;no save of data because buffer is full 00528 00529 ;---------------------------------------------- 00530 ;Remove and return (in WREG) the byte at the start of the transmit buffer. 00531 0001C4 00532 GetTxBuffer: 0001C4 B240 00533 btfsc Flags,TxBufEmpty ;check if transmit buffer empty 0001C6 D01C 00534 bra ErrTxBufEmpty ;go handle error if empty 00535 0001C8 C044 FFEA 00536 movff TxStartPtrH,FSR0H ;put StartPointer into FSR0 0001CC C045 FFE9 00537 movff TxStartPtrL,FSR0L ;put StartPointer into FSR0 0001D0 CFEE F043 00538 movff POSTINC0,TempTxData ;save data from buffer 00539 00540 ;test if buffer pointer needs to wrap around to beginning of buffer memory 00541 0001D4 0E00 00542 movlw HIGH (TxBuffer+TX_BUF_LEN) ;get last address of buffer 0001D6 62EA 00543 cpfseq FSR0H ;and compare with start pointer 0001D8 D005 00544 bra GetTxBuf1 ;skip low bytes if high bytes not equal 0001DA 0E5C 00545 movlw LOW (TxBuffer+TX_BUF_LEN) ;get last address of buffer 0001DC 62E9 00546 cpfseq FSR0L ;and compare with start pointer 0001DE D002 00547 bra GetTxBuf1 ;go save new pointer if at end 0001E0 EE00 F04C 00548 lfsr 0,TxBuffer ;point to beginning of buffer if at end 00549 0001E4 00550 GetTxBuf1: 0001E4 CFEA F044 00551 movff FSR0H,TxStartPtrH ;save new StartPointer value 0001E8 CFE9 F045 00552 movff FSR0L,TxStartPtrL ;save new StartPointer value MPASM 5.35 MIDIPULSEHOLD_SIMBA3.ASM 8-12-2010 19:01:20 PAGE 12 LOC OBJECT CODE LINE SOURCE TEXT VALUE 00553 00554 ;test if buffer is now empty 00555 0001EC 5046 00556 movf TxEndPtrH,W ;get end pointer 0001EE 6244 00557 cpfseq TxStartPtrH ;and compare with start pointer 0001F0 D004 00558 bra GetTxBuf2 ;skip low bytes if high bytes not equal 0001F2 5047 00559 movf TxEndPtrL,W ;get end pointer 0001F4 6245 00560 cpfseq TxStartPtrL ;and compare with start pointer 0001F6 D001 00561 bra GetTxBuf2 0001F8 8240 00562 bsf Flags,TxBufEmpty ;if same then indicate buffer empty 00563 0001FA 00564 GetTxBuf2: 0001FA 9040 00565 bcf Flags,TxBufFull ;Tx buffer cannot be full 0001FC 5043 00566 movf TempTxData,W ;restore data from buffer 0001FE 0012 00567 return 00568 00569 ;error because attempting to read data from an empty buffer 00570 ;can do special error handling here - this code simply returns zero 00571 000200 00572 ErrTxBufEmpty: 000200 0C00 00573 retlw 0 ;buffer empty, return zero 00574 00575 ;---------------------------------------------- 00576 ;Remove and return (in WREG) the byte at the start of the receive buffer. 00577 000202 00578 GetRxBuffer: 000202 9A9D 00579 bcf PIE1,RCIE ;disable Rx interrupt to avoid conflict 000204 B640 00580 btfsc Flags,RxBufEmpty ;check if receive buffer empty 000206 D01D 00581 bra ErrRxBufEmpty ;go handle error if empty 00582 000208 C048 FFEA 00583 movff RxStartPtrH,FSR0H ;put StartPointer into FSR0 00020C C049 FFE9 00584 movff RxStartPtrL,FSR0L ;put StartPointer into FSR0 000210 CFEE F042 00585 movff POSTINC0,TempRxData ;save data from buffer 00586 00587 ;test if buffer pointer needs to wrap around to beginning of buffer memory 00588 000214 0E00 00589 movlw HIGH (RxBuffer+RX_BUF_LEN) ;get last address of buffer 000216 62EA 00590 cpfseq FSR0H ;and compare with start pointer 000218 D005 00591 bra GetRxBuf1 ;skip low bytes if high bytes not equal 00021A 0E6C 00592 movlw LOW (RxBuffer+RX_BUF_LEN) ;get last address of buffer 00021C 62E9 00593 cpfseq FSR0L ;and compare with start pointer 00021E D002 00594 bra GetRxBuf1 ;go save new pointer if at end 000220 EE00 F05C 00595 lfsr 0,RxBuffer ;point to beginning of buffer if at end 00596 000224 00597 GetRxBuf1: 000224 CFEA F048 00598 movff FSR0H,RxStartPtrH ;save new StartPointer value 000228 CFE9 F049 00599 movff FSR0L,RxStartPtrL ;save new StartPointer value 00600 00601 ;test if buffer is now empty 00602 00022C 504A 00603 movf RxEndPtrH,W ;get end pointer 00022E 6248 00604 cpfseq RxStartPtrH ;and compare with start pointer 000230 D004 00605 bra GetRxBuf2 ;skip low bytes if high bytes not equal MPASM 5.35 MIDIPULSEHOLD_SIMBA3.ASM 8-12-2010 19:01:20 PAGE 13 LOC OBJECT CODE LINE SOURCE TEXT VALUE 000232 504B 00606 movf RxEndPtrL,W ;get end pointer 000234 6249 00607 cpfseq RxStartPtrL ; and compare with start pointer 000236 D001 00608 bra GetRxBuf2 000238 8640 00609 bsf Flags,RxBufEmpty ;if same then indicate buffer empty 00610 00023A 00611 GetRxBuf2: 00023A 9440 00612 bcf Flags,RxBufFull ;Rx buffer cannot be full 00023C 5042 00613 movf TempRxData,W ;restore data from buffer 00023E 8A9D 00614 bsf PIE1,RCIE ;enable receive interrupt 000240 0012 00615 return 00616 00617 ;error because attempting to read data from an empty buffer 00618 ;can do special error handling here - this code simply returns zero 00619 000242 00620 ErrRxBufEmpty: 000242 8A9D 00621 bsf PIE1,RCIE ;enable receive interrupt 000244 0C00 00622 retlw 0 ;buffer empty, return zero 00623 00624 ;---------------------------------------------------------------------------- 00625 ;Move data from receive buffer to transmit buffer to echo the line back. 00626 000246 00627 CopyRxToTx: 000246 00628 Copy1: 000246 B640 00629 btfsc Flags,RxBufEmpty ;check if Rx buffer is empty 000248 0012 00630 return ;if so then return 00024A DFDB 00631 rcall GetRxBuffer ;get data from receive buffer 00024C DF7E 00632 rcall PutTxBuffer ;put data in transmit buffer 00024E D7FB 00633 bra Copy1 000250 0012 00634 return 00635 00636 ;---------------------------------------------------------------------------- 00637 ; Timer3 setup 00638 000252 00639 SetupTimer3: 000252 0E01 00640 movlw 0x01 000254 6EB1 00641 movwf T3CON ; timer3 on, other bits cleared 000256 82A2 00642 bsf IPR2,1 ; timer3 = high priority interrupt 000258 82A0 00643 bsf PIE2,1 ; timer3 interrupt enable 00025A 0012 00644 return 00645 00646 00025C 00647 Timer3ISR: 00025C 92A1 00648 bcf PIR2,TMR3IF ; clear interrupt flag 00025E 0E90 00649 movlw 090h ;0x7F; 0xA0 000260 6EB2 00650 movwf TMR3L ; preset timer 000262 68B3 00651 setf TMR3H ; preset timer 000264 5010 00652 movf OutsA,0 000266 6E89 00653 movwf LATA; 000268 5011 00654 movf OutsB,0 00026A 6E8A 00655 movwf LATB; 00026C 5012 00656 movf OutsC,0 00026E 6E8B 00657 movwf LATC; 000270 00658 ReadBuffer MPASM 5.35 MIDIPULSEHOLD_SIMBA3.ASM 8-12-2010 19:01:20 PAGE 14 LOC OBJECT CODE LINE SOURCE TEXT VALUE 000270 51EE 00659 movf CmdBuff0RdIndx, W; 000272 5DEF 00660 subwf CmdBuff0WrIndx, W ; result in w 000274 E014 00661 bz Timers; no new task on cmd queue 000276 C0EE FFE9 00662 movff CmdBuff0RdIndx, FSR0L; 00027A 6AEA 00663 clrf FSR0H 00027C 0E03 00664 movlw 0x03; 00027E 27EE 00665 addwf CmdBuff0RdIndx 000280 E102 00666 bnz NoWrap; 000282 0EF4 00667 movlw CmdBuff0Timer; Wrap to start 000284 6FEE 00668 movwf CmdBuff0RdIndx; 000286 00669 NoWrap 000286 50EF 00670 movf INDF0,W; 000288 EC80 F002 00671 call SetPulseAndHold 00028C 50EE 00672 movf POSTINC0, W; W = timer# 00028E 0F10 00673 addlw 010h; 10h= half of startaddress of timers 000290 26E8 00674 addwf WREG; W = (0x10+timer# )* 2 000292 6EE1 00675 movwf FSR1L; 000294 6AE2 00676 clrf FSR1H; FSR1 points to timer values 000296 50EE 00677 movf POSTINC0, W; W = timer val msb 000298 6EE6 00678 movwf POSTINC1; 00029A 50EE 00679 movf POSTINC0, W; W = timer val lsb 00029C 6EE6 00680 movwf POSTINC1; 00681 00682 ;************************************************************ 00683 ; Timers 00684 ; !!! change to timer interrupt instead of idle loop !!! 00029E 00685 Timers 00029E 00686 Timer1 00029E 0621 00687 decf Timer1Lsb; 0002A0 E204 00688 bc Timer2 ; 0002A2 0620 00689 decf Timer1Msb; 0002A4 E202 00690 bc Timer2 ; 0002A6 6821 00691 setf Timer1Lsb; 0002A8 9210 00692 bcf Timer1Out 0002AA 00693 Timer2 0002AA 0623 00694 decf Timer2Lsb; 0002AC E204 00695 bc Timer3 ; 0002AE 0622 00696 decf Timer2Msb; 0002B0 E202 00697 bc Timer3 ; 0002B2 6823 00698 setf Timer2Lsb; 0002B4 9610 00699 bcf Timer2Out 0002B6 00700 Timer3 0002B6 0625 00701 decf Timer3Lsb; 0002B8 E204 00702 bc Timer4 ; 0002BA 0624 00703 decf Timer3Msb; 0002BC E202 00704 bc Timer4 ; 0002BE 6825 00705 setf Timer3Lsb; 0002C0 9A10 00706 bcf Timer3Out 0002C2 00707 Timer4 0002C2 0627 00708 decf Timer4Lsb; 0002C4 E204 00709 bc Timer5 ; 0002C6 0626 00710 decf Timer4Msb; 0002C8 E202 00711 bc Timer5 ; MPASM 5.35 MIDIPULSEHOLD_SIMBA3.ASM 8-12-2010 19:01:20 PAGE 15 LOC OBJECT CODE LINE SOURCE TEXT VALUE 0002CA 6827 00712 setf Timer4Lsb; 0002CC 9C11 00713 bcf Timer4Out 0002CE 00714 Timer5 0002CE 0629 00715 decf Timer5Lsb; 0002D0 E204 00716 bc Timer6 ; 0002D2 0628 00717 decf Timer5Msb; 0002D4 E202 00718 bc Timer6 ; 0002D6 6829 00719 setf Timer5Lsb; 0002D8 9811 00720 bcf Timer5Out 0002DA 00721 Timer6 0002DA 062B 00722 decf Timer6Lsb; 0002DC E204 00723 bc Timer7 ; 0002DE 062A 00724 decf Timer6Msb; 0002E0 E202 00725 bc Timer7 ; 0002E2 682B 00726 setf Timer6Lsb; 0002E4 9411 00727 bcf Timer6Out 0002E6 00728 Timer7 0002E6 062D 00729 decf Timer7Lsb; 0002E8 E204 00730 bc Timer8 ; 0002EA 062C 00731 decf Timer7Msb; 0002EC E202 00732 bc Timer8 ; 0002EE 682D 00733 setf Timer7Lsb; 0002F0 9011 00734 bcf Timer7Out 0002F2 00735 Timer8 0002F2 062F 00736 decf Timer8Lsb; 0002F4 E204 00737 bc Timer9 ; 0002F6 062E 00738 decf Timer8Msb; 0002F8 E202 00739 bc Timer9 ; 0002FA 682F 00740 setf Timer8Lsb; 0002FC 9812 00741 bcf Timer8Out 0002FE 00742 Timer9 0002FE 0631 00743 decf Timer9Lsb; 000300 E204 00744 bc Timer10 ; 000302 0630 00745 decf Timer9Msb; 000304 E202 00746 bc Timer10 ; 000306 6831 00747 setf Timer9Lsb; 000308 9212 00748 bcf Timer9Out 00030A 00749 Timer10 00030A 0633 00750 decf Timer10Lsb; 00030C E204 00751 bc Timer11 ; 00030E 0632 00752 decf Timer10Msb; 000310 E202 00753 bc Timer11 ; 000312 6833 00754 setf Timer10Lsb; 000314 9612 00755 bcf Timer10Out 000316 00756 Timer11 000316 D6C6 00757 bra EndHighInt ; resume 00758 00759 ;---------------------------------------------------------------------------- 00760 ; MIDI Input parser 00761 ; 00762 ; pseudocode: 00763 ; 00764 ; MidiInParser: MPASM 5.35 MIDIPULSEHOLD_SIMBA3.ASM 8-12-2010 19:01:20 PAGE 16 LOC OBJECT CODE LINE SOURCE TEXT VALUE 00765 ; if (inByte & 0x80) 00766 ; MidiStatus = inByte 00767 ; goto MidiInStatus 00768 ; else 00769 ; goto MidiInData 00770 ; return 00771 ; 00772 ; MidiInStatus: 00773 ; Look up # databytes 00774 ; 1000xxxx -> 2 (noteOn) 00775 ; 1001xxxx -> 2 (noteOff) 00776 ; 1010xxxx -> 2 (polyKeyPr) 00777 ; 1011xxxx -> 2 (ctrlChange) 00778 ; 1100xxxx -> 1 (pgmChg 00779 ; 1101xxxx -> 1 (chnlPr) 00780 ; 1110xxxx -> 0 (System Common Messages -> ignore) 00781 ; 1111xxxx -> 0 (SysEx) 00782 ; 00783 ; store in MidiNumData 00784 ; MidiCurDataBytes=0 00785 ; return 00786 ; 00787 ; MidiInData: 00788 ; If (MidiCurData==0) 00789 ; MidiData1=inByte 00790 ; If (MidiCurData==1) 00791 ; MidiData2=inByte 00792 ; MidiCurData++; 00793 ; 00794 ; If (MidiCurData==MidiNumData) 00795 ; { 00796 ; If (MidiStatus==NoteOn + channel) 00797 ; ... 00798 ; 00799 ; If (MidiStatus==NoteOff + channel) 00800 ; } ... 00801 ; 00802 000318 00803 PollMidiIn: 000318 B640 00804 btfsc Flags,RxBufEmpty ;check if Rx buffer is empty 00031A 0012 00805 return ;if so then return 00031C DF72 00806 rcall GetRxBuffer ;get data from receive buffer 00031E 00807 MidiInParser: 00031E 6E07 00808 movwf MidiInByte; 000320 DF14 00809 rcall PutTxBuffer; 00810 ; return 000322 5007 00811 movf MidiInByte,W; 000324 AE07 00812 btfss MidiInByte,7; 000326 D00B 00813 bra MidiInData; ; jump if it wasn't a status byte 000328 6E08 00814 movwf MidiByte0; 00032A 00815 MidiInStatus: 00032A 6A0B 00816 clrf MidiCurData; 00032C AC08 00817 btfss MidiByte0,6; MPASM 5.35 MIDIPULSEHOLD_SIMBA3.ASM 8-12-2010 19:01:20 PAGE 17 LOC OBJECT CODE LINE SOURCE TEXT VALUE 00032E D004 00818 bra MidiInStatus2words; 000330 AA08 00819 btfss MidiByte0,5; 000332 0E01 00820 movlw 1; 000334 6E0C 00821 movwf MidiNumData; 000336 0012 00822 return 000338 00823 MidiInStatus2words: 000338 0E02 00824 movlw 2; 00033A 6E0C 00825 movwf MidiNumData; 00033C 00826 MidiInStatusEnd: 00033C 0012 00827 return 00828 00033E 00829 MidiInData: 00033E 660B 00830 tstfsz MidiCurData; 000340 D001 00831 bra MidiInDataM2; 000342 D004 00832 bra MidiInDataM1; 000344 00833 MidiInDataM2: 00834 ; 2nd byte 000344 C007 F00A 00835 movff MidiInByte,MidiByte2; 000348 6A0B 00836 clrf MidiCurData; 00034A D008 00837 bra MidiInAction2Bytes; 00034C 00838 MidiInDataM1: 00034C C007 F009 00839 movff MidiInByte,MidiByte1; 000350 2A0B 00840 incf MidiCurData; 000352 500B 00841 movf MidiCurData,W; 000354 5C0C 00842 subwf MidiNumData,W; 000356 E001 00843 bz MidiInAction1Byte; 000358 0012 00844 return; 00845 00035A 00846 MidiInAction1Byte: 00035A 0012 00847 return; 00848 00035C 00849 MidiInAction2Bytes: Error[113] : Symbol not previously defined (MidiChannel) 00035C 0E90 00850 movlw 090h + MidiChannel; noteOn 00035E 5C08 00851 subwf MidiByte0,0; 000360 E007 00852 bz MidiInNoteOn; Error[113] : Symbol not previously defined (MidiChannel) 000362 0E80 00853 movlw 080h + MidiChannel; noteOff 000364 5C08 00854 subwf MidiByte0,0; 000366 E027 00855 bz MidiInNoteOff; Error[113] : Symbol not previously defined (MidiChannel) 000368 0EB0 00856 movlw 0B0h + MidiChannel; CtrlChange 00036A 5C08 00857 subwf MidiByte0,0; 00036C E02F 00858 bz MidiInCtrlChange; 00036E 0012 00859 return; 00860 00861 000370 00862 MidiInNoteOn: 00863 ; lookup timer #, read from table in PM:0Fvv 000370 500A 00864 movf MidiByte2,W; 000372 E021 00865 bz MidiInNoteOffNoVelo; ; velocity=0 -> NOTE OFF 00866 ; check if note is in range Error[113] : Symbol not previously defined (FirstNote) MPASM 5.35 MIDIPULSEHOLD_SIMBA3.ASM 8-12-2010 19:01:20 PAGE 18 LOC OBJECT CODE LINE SOURCE TEXT VALUE 000374 0E00 00867 movlw FirstNote 000376 5C09 00868 subwf MidiByte1,W 000378 E61D 00869 bn MidiInNoteOn2 ; 00037A 6E0F 00870 movwf TmpT Error[113] : Symbol not previously defined (LastNote) 00037C 0E00 00871 movlw LastNote 00037E 5C09 00872 subwf MidiByte1,W 000380 E719 00873 bnn MidiInNoteOn2 ; 00874 ; add to cmd queue 000382 6AEA 00875 clrf FSR0H 000384 C0EF FFE9 00876 movff CmdBuff0WrIndx, FSR0L; 000388 500F 00877 movf TmpT,W 00038A 6EEE 00878 movwf POSTINC0; write timer # 00879 ; lookup velo -> timer val 00038C 500A 00880 movf MidiByte2,W; 00038E 240A 00881 addwf MidiByte2,W; 000390 6EF6 00882 movwf TBLPTRL; 000392 0E10 00883 movlw 010h; 000394 6EF7 00884 movwf TBLPTRH 000396 0009 00885 TBLRD*+ ; 000398 CFF5 F00E 00886 movff TABLAT,TmpM 00039C 0009 00887 TBLRD*+ ; 00039E 50F5 00888 movf TABLAT,W 0003A0 6EEE 00889 movwf POSTINC0 ; write timer lsb 0003A2 500E 00890 movf TmpM,W; 0003A4 6EEE 00891 movwf POSTINC0 ; write timer msb 0003A6 50E9 00892 movf FSR0L,W; 0003A8 E002 00893 bz NoWrap2; corrected: was: bnz 0003AA 6FEF 00894 movwf CmdBuff0WrIndx; 0003AC 0012 00895 return 0003AE 00896 NoWrap2 0003AE 0EF4 00897 movlw CmdBuff0Timer; Wrap to start 0003B0 6FEF 00898 movwf CmdBuff0WrIndx; 0003B2 0012 00899 return 00900 00901 0003B4 00902 MidiInNoteOn2: 0003B4 0012 00903 return 00904 00905 0003B6 00906 MidiInNoteOffNoVelo: 0003B6 00907 MidiInNoteOff: 00908 ; for non-timered note outputs Error[113] : Symbol not previously defined (FirstNote) 0003B6 0E00 00909 movlw FirstNote 0003B8 5C09 00910 subwf MidiByte1,W 0003BA E607 00911 bn MidiInNoteOff2; 0003BC 6E0F 00912 movwf TmpT Error[113] : Symbol not previously defined (LastNote) 0003BE 0E00 00913 movlw LastNote 0003C0 5C09 00914 subwf MidiByte1,W 0003C2 E703 00915 bnn MidiInNoteOff2; 0003C4 500F 00916 movf TmpT,W MPASM 5.35 MIDIPULSEHOLD_SIMBA3.ASM 8-12-2010 19:01:20 PAGE 19 LOC OBJECT CODE LINE SOURCE TEXT VALUE 0003C6 D0BE 00917 bra ClearHold 0003C8 0012 00918 return 00919 0003CA 00920 MidiInNoteOff2: 0003CA 0012 00921 return 00922 00923 0003CC 00924 MidiInCtrlChange: 0003CC 0E7B 00925 movlw 0x7B; AllNotesOff 0003CE 5C09 00926 subwf MidiByte1,0; 0003D0 E001 00927 bz MidiInAllNotesOff; 0003D2 0012 00928 return 00929 0003D4 00930 MidiInAllNotesOff: 0003D4 6A10 00931 clrf OutsA; 0003D6 6A11 00932 clrf OutsB; 0003D8 6A12 00933 clrf OutsC; 0003DA 6A89 00934 clrf LATA 0003DC 6A8A 00935 clrf LATB 0003DE 6A8B 00936 clrf LATC 0003E0 0012 00937 return 00938 000500 00939 ORG 0x0500 00940 00941 000500 00942 SetPulseAndHold: 00943 ; lookup using a computed goto 00944 ; cfr. PIC18fxx2 datasheet section 4.4 000500 0D06 00945 mullw 0x06; 000502 50F9 00946 movf PCL,W 000504 50F3 00947 movf PRODL,W 000506 26F9 00948 addwf PCL 000508 00949 _sph1: 000508 8410 00950 bsf Note1Hold 00050A 8210 00951 bsf Timer1Out 00050C 0012 00952 return 00050E 00953 _sph2: 00050E 8010 00954 bsf Note2Hold 000510 8610 00955 bsf Timer2Out 000512 0012 00956 return 000514 00957 _sph3: 000514 8810 00958 bsf Note3Hold 000516 8A10 00959 bsf Timer3Out 000518 0012 00960 return 00051A 00961 _sph4: 00051A 8E11 00962 bsf Note4Hold 00051C 8C11 00963 bsf Timer4Out 00051E 0012 00964 return 000520 00965 _sph5: 000520 8A11 00966 bsf Note5Hold 000522 8811 00967 bsf Timer5Out 000524 0012 00968 return 000526 00969 _sph6: MPASM 5.35 MIDIPULSEHOLD_SIMBA3.ASM 8-12-2010 19:01:20 PAGE 20 LOC OBJECT CODE LINE SOURCE TEXT VALUE 000526 8611 00970 bsf Note6Hold 000528 8411 00971 bsf Timer6Out 00052A 0012 00972 return 00052C 00973 _sph7: 00052C 8211 00974 bsf Note7Hold 00052E 8011 00975 bsf Timer7Out 000530 0012 00976 return 000532 00977 _sph8: 000532 8A12 00978 bsf Note8Hold 000534 8812 00979 bsf Timer8Out 000536 0012 00980 return 000538 00981 _sph9: 000538 8012 00982 bsf Note9Hold 00053A 8212 00983 bsf Timer9Out 00053C 0012 00984 return 00053E 00985 _sph10: 00053E 8412 00986 bsf Note10Hold 000540 8612 00987 bsf Timer10Out 000542 0012 00988 return 00989 00990 000544 00991 ClearHold: 000544 0D04 00992 mullw 0x04; 000546 50F9 00993 movf PCL,W 000548 50F3 00994 movf PRODL,W 00054A 26F9 00995 addwf PCL 00054C 00996 _ch1: 00054C 9410 00997 bcf Note1Hold 00054E 0012 00998 return 000550 00999 _ch2: 000550 9010 01000 bcf Note2Hold 000552 0012 01001 return 000554 01002 _ch3: 000554 9810 01003 bcf Note3Hold 000556 0012 01004 return 000558 01005 _ch4: 000558 9E11 01006 bcf Note4Hold 00055A 0012 01007 return 00055C 01008 _ch5: 00055C 9A11 01009 bcf Note5Hold 00055E 0012 01010 return 000560 01011 _ch6: 000560 9611 01012 bcf Note6Hold 000562 0012 01013 return 000564 01014 _ch7: 000564 9211 01015 bcf Note7Hold 000566 0012 01016 return 000568 01017 _ch8: 000568 9A12 01018 bcf Note8Hold 00056A 0012 01019 return 00056C 01020 _ch9: 00056C 9012 01021 bcf Note9Hold 00056E 0012 01022 return MPASM 5.35 MIDIPULSEHOLD_SIMBA3.ASM 8-12-2010 19:01:20 PAGE 21 LOC OBJECT CODE LINE SOURCE TEXT VALUE 000570 01023 _ch10: 000570 9412 01024 bcf Note10Hold 000572 0012 01025 return 01026 01027 000574 01028 SetHold: 000574 0D04 01029 mullw 0x04; 000576 50F9 01030 movf PCL,W 000578 50F3 01031 movf PRODL,W 00057A 26F9 01032 addwf PCL 00057C 01033 _sh1: 00057C 8410 01034 bsf Note1Hold 00057E 0012 01035 return 000580 01036 _sh2: 000580 8010 01037 bsf Note2Hold 000582 0012 01038 return 000584 01039 _sh3: 000584 8810 01040 bsf Note3Hold 000586 0012 01041 return 000588 01042 _sh4: 000588 8E11 01043 bsf Note4Hold 00058A 0012 01044 return 00058C 01045 _sh5: 00058C 8A11 01046 bsf Note5Hold 00058E 0012 01047 return 000590 01048 _sh6: 000590 8611 01049 bsf Note6Hold 000592 0012 01050 return 000594 01051 _sh7: 000594 8211 01052 bsf Note7Hold 000596 0012 01053 return 000598 01054 _sh8: 000598 8A12 01055 bsf Note8Hold 00059A 0012 01056 return 00059C 01057 _sh9: 00059C 8012 01058 bsf Note9Hold 00059E 0012 01059 return 0005A0 01060 _sh10: 0005A0 8412 01061 bsf Note10Hold 0005A2 0012 01062 return 01063 01064 0005A4 01065 SetPulse: 0005A4 0D04 01066 mullw 0x04; 0005A6 50F9 01067 movf PCL,W 0005A8 50F3 01068 movf PRODL,W 0005AA 26F9 01069 addwf PCL 0005AC 01070 _sp1 0005AC 8210 01071 bsf Timer1Out 0005AE 0012 01072 return 0005B0 01073 _sp2 0005B0 9610 01074 bcf Timer2Out 0005B2 0012 01075 return MPASM 5.35 MIDIPULSEHOLD_SIMBA3.ASM 8-12-2010 19:01:20 PAGE 22 LOC OBJECT CODE LINE SOURCE TEXT VALUE 0005B4 01076 _sp3 0005B4 9A10 01077 bcf Timer3Out 0005B6 0012 01078 return 0005B8 01079 _sp4 0005B8 9C11 01080 bcf Timer4Out 0005BA 0012 01081 return 0005BC 01082 _sp5 0005BC 9811 01083 bcf Timer5Out 0005BE 0012 01084 return 0005C0 01085 _sp6 0005C0 9411 01086 bcf Timer6Out 0005C2 0012 01087 return 0005C4 01088 _sp7 0005C4 9011 01089 bcf Timer7Out 0005C6 0012 01090 return 0005C8 01091 _sp8 0005C8 9812 01092 bcf Timer8Out 0005CA 0012 01093 return 0005CC 01094 _sp9 0005CC 9212 01095 bcf Timer9Out 0005CE 0012 01096 return 0005D0 01097 _sp10 0005D0 9612 01098 bcf Timer10Out 0005D2 0012 01099 return Error[129] : Expected (END) MPASM 5.35 MIDIPULSEHOLD_SIMBA3.ASM 8-12-2010 19:01:20 PAGE 23 SYMBOL TABLE LABEL VALUE A 00000000 ABDEN 00000000 ABDOVF 00000007 ACCESS 00000000 ACKDT 00000005 ACKEN 00000004 ACKSTAT 00000006 ACQT0 00000003 ACQT1 00000004 ACQT2 00000005 ADCON0 00000FC2 ADCON1 00000FC1 ADCON2 00000FC0 ADCS0 00000000 ADCS1 00000001 ADCS2 00000002 ADDEN 00000003 ADEN 00000003 ADFM 00000007 ADIE 00000006 ADIF 00000006 ADIP 00000006 ADON 00000000 ADRES 00000FC3 ADRESH 00000FC4 ADRESL 00000FC3 ALoop1 000000CE AN10 00000001 AN11 00000004 AN12 00000000 AN4 00000005 AN8 00000002 AN9 00000003 BANKED 00000001 BAUDCON 00000FB8 BAUDCTL 00000FB8 BCLIE 00000003 BCLIF 00000003 BCLIP 00000003 BF 00000000 BGST 00000005 BLoop1 000000CC BOR 00000000 BRG16 00000003 BRGH 00000002 BSR 00000FE0 BSR_TEMP 00000002 C 00000000 C1INV 00000004 C1OUT 00000006 C2INV 00000005 C2OUT 00000007 CCP1 00000002 MPASM 5.35 MIDIPULSEHOLD_SIMBA3.ASM 8-12-2010 19:01:20 PAGE 24 SYMBOL TABLE LABEL VALUE CCP1CON 00000FBD CCP1IE 00000002 CCP1IF 00000002 CCP1IP 00000002 CCP1M0 00000000 CCP1M1 00000001 CCP1M2 00000002 CCP1M3 00000003 CCP1X 00000005 CCP1Y 00000004 CCP2CON 00000FBA CCP2IE 00000000 CCP2IF 00000000 CCP2IP 00000000 CCP2M0 00000000 CCP2M1 00000001 CCP2M2 00000002 CCP2M3 00000003 CCP2X 00000005 CCP2Y 00000004 CCP2_PORTB 00000003 CCP2_PORTC 00000001 CCPR1 00000FBE CCPR1H 00000FBF CCPR1L 00000FBE CCPR2 00000FBB CCPR2H 00000FBC CCPR2L 00000FBB CFGS 00000006 CHS0 00000002 CHS1 00000003 CHS2 00000004 CHS3 00000005 CIS 00000003 CK 00000006 CKE 00000006 CKP 00000004 CM0 00000000 CM1 00000001 CM2 00000002 CMCON 00000FB4 CMIE 00000006 CMIF 00000006 CMIP 00000006 CREN 00000004 CSRC 00000007 CVR0 00000000 CVR1 00000001 CVR2 00000002 CVR3 00000003 CVRCON 00000FB5 CVREN 00000007 CVROE 00000006 MPASM 5.35 MIDIPULSEHOLD_SIMBA3.ASM 8-12-2010 19:01:20 PAGE 25 SYMBOL TABLE LABEL VALUE CVRR 00000005 CVRSS 00000004 ClearHold 00000544 CmdBuff0RdIndx 000000EE CmdBuff0Timer 000000F4 CmdBuff0TimerValLSB 000000F6 CmdBuff0TimerValMSB 000000F5 CmdBuff0WrIndx 000000EF CmdBuff1Timer 000000F7 CmdBuff1TimerValLSB 000000F9 CmdBuff1TimerValMSB 000000F8 CmdBuff2Timer 000000FA CmdBuff2TimerValLSB 000000FC CmdBuff2TimerValMSB 000000FB CmdBuff3Timer 000000FD CmdBuff3TimerValLSB 000000FF CmdBuff3TimerValMSB 000000FE Copy1 00000246 CopyRxToTx 00000246 D 00000005 DC 00000001 DC1B0 00000004 DC1B1 00000005 DC2B0 00000004 DC2B1 00000005 DDRA TRISA DDRB TRISB DDRC TRISC DDRD TRISD DDRE TRISE DEBUG 00000FD4 DONE 00000001 D_A 00000005 EEADR 00000FA9 EEADRH 00000FAA EECON1 00000FA6 EECON2 00000FA7 EEDATA 00000FA8 EEIE 00000004 EEIF 00000004 EEIP 00000004 EEPGD 00000007 EndHighInt 000000A4 EndLowInt 0000004A ErrFERR 0000008E ErrOERR 00000084 ErrRxBufEmpty 00000242 ErrRxBufFull 000001C2 ErrRxOver 0000009A ErrTxBufEmpty 00000200 ErrTxBufFull 00000186 FAST 00000001 FERR 00000002 MPASM 5.35 MIDIPULSEHOLD_SIMBA3.ASM 8-12-2010 19:01:20 PAGE 26 SYMBOL TABLE LABEL VALUE FLTS 00000002 FREE 00000004 FSR0 00000000 FSR0H 00000FEA FSR0H_SHADOW 00000005 FSR0H_TEMP 00000003 FSR0L 00000FE9 FSR0L_SHADOW 00000006 FSR0L_TEMP 00000004 FSR1 00000001 FSR1H 00000FE2 FSR1L 00000FE1 FSR2 00000002 FSR2H 00000FDA FSR2L 00000FD9 Flags 00000040 GCEN 00000007 GIE 00000007 GIEH 00000007 GIEL 00000006 GO 00000001 GO_DONE 00000001 GetData 00000072 GetRxBuf1 00000224 GetRxBuf2 0000023A GetRxBuffer 00000202 GetTxBuf1 000001E4 GetTxBuf2 000001FA GetTxBuffer 000001C4 HLVDCON 00000FD2 HLVDEN 00000004 HLVDIE 00000002 HLVDIF 00000002 HLVDIN 00000005 HLVDIP 00000002 HLVDL0 00000000 HLVDL1 00000001 HLVDL2 00000002 HLVDL3 00000003 HighInt 00000008 HighInt1 00000070 HighIntCode 00000060 IDLEN 00000007 INDF0 00000FEF INDF1 00000FE7 INDF2 00000FDF INT0 00000000 INT0E 00000004 INT0F 00000001 INT0IE 00000004 INT0IF 00000001 INT1 00000001 INT1E 00000003 MPASM 5.35 MIDIPULSEHOLD_SIMBA3.ASM 8-12-2010 19:01:20 PAGE 27 SYMBOL TABLE LABEL VALUE INT1F 00000000 INT1IE 00000003 INT1IF 00000000 INT1IP 00000006 INT1P 00000006 INT2 00000002 INT2E 00000004 INT2F 00000001 INT2IE 00000004 INT2IF 00000001 INT2IP 00000007 INT2P 00000007 INTCON 00000FF2 INTCON2 00000FF1 INTCON3 00000FF0 INTEDG0 00000006 INTEDG1 00000005 INTEDG2 00000004 INTSRC 00000007 IOFS 00000002 IPEN 00000007 IPR1 00000F9F IPR2 00000FA2 IRCF0 00000004 IRCF1 00000005 IRCF2 00000006 IRVST 00000005 IVRST 00000005 InitRxBuffer 00000138 InitTxBuffer 00000126 KBI0 00000004 KBI1 00000005 KBI2 00000006 KBI3 00000007 LATA 00000F89 LATA0 00000000 LATA1 00000001 LATA2 00000002 LATA3 00000003 LATA4 00000004 LATA5 00000005 LATA6 00000006 LATA7 00000007 LATB 00000F8A LATB0 00000000 LATB1 00000001 LATB2 00000002 LATB3 00000003 LATB4 00000004 LATB5 00000005 LATB6 00000006 LATB7 00000007 LATC 00000F8B MPASM 5.35 MIDIPULSEHOLD_SIMBA3.ASM 8-12-2010 19:01:20 PAGE 28 SYMBOL TABLE LABEL VALUE LATC0 00000000 LATC1 00000001 LATC2 00000002 LATC3 00000003 LATC4 00000004 LATC5 00000005 LATC6 00000006 LATC7 00000007 LVDCON 00000FD2 LVDEN 00000004 LVDIE 00000002 LVDIF 00000002 LVDIN 00000005 LVDIP 00000002 LVDL0 00000000 LVDL1 00000001 LVDL2 00000002 LVDL3 00000003 LVV0 00000000 LVV1 00000001 LVV2 00000002 LVV3 00000003 LowInt 00000018 LowInt1 00000034 LowInt2 0000003C MCLR 00000003 Main 000000AE MainLoop 000000FA MidiByte0 00000008 MidiByte1 00000009 MidiByte2 0000000A MidiCurData 0000000B MidiInAction1Byte 0000035A MidiInAction2Bytes 0000035C MidiInAllNotesOff 000003D4 MidiInByte 00000007 MidiInCtrlChange 000003CC MidiInData 0000033E MidiInDataM1 0000034C MidiInDataM2 00000344 MidiInNoteOff 000003B6 MidiInNoteOff2 000003CA MidiInNoteOffNoVelo 000003B6 MidiInNoteOn 00000370 MidiInNoteOn2 000003B4 MidiInParser 0000031E MidiInStatus 0000032A MidiInStatus2words 00000338 MidiInStatusEnd 0000033C MidiNumData 0000000C MidiTestByte 0000000D N 00000004 NOT_A 00000005 MPASM 5.35 MIDIPULSEHOLD_SIMBA3.ASM 8-12-2010 19:01:20 PAGE 29 SYMBOL TABLE LABEL VALUE NOT_ADDRESS 00000005 NOT_BOR 00000000 NOT_DONE 00000001 NOT_MCLR 00000003 NOT_PD 00000002 NOT_POR 00000001 NOT_RBPU 00000007 NOT_RI 00000004 NOT_SS 00000005 NOT_T1SYNC 00000002 NOT_T3SYNC 00000002 NOT_TO 00000003 NOT_W 00000002 NOT_WRITE 00000002 NoWrap 00000286 NoWrap2 000003AE Note10Hold OutsC,2 Note1Hold OutsA,2 Note2Hold OutsA,0 Note3Hold OutsA,4 Note4Hold OutsB,7 Note5Hold OutsB,5 Note6Hold OutsB,3 Note7Hold OutsB,1 Note8Hold OutsC,5 Note9Hold OutsC,0 OERR 00000001 OSCCON 00000FD3 OSCFIE 00000007 OSCFIF 00000007 OSCFIP 00000007 OSCTUNE 00000F9B OSTS 00000003 OV 00000003 OutsA 00000010 OutsB 00000011 OutsC 00000012 P 00000004 PC 00000FF9 PCFG0 00000000 PCFG1 00000001 PCFG2 00000002 PCFG3 00000003 PCL 00000FF9 PCLATH 00000FFA PCLATU 00000FFB PD 00000002 PEIE 00000006 PEN 00000002 PGC 00000006 PGD 00000007 PGM 00000005 PIE1 00000F9D MPASM 5.35 MIDIPULSEHOLD_SIMBA3.ASM 8-12-2010 19:01:20 PAGE 30 SYMBOL TABLE LABEL VALUE PIE2 00000FA0 PIR1 00000F9E PIR2 00000FA1 PLLEN 00000006 PLUSW0 00000FEB PLUSW1 00000FE3 PLUSW2 00000FDB POR 00000001 PORTA 00000F80 PORTB 00000F81 PORTC 00000F82 PORTE 00000F84 POSTDEC0 00000FED POSTDEC1 00000FE5 POSTDEC2 00000FDD POSTINC0 00000FEE POSTINC1 00000FE6 POSTINC2 00000FDE PR2 00000FCB PREINC0 00000FEC PREINC1 00000FE4 PREINC2 00000FDC PROD 00000FF3 PRODH 00000FF4 PRODL 00000FF3 PSA 00000003 PollMidiIn 00000318 PutDat1 00000046 PutData 0000003E PutRxBuf1 000001A8 PutRxBuf2 000001BE PutRxBuffer 0000018A PutTxBuf1 0000016A PutTxBuf2 00000180 PutTxBuffer 0000014A R 00000002 RA0 00000000 RA1 00000001 RA2 00000002 RA3 00000003 RA4 00000004 RA5 00000005 RA6 00000006 RA7 00000007 RB0 00000000 RB1 00000001 RB2 00000002 RB3 00000003 RB4 00000004 RB5 00000005 RB6 00000006 RB7 00000007 RBIE 00000003 MPASM 5.35 MIDIPULSEHOLD_SIMBA3.ASM 8-12-2010 19:01:20 PAGE 31 SYMBOL TABLE LABEL VALUE RBIF 00000000 RBIP 00000000 RBPU 00000007 RC0 00000000 RC1 00000001 RC2 00000002 RC3 00000003 RC4 00000004 RC5 00000005 RC6 00000006 RC7 00000007 RCEN 00000003 RCIDL 00000006 RCIE 00000005 RCIF 00000005 RCIP 00000005 RCMT 00000006 RCON 00000FD0 RCREG 00000FAE RCSTA 00000FAB RD 00000000 RD16 00000007 RE3 00000003 RI 00000004 RSEN 00000001 RX 00000007 RX9 00000006 RX9D 00000000 RX_BUF_LEN 00000010 R_W 00000002 ReadBuffer 00000270 ResetVector 00000000 RxBufEmpty 00000003 RxBufFull 00000002 RxBuffer 0000005C RxEndPtrH 0000004A RxEndPtrL 0000004B RxStartPtrH 00000048 RxStartPtrL 00000049 S 00000003 SBOREN 00000006 SCK 00000003 SCKP 00000004 SCL 00000003 SCS0 00000000 SCS1 00000001 SDA 00000004 SDI 00000004 SDO 00000005 SEN 00000000 SENDB 00000003 SMP 00000007 SP0 00000000 MPASM 5.35 MIDIPULSEHOLD_SIMBA3.ASM 8-12-2010 19:01:20 PAGE 32 SYMBOL TABLE LABEL VALUE SP1 00000001 SP2 00000002 SP3 00000003 SP4 00000004 SPBRG 00000FAF SPBRGH 00000FB0 SPBRG_VAL 0000004F SPEN 00000007 SREN 00000005 SS 00000005 SSPADD 00000FC8 SSPBUF 00000FC9 SSPCON1 00000FC6 SSPCON2 00000FC5 SSPEN 00000005 SSPIE 00000003 SSPIF 00000003 SSPIP 00000003 SSPM0 00000000 SSPM1 00000001 SSPM2 00000002 SSPM3 00000003 SSPOV 00000006 SSPSTAT 00000FC7 STATUS 00000FD8 STATUS_TEMP 00000001 STKFUL 00000007 STKOVF 00000007 STKPTR 00000FFC STKPTR0 00000000 STKPTR1 00000001 STKPTR2 00000002 STKPTR3 00000003 STKPTR4 00000004 STKUNF 00000006 SWDTE 00000000 SWDTEN 00000000 SYNC 00000004 SetHold 00000574 SetPulse 000005A4 SetPulseAndHold 00000500 SetupSerial 00000100 SetupTimer3 00000252 T016BIT 00000006 T08BIT 00000006 T0CKI 00000004 T0CON 00000FD5 T0CS 00000005 T0IE 00000005 T0IF 00000002 T0PS0 00000000 T0PS1 00000001 T0PS2 00000002 MPASM 5.35 MIDIPULSEHOLD_SIMBA3.ASM 8-12-2010 19:01:20 PAGE 33 SYMBOL TABLE LABEL VALUE T0SE 00000004 T13CKI 00000000 T1CKI 00000000 T1CKPS0 00000004 T1CKPS1 00000005 T1CON 00000FCD T1OSCEN 00000003 T1OSI 00000001 T1OSO 00000000 T1RUN 00000006 T1SYNC 00000002 T2CKPS0 00000000 T2CKPS1 00000001 T2CON 00000FCA T2OUTPS0 00000003 T2OUTPS1 00000004 T2OUTPS2 00000005 T2OUTPS3 00000006 T3CCP1 00000003 T3CCP2 00000006 T3CKPS0 00000004 T3CKPS1 00000005 T3CON 00000FB1 T3SYNC 00000002 TABLAT 00000FF5 TBLPTR 00000FF6 TBLPTRH 00000FF7 TBLPTRL 00000FF6 TBLPTRU 00000FF8 TMR0H 00000FD7 TMR0IE 00000005 TMR0IF 00000002 TMR0IP 00000002 TMR0L 00000FD6 TMR0ON 00000007 TMR1CS 00000001 TMR1H 00000FCF TMR1IE 00000000 TMR1IF 00000000 TMR1IP 00000000 TMR1L 00000FCE TMR1ON 00000000 TMR2 00000FCC TMR2IE 00000001 TMR2IF 00000001 TMR2IP 00000001 TMR2ON 00000002 TMR3CS 00000001 TMR3H 00000FB3 TMR3IE 00000001 TMR3IF 00000001 TMR3IP 00000001 TMR3L 00000FB2 MPASM 5.35 MIDIPULSEHOLD_SIMBA3.ASM 8-12-2010 19:01:20 PAGE 34 SYMBOL TABLE LABEL VALUE TMR3ON 00000000 TO 00000003 TOS 00000FFD TOSH 00000FFE TOSL 00000FFD TOSU 00000FFF TOUTPS0 00000003 TOUTPS1 00000004 TOUTPS2 00000005 TOUTPS3 00000006 TRISA 00000F92 TRISA0 00000000 TRISA1 00000001 TRISA2 00000002 TRISA3 00000003 TRISA4 00000004 TRISA5 00000005 TRISA6 00000006 TRISA7 00000007 TRISB 00000F93 TRISB0 00000000 TRISB1 00000001 TRISB2 00000002 TRISB3 00000003 TRISB4 00000004 TRISB5 00000005 TRISB6 00000006 TRISB7 00000007 TRISC 00000F94 TRISC0 00000000 TRISC1 00000001 TRISC2 00000002 TRISC3 00000003 TRISC4 00000004 TRISC5 00000005 TRISC6 00000006 TRISC7 00000007 TRMT 00000001 TUN0 00000000 TUN1 00000001 TUN2 00000002 TUN3 00000003 TUN4 00000004 TX 00000006 TX9 00000006 TX9D 00000000 TXEN 00000005 TXIE 00000004 TXIF 00000004 TXIP 00000004 TXREG 00000FAD TXSTA 00000FAC TX_BUF_LEN 00000010 MPASM 5.35 MIDIPULSEHOLD_SIMBA3.ASM 8-12-2010 19:01:20 PAGE 35 SYMBOL TABLE LABEL VALUE TempData 00000041 TempRxData 00000042 TempTxData 00000043 Timer1 0000029E Timer10 0000030A Timer10Lsb 00000033 Timer10Msb 00000032 Timer10Out OutsC,3 Timer11 00000316 Timer1Lsb 00000021 Timer1Msb 00000020 Timer1Out OutsA,1 Timer2 000002AA Timer2Lsb 00000023 Timer2Msb 00000022 Timer2Out OutsA,3 Timer3 000002B6 Timer3ISR 0000025C Timer3Lsb 00000025 Timer3Msb 00000024 Timer3Out OutsA,5 Timer4 000002C2 Timer4Lsb 00000027 Timer4Msb 00000026 Timer4Out OutsB,6 Timer5 000002CE Timer5Lsb 00000029 Timer5Msb 00000028 Timer5Out OutsB,4 Timer6 000002DA Timer6Lsb 0000002B Timer6Msb 0000002A Timer6Out OutsB,2 Timer7 000002E6 Timer7Lsb 0000002D Timer7Msb 0000002C Timer7Out OutsB,0 Timer8 000002F2 Timer8Lsb 0000002F Timer8Msb 0000002E Timer8Out OutsC,4 Timer9 000002FE Timer9Lsb 00000031 Timer9Msb 00000030 Timer9Out OutsC,1 Timers 0000029E TmpM 0000000E TmpT 0000000F TxBufEmpty 00000001 TxBufFull 00000000 TxBuffer 0000004C TxEndPtrH 00000046 TxEndPtrL 00000047 MPASM 5.35 MIDIPULSEHOLD_SIMBA3.ASM 8-12-2010 19:01:20 PAGE 36 SYMBOL TABLE LABEL VALUE TxStartPtrH 00000044 TxStartPtrL 00000045 UA 00000001 VCFG0 00000004 VCFG1 00000005 VDIRMAG 00000007 VPP 00000003 W 00000000 WCOL 00000007 WDTCON 00000FD1 WR 00000001 WREG 00000FE8 WREG_TEMP 00000000 WREN 00000002 WRERR 00000003 WUE 00000001 Z 00000002 _BOREN_NOSLP_2L 000000FD _BOREN_OFF_2L 000000F9 _BOREN_ON_2L 000000FB _BOREN_SBORDIS_2L 000000FF _BORV_0_2L 000000E7 _BORV_1_2L 000000EF _BORV_2_2L 000000F7 _BORV_3_2L 000000FF _CCP2MX_PORTBE_3H 000000FE _CCP2MX_PORTC_3H 000000FF _CONFIG1H 00300001 _CONFIG2H 00300003 _CONFIG2L 00300002 _CONFIG3H 00300005 _CONFIG4L 00300006 _CONFIG5H 00300009 _CONFIG5L 00300008 _CONFIG6H 0030000B _CONFIG6L 0030000A _CONFIG7H 0030000D _CONFIG7L 0030000C _CP0_OFF_5L 000000FF _CP0_ON_5L 000000FE _CP1_OFF_5L 000000FF _CP1_ON_5L 000000FD _CP2_OFF_5L 000000FF _CP2_ON_5L 000000FB _CPB_OFF_5H 000000FF _CPB_ON_5H 000000BF _CPD_OFF_5H 000000FF _CPD_ON_5H 0000007F _DEBUG_OFF_4L 000000FF _DEBUG_ON_4L 0000007F _DEVID1 003FFFFE _DEVID2 003FFFFF _EBTR0_OFF_7L 000000FF MPASM 5.35 MIDIPULSEHOLD_SIMBA3.ASM 8-12-2010 19:01:20 PAGE 37 SYMBOL TABLE LABEL VALUE _EBTR0_ON_7L 000000FE _EBTR1_OFF_7L 000000FF _EBTR1_ON_7L 000000FD _EBTR2_OFF_7L 000000FF _EBTR2_ON_7L 000000FB _EBTRB_OFF_7H 000000FF _EBTRB_ON_7H 000000BF _FCMEN_OFF_1H 000000BF _FCMEN_ON_1H 000000FF _IDLOC0 00200000 _IDLOC1 00200001 _IDLOC2 00200002 _IDLOC3 00200003 _IDLOC4 00200004 _IDLOC5 00200005 _IDLOC6 00200006 _IDLOC7 00200007 _IESO_OFF_1H 0000007F _IESO_ON_1H 000000FF _LPT1OSC_OFF_3H 000000FB _LPT1OSC_ON_3H 000000FF _LVP_OFF_4L 000000FB _LVP_ON_4L 000000FF _MCLRE_OFF_3H 0000007F _MCLRE_ON_3H 000000FF _OSC_ECIO6_1H 000000F5 _OSC_EC_1H 000000F4 _OSC_HSPLL_1H 000000F6 _OSC_HS_1H 000000F2 _OSC_INTIO67_1H 000000F8 _OSC_INTIO7_1H 000000F9 _OSC_LP_1H 000000F0 _OSC_RCIO6_1H 000000F7 _OSC_RC_1H 000000F3 _OSC_XT_1H 000000F1 _PBADEN_OFF_3H 000000FD _PBADEN_ON_3H 000000FF _PWRT_OFF_2L 000000FF _PWRT_ON_2L 000000FE _STVREN_OFF_4L 000000FE _STVREN_ON_4L 000000FF _WDTPS_1024_2H 000000F5 _WDTPS_128_2H 000000EF _WDTPS_16384_2H 000000FD _WDTPS_16_2H 000000E9 _WDTPS_1_2H 000000E1 _WDTPS_2048_2H 000000F7 _WDTPS_256_2H 000000F1 _WDTPS_2_2H 000000E3 _WDTPS_32768_2H 000000FF _WDTPS_32_2H 000000EB _WDTPS_4096_2H 000000F9 _WDTPS_4_2H 000000E5 MPASM 5.35 MIDIPULSEHOLD_SIMBA3.ASM 8-12-2010 19:01:20 PAGE 38 SYMBOL TABLE LABEL VALUE _WDTPS_512_2H 000000F3 _WDTPS_64_2H 000000ED _WDTPS_8192_2H 000000FB _WDTPS_8_2H 000000E7 _WDT_OFF_2H 000000FE _WDT_ON_2H 000000FF _WRT0_OFF_6L 000000FF _WRT0_ON_6L 000000FE _WRT1_OFF_6L 000000FF _WRT1_ON_6L 000000FD _WRT2_OFF_6L 000000FF _WRT2_ON_6L 000000FB _WRTB_OFF_6H 000000FF _WRTB_ON_6H 000000BF _WRTC_OFF_6H 000000FF _WRTC_ON_6H 000000DF _WRTD_OFF_6H 000000FF _WRTD_ON_6H 0000007F _XINST_OFF_4L 000000BF _XINST_ON_4L 000000FF __18F452 00000001 _ch1 0000054C _ch10 00000570 _ch2 00000550 _ch3 00000554 _ch4 00000558 _ch5 0000055C _ch6 00000560 _ch7 00000564 _ch8 00000568 _ch9 0000056C _sh1 0000057C _sh10 000005A0 _sh2 00000580 _sh3 00000584 _sh4 00000588 _sh5 0000058C _sh6 00000590 _sh7 00000594 _sh8 00000598 _sh9 0000059C _sp1 000005AC _sp10 000005D0 _sp2 000005B0 _sp3 000005B4 _sp4 000005B8 _sp5 000005BC _sp6 000005C0 _sp7 000005C4 _sp8 000005C8 _sp9 000005CC _sph1 00000508 _sph10 0000053E MPASM 5.35 MIDIPULSEHOLD_SIMBA3.ASM 8-12-2010 19:01:20 PAGE 39 SYMBOL TABLE LABEL VALUE _sph2 0000050E _sph3 00000514 _sph4 0000051A _sph5 00000520 _sph6 00000526 _sph7 0000052C _sph8 00000532 _sph9 00000538 MEMORY USAGE MAP ('X' = Used, '-' = Unused) 0000 : XX------XX------ --------XXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX 0040 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX 0080 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX 00C0 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX 0100 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX 0140 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX 0180 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX 01C0 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX 0200 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX 0240 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX 0280 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX 02C0 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX 0300 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX 0340 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX 0380 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX 03C0 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XX-------------- ---------------- 0500 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX 0540 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX 0580 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX 05C0 : XXXXXXXXXXXXXXXX XXXX------------ ---------------- ---------------- All other memory blocks unused. Program Memory Bytes Used: 1186 Program Memory Bytes Free: 31582 Errors : 16 Warnings : 12 reported, 0 suppressed Messages : 1 reported, 0 suppressed