list p=18f252 ;list directive to define processor #include ;processor specific definitions ; #include ;processor specific definitions ; #define simulate 1 ; enable simulation ; #define heartbeat 1 ; enable heatbeats ;****************************************************************************** ;Configuration bits ; The __CONFIG directive defines configuration data within the .ASM file. ; The labels following the directive are defined in the P18F252.INC file. ; The PIC18FXX2 Data Sheet explains the functions of the configuration bits. ; Change the following lines to suit your application. __CONFIG _CONFIG1H, _OSCS_OFF_1H & _HSPLL_OSC_1H __CONFIG _CONFIG2L, _BOR_OFF_2L & _PWRT_OFF_2L __CONFIG _CONFIG2H, _WDT_OFF_2H __CONFIG _CONFIG3H, _CCP2MX_OFF_3H __CONFIG _CONFIG4L, _STVR_OFF_4L & _LVP_OFF_4L & _DEBUG_OFF_4L __CONFIG _CONFIG5L, _CP0_OFF_5L & _CP1_OFF_5L & _CP2_OFF_5L & _CP3_OFF_5L __CONFIG _CONFIG5H, _CPB_OFF_5H & _CPD_OFF_5H __CONFIG _CONFIG6L, _WRT0_OFF_6L & _WRT1_OFF_6L & _WRT2_OFF_6L & _WRT3_OFF_6L __CONFIG _CONFIG6H, _WRTC_OFF_6H & _WRTB_OFF_6H & _WRTD_OFF_6H __CONFIG _CONFIG7L, _EBTR0_OFF_7L & _EBTR1_OFF_7L & _EBTR2_OFF_7L & _EBTR3_OFF_7L __CONFIG _CONFIG7H, _EBTRB_OFF_7H ;---------------------------------------------------------------------------- ;Constants ;SPBRG_VAL EQU 027h ;set baud rate 31250 for 20Mhz clock SPBRG_VAL EQU 04Fh ;set baud rate 31250 for 40Mhz clock TX_BUF_LEN EQU 010h ;length of transmit circular buffer RX_BUF_LEN EQU TX_BUF_LEN ;length of receive circular buffer ;---------------------------------------------------------------------------- ;Bit Definitions TxBufFull EQU 0 ;bit indicates Tx buffer is full TxBufEmpty EQU 1 ;bit indicates Tx buffer is empty RxBufFull EQU 2 ;bit indicates Rx buffer is full RxBufEmpty EQU 3 ;bit indicates Rx buffer is empty ;ReceivedCR EQU 4 ;bit indicates character received ;---------------------------------------------------------------------------- ;Variables CBLOCK 0x000 WREG_TEMP ;to save WREG during interrupt STATUS_TEMP ;to save STATUS during interrupt BSR_TEMP ;to save BSR during interrupt FSR0H_TEMP ;to save FSR0H during interrupt FSR0L_TEMP ;to save FSR0L during interrupt FSR0H_SHADOW ;to save FSR0H during high interrupt FSR0L_SHADOW ;to save FSR0L during high interrupt MidiInByte ; Rcv'd Byte MidiByte0 ; status MidiByte1 ; data1 MidiByte2 ; data2 MidiCurData ; current data byte index MidiNumData ; expected data bytes MidiTestByte ; for testing only TmpM ; non-ISR scratch TmpT ; non-ISR scratch ; HoldOutputsA ; hold outputs OutsA ; output port A internal states OutsB ; output port B internal states OutsC ; output port C internal states ENDC CBLOCK 0x020 ; DO NOT MOVE THIS BLOCK Timer0Msb Timer0Lsb Timer1Msb Timer1Lsb Timer2Msb Timer2Lsb Timer3Msb Timer3Lsb Timer4Msb Timer4Lsb Timer5Msb Timer5Lsb Timer6Msb Timer6Lsb Timer7Msb Timer7Lsb Timer8Msb Timer8Lsb Timer9Msb Timer9Lsb Timer10Msb Timer10Lsb Timer11Msb Timer11Lsb Timer12Msb Timer12Lsb Timer13Msb Timer13Lsb Timer14Msb Timer14Lsb Timer15Msb Timer15Lsb ENDC CBLOCK 0x40 ; Flags ;byte for indicator flag bits TempData ;temporary data in main routines TempRxData ;temporary data in Rx buffer routines TempTxData ;temporary data in Tx buffer routines TxStartPtrH ;pointer to start of data in Tx buffer TxStartPtrL ;pointer to start of data in Tx buffer TxEndPtrH ;pointer to end of data in Tx buffer TxEndPtrL ;pointer to end of data in Tx buffer RxStartPtrH ;pointer to start of data in Rx buffer RxStartPtrL ;pointer to start of data in Rx buffer RxEndPtrH ;pointer to end of data in Rx buffer RxEndPtrL ;pointer to end of data in Rx buffer TxBuffer:TX_BUF_LEN ;Tx buffer for data to transmit RxBuffer:RX_BUF_LEN ;Rx buffer for received data ENDC ; CBLOCK 0xF0 ; DO NOT MOVE THIS BLOCK CmdBuff0RdIndx equ 0DEh CmdBuff0WrIndx equ 0DFh CmdBuff0Timer equ 0E0h CmdBuff0TimerValMSB equ 0E1h CmdBuff0TimerValLSB equ 0E2h CmdBuff0PinMaskA equ 0E3h CmdBuff0PinMaskB equ 0E4h CmdBuff0PinMaskC equ 0E5h CmdBuff1Timer equ 0E8h CmdBuff1TimerValMSB equ 0E9h CmdBuff1TimerValLSB equ 0EAh CmdBuff1PinMaskA equ 0EBh CmdBuff1PinMaskB equ 0ECh CmdBuff1PinMaskC equ 0EDh CmdBuff2Timer equ 0F0h CmdBuff2TimerValMSB equ 0F1h CmdBuff2TimerValLSB equ 0F2h CmdBuff2PinMaskA equ 0F3h CmdBuff2PinMaskB equ 0F4h CmdBuff2PinMaskC equ 0F5h CmdBuff3Timer equ 0F8h CmdBuff3TimerValMSB equ 0F9h CmdBuff3TimerValLSB equ 0FAh CmdBuff3PinMaskA equ 0FBh CmdBuff3PinMaskB equ 0FCh CmdBuff3PinMaskC equ 0FDh ; ... and incrementing this last adress wraps it to zero. ; don't change this property! ; ENDC