MPASM 03.90.01 Released RS232.ASM 8-27-2005 16:45:13 PAGE 1 LOC OBJECT CODE LINE SOURCE TEXT VALUE 00001 00002 list p=16f876A ; list directive to define processor 00003 #include ; processor specific variable definitions 00001 LIST 00002 ; P16F876A.INC Standard Header File, Version 1.00 Microchip Technology, Inc. 00380 LIST 00004 2007 3F32 00005 __CONFIG _CP_OFF & _WDT_OFF & _BODEN_OFF & _PWRTE_ON & _HS_OSC & _WRT_OFF & _LVP_OFF & _CPD_OFF 00006 00007 ; '__CONFIG' directive is used to embed configuration data within .asm file. 00008 ; The lables following the directive are located in the respective .inc file. 00009 ; See respective data sheet for additional information on configuration word. 00010 00011 00012 ;***** VARIABLE DEFINITIONS 00000071 00013 w_temp EQU 0x71 ; variable used for context saving 00000072 00014 status_temp EQU 0x72 ; variable used for context saving 00000073 00015 pclath_temp EQU 0x73 ; variable used for context saving 00016 00000074 00017 indications EQU 0x74 00018 00019 00020 ;********************************************************************** 0000 00021 ORG 0x000 ; processor reset vector 0000 0000 00022 nop ; nop required for icd 0001 281A 00023 goto main ; go to beginning of program 00024 00025 0004 00026 ORG 0x004 ; interrupt vector location 0004 00027 int 0004 00F1 00028 movwf w_temp ; save off current W register contents 0005 0803 00029 movf STATUS,w ; move status register into W register 0006 00F2 00030 movwf status_temp ; save off contents of STATUS register 0007 080A 00031 movf PCLATH,w ; move pclath register into w register 0008 00F3 00032 movwf pclath_temp ; save off contents of PCLATH register 00033 00034 ; isr code can go here or be located as a call subroutine elsewhere 00035 00036 ;RS232-Empfaenger-Interupt? 0009 1E8C 00037 btfss PIR1, RCIF 000A 2813 00038 goto intEnde ; Interrupt came of where differently 000B 081A 00039 movfw RCREG ; RS232-Register select 000C 00F4 00040 movwf indications ; and into the memory after 'indications' write 000D 00041 write 000D 0086 00042 movwf PORTB ; Indications at the PortB indicate 000E 128C 00043 bcf PIR1, RCIF ; interrupt flag delete 00044 Warning[207]: Found label after column 1. (RS232out) 000F 00045 RS232out 000F 1E0C 00046 btfss PIR1, TXIF ; is transmitter empty? 0010 280F 00047 goto RS232out ; no, not yet empty 0011 0874 00048 movfw indications ; next byte get 0012 0099 00049 movwf TXREG ; and into the RS232-Sender write MPASM 03.90.01 Released RS232.ASM 8-27-2005 16:45:13 PAGE 2 LOC OBJECT CODE LINE SOURCE TEXT VALUE 00050 0013 00051 intEnde 0013 0873 00052 movf pclath_temp,w ; retrieve copy of PCLATH register 0014 008A 00053 movwf PCLATH ; restore pre-isr PCLATH register contents 0015 0872 00054 movf status_temp,w ; retrieve copy of STATUS register 0016 0083 00055 movwf STATUS ; restore pre-isr STATUS register contents 0017 0EF1 00056 swapf w_temp,f 0018 0E71 00057 swapf w_temp,w ; restore pre-isr W register contents 0019 0009 00058 retfie ; return from interrupt 00059 00060 001A 00061 main 00062 00063 ; remaining code goes here 001A 1283 00064 bcf STATUS, RP0 001B 1303 00065 bcf STATUS, RP1 001C 0186 00066 clrf PORTB 001D 0185 00067 clrf PORTA 001E 1683 00068 bsf STATUS,RP0 001F 3000 00069 movlw 0x00 Message[302]: Register in operand not in bank 0. Ensure that bank bits are correct. 0020 0085 00070 movwf TRISA Message[302]: Register in operand not in bank 0. Ensure that bank bits are correct. 0021 0086 00071 movwf TRISB 00072 0022 2032 00073 call USART_initialize 0023 2039 00074 call USART_Baud_rate_adjust 0024 202A 00075 CALL prepare_Interrupts 00076 0025 1283 00077 bcf STATUS,RP0 0026 30FF 00078 movlw 0xff 0027 0085 00079 movwf PORTA 00080 0028 00081 loop 0028 0000 00082 NOP 0029 2828 00083 goto loop 00084 00085 002A 00086 prepare_Interrupts ;Interrupts 002A 1683 00087 BSF STATUS, RP0 ; Bank1 Message[302]: Register in operand not in bank 0. Ensure that bank bits are correct. 002B 168C 00088 BSF PIE1, RCIE ; Enable receive interrupts 002C 1283 00089 BCF STATUS, RP0 ; Bank 0 002D 018C 00090 clrf PIR1 ; all interrupt flags delete 002E 018D 00091 clrf PIR2 002F 178B 00092 BSF INTCON, GIE ; generally permit interrupts 0030 170B 00093 BSF INTCON, PEIE ; Interrupts of peripheral devices permit 0031 0008 00094 RETURN 00095 0032 00096 USART_initialize 0032 1683 00097 BSF STATUS, RP0 ; Bank1 0033 3024 00098 MOVLW 0x24 ; Transmitter:RS232 , BRGH bit is set Message[302]: Register in operand not in bank 0. Ensure that bank bits are correct. MPASM 03.90.01 Released RS232.ASM 8-27-2005 16:45:13 PAGE 3 LOC OBJECT CODE LINE SOURCE TEXT VALUE 0034 0098 00099 MOVWF TXSTA ; 0035 1283 00100 BCF STATUS, RP0 ; Bank 0 0036 3090 00101 MOVLW 0x90 ; Enable serial port, 8bit reception , 0037 0098 00102 MOVWF RCSTA ; continuous receive 0038 0008 00103 RETURN 00104 0039 00105 USART_Baud_rate_adjust 0039 1683 00106 BSF STATUS, RP0 ; Bank1 003A 3081 00107 MOVLW 0x81 ; Set Baud guesses 9,6 KB with Fosc=20MHz Message[302]: Register in operand not in bank 0. Ensure that bank bits are correct. 003B 0099 00108 MOVWF SPBRG 003C 0008 00109 RETURN 00110 00111 END ; directive 'end of program' MPASM 03.90.01 Released RS232.ASM 8-27-2005 16:45:13 PAGE 4 SYMBOL TABLE LABEL VALUE ACKDT 00000005 ACKEN 00000004 ACKSTAT 00000006 ADCON0 0000001F ADCON1 0000009F ADCS0 00000006 ADCS1 00000007 ADDEN 00000003 ADFM 00000007 ADIE 00000006 ADIF 00000006 ADON 00000000 ADRESH 0000001E ADRESL 0000009E BCLIE 00000003 BCLIF 00000003 BF 00000000 BRGH 00000002 C 00000000 C1INV 00000004 C1OUT 00000006 C2INV 00000005 C2OUT 00000007 CCP1CON 00000017 CCP1IE 00000002 CCP1IF 00000002 CCP1M0 00000000 CCP1M1 00000001 CCP1M2 00000002 CCP1M3 00000003 CCP1X 00000005 CCP1Y 00000004 CCP2CON 0000001D CCP2IE 00000000 CCP2IF 00000000 CCP2M0 00000000 CCP2M1 00000001 CCP2M2 00000002 CCP2M3 00000003 CCP2X 00000005 CCP2Y 00000004 CCPR1H 00000016 CCPR1L 00000015 CCPR2H 0000001C CCPR2L 0000001B CHS0 00000003 CHS1 00000004 CHS2 00000005 CIS 00000003 CKE 00000006 CKP 00000004 CM0 00000000 CM1 00000001 MPASM 03.90.01 Released RS232.ASM 8-27-2005 16:45:13 PAGE 5 SYMBOL TABLE LABEL VALUE CM2 00000002 CMCON 0000009C CMIE 00000006 CMIF 00000006 CREN 00000004 CSRC 00000007 CVR0 00000000 CVR1 00000001 CVR2 00000002 CVR3 00000003 CVRCON 0000009D CVREN 00000007 CVROE 00000006 CVRR 00000005 D 00000005 DATA_ADDRESS 00000005 DC 00000001 D_A 00000005 EEADR 0000010D EEADRH 0000010F EECON1 0000018C EECON2 0000018D EEDATA 0000010C EEDATH 0000010E EEIE 00000004 EEIF 00000004 EEPGD 00000007 F 00000001 FERR 00000002 FSR 00000004 GCEN 00000007 GIE 00000007 GO 00000002 GO_DONE 00000002 I2C_DATA 00000005 I2C_READ 00000002 I2C_START 00000003 I2C_STOP 00000004 INDF 00000000 INTCON 0000000B INTE 00000004 INTEDG 00000006 INTF 00000001 IRP 00000007 NOT_A 00000005 NOT_ADDRESS 00000005 NOT_BO 00000000 NOT_BOR 00000000 NOT_DONE 00000002 NOT_PD 00000003 NOT_POR 00000001 NOT_RBPU 00000007 NOT_RC8 00000006 MPASM 03.90.01 Released RS232.ASM 8-27-2005 16:45:13 PAGE 6 SYMBOL TABLE LABEL VALUE NOT_T1SYNC 00000002 NOT_TO 00000004 NOT_TX8 00000006 NOT_W 00000002 NOT_WRITE 00000002 OERR 00000001 OPTION_REG 00000081 P 00000004 PCFG0 00000000 PCFG1 00000001 PCFG2 00000002 PCFG3 00000003 PCL 00000002 PCLATH 0000000A PCON 0000008E PEIE 00000006 PEN 00000002 PIE1 0000008C PIE2 0000008D PIR1 0000000C PIR2 0000000D PORTA 00000005 PORTB 00000006 PORTC 00000007 PR2 00000092 PS0 00000000 PS1 00000001 PS2 00000002 PSA 00000003 R 00000002 RBIE 00000003 RBIF 00000000 RC8_9 00000006 RC9 00000006 RCD8 00000000 RCEN 00000003 RCIE 00000005 RCIF 00000005 RCREG 0000001A RCSTA 00000018 RD 00000000 READ_WRITE 00000002 RP0 00000005 RP1 00000006 RS232out 0000000F RSEN 00000001 RX9 00000006 RX9D 00000000 R_W 00000002 S 00000003 SEN 00000000 SMP 00000007 SPBRG 00000099 MPASM 03.90.01 Released RS232.ASM 8-27-2005 16:45:13 PAGE 7 SYMBOL TABLE LABEL VALUE SPEN 00000007 SREN 00000005 SSPADD 00000093 SSPBUF 00000013 SSPCON 00000014 SSPCON2 00000091 SSPEN 00000005 SSPIE 00000003 SSPIF 00000003 SSPM0 00000000 SSPM1 00000001 SSPM2 00000002 SSPM3 00000003 SSPOV 00000006 SSPSTAT 00000094 STATUS 00000003 SYNC 00000004 T0CS 00000005 T0IE 00000005 T0IF 00000002 T0SE 00000004 T1CKPS0 00000004 T1CKPS1 00000005 T1CON 00000010 T1INSYNC 00000002 T1OSCEN 00000003 T1SYNC 00000002 T2CKPS0 00000000 T2CKPS1 00000001 T2CON 00000012 TMR0 00000001 TMR1CS 00000001 TMR1H 0000000F TMR1IE 00000000 TMR1IF 00000000 TMR1L 0000000E TMR1ON 00000000 TMR2 00000011 TMR2IE 00000001 TMR2IF 00000001 TMR2ON 00000002 TOUTPS0 00000003 TOUTPS1 00000004 TOUTPS2 00000005 TOUTPS3 00000006 TRISA 00000085 TRISB 00000086 TRISC 00000087 TRMT 00000001 TX8_9 00000006 TX9 00000006 TX9D 00000000 TXD8 00000000 MPASM 03.90.01 Released RS232.ASM 8-27-2005 16:45:13 PAGE 8 SYMBOL TABLE LABEL VALUE TXEN 00000005 TXIE 00000004 TXIF 00000004 TXREG 00000019 TXSTA 00000098 UA 00000001 USART_Baud_rate_adjust 00000039 USART_initialize 00000032 W 00000000 WCOL 00000007 WR 00000001 WREN 00000002 WRERR 00000003 Z 00000002 _BODEN_OFF 00003FBF _BODEN_ON 00003FFF _CPD_OFF 00003FFF _CPD_ON 00003EFF _CP_ALL 00001FFF _CP_OFF 00003FFF _DEBUG_OFF 00003FFF _DEBUG_ON 000037FF _HS_OSC 00003FFE _LP_OSC 00003FFC _LVP_OFF 00003F7F _LVP_ON 00003FFF _PWRTE_OFF 00003FFF _PWRTE_ON 00003FF7 _RC_OSC 00003FFF _WDT_OFF 00003FFB _WDT_ON 00003FFF _WRT_1FOURTH 00003BFF _WRT_256 00003DFF _WRT_HALF 000039FF _WRT_OFF 00003FFF _XT_OSC 00003FFD __16F876A 00000001 indications 00000074 int 00000004 intEnde 00000013 loop 00000028 main 0000001A pclath_temp 00000073 prepare_Interrupts 0000002A status_temp 00000072 w_temp 00000071 write 0000000D MPASM 03.90.01 Released RS232.ASM 8-27-2005 16:45:13 PAGE 9 MEMORY USAGE MAP ('X' = Used, '-' = Unused) 0000 : XX--XXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXX--- 2000 : -------X-------- ---------------- ---------------- ---------------- All other memory blocks unused. Program Memory Words Used: 59 Program Memory Words Free: 8133 Errors : 0 Warnings : 1 reported, 0 suppressed Messages : 5 reported, 0 suppressed