📄 sercom.lst
字号:
MPASM 03.70.01 Released SERCOM.ASM 2-16-2006 19:56:01 PAGE 1
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
00001 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
00002 ;
00003 ; SERCOM.ASM Version 1.0 10-9-05 MPB
00004 ;...............................................................
00005 ;
00006 ; Test RS232 communications using the
00007 ; USART Asynchronous Transmit and Receive
00008 ;
00009 ; The Proteus Virtual Terminal allows ASCII characters
00010 ; to be displayed, and generated from the computer keys.
00011 ; The program outputs a fixed message to the display
00012 ; from a table, and then displays numbers input from the
00013 ; terminal on a BCD 7-segment LED display.
00014 ;
00015 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
00016
00017 PROCESSOR 16F877 ; define MPU
2007 3731 00018 __CONFIG 0x3731 ; XT clock (4MHz)
00019
00020 ; LABEL EQUATES ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
00021
00022 INCLUDE "P16F877A.INC" ; Standard register labels
00001 LIST
00002 ; P16F877A.INC Standard Header File, Version 1.00 Microchip Technology, Inc.
Message[301]: MESSAGE: (Processor-header file mismatch. Verify selected processor.)
00398 LIST
00023
Warning[207]: Found label after column 1. (Point)
00000020 00024 Point EQU 020
Warning[207]: Found label after column 1. (Inchar)
00000021 00025 Inchar EQU 021
00026
00027 ; Initialise ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
00028
0000 00029 ORG 0 ; Place machine code
0000 0000 00030 NOP ; Required for ICD mode
00031
0001 1683 1303 00032 BANKSEL TRISD ; Select bank 1
Message[302]: Register in operand not in bank 0. Ensure that bank bits are correct.
0003 0188 00033 CLRF TRISD ; Display outputs
Message[302]: Register in operand not in bank 0. Ensure that bank bits are correct.
0004 1318 00034 BCF TXSTA,TX9 ; Select 8-bit transmission
Message[302]: Register in operand not in bank 0. Ensure that bank bits are correct.
0005 1298 00035 BCF TXSTA,TXEN ; Disable transmission initially
Message[302]: Register in operand not in bank 0. Ensure that bank bits are correct.
0006 1218 00036 BCF TXSTA,SYNC ; Asynchronous mode
Message[302]: Register in operand not in bank 0. Ensure that bank bits are correct.
0007 1518 00037 BSF TXSTA,BRGH ; High baud rate
00038
0008 3019 00039 MOVLW D'25' ; Baud rate counter value ..
Message[302]: Register in operand not in bank 0. Ensure that bank bits are correct.
0009 0099 00040 MOVWF SPBRG ; .. for 9600 baud, 4MHz clock
Message[302]: Register in operand not in bank 0. Ensure that bank bits are correct.
MPASM 03.70.01 Released SERCOM.ASM 2-16-2006 19:56:01 PAGE 2
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
000A 1698 00041 BSF TXSTA,TXEN ; Enable transmission
00042
000B 1283 1303 00043 BANKSEL RCSTA ; Select bank 0
000D 1798 00044 BSF RCSTA,SPEN ; Enable serial port
00045
00046
00047 ; MAIN LOOP ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
00048
000E 2011 00049 CALL write ; Display message on terminal
000F 201B 00050 readin CALL read ; Get number input from terminal
0010 280F 00051 GOTO readin ; Keep reading until reset
00052
00053 ; SUBROUTINES ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
00054
00055 ; Write message to terminal......................................
00056
0011 01A0 00057 write CLRF Point ; Table pointer = 0
0012 0820 00058 next MOVF Point,W ; Load table pointer
0013 2028 00059 CALL mestab ; Get character
0014 2024 00060 CALL sencom ; Output to terminal
Message[305]: Using default destination of 1 (file).
0015 0AA0 00061 INCF Point ; Point to next
0016 300E 00062 MOVLW D'14' ; Number of characters + 1
0017 0220 00063 SUBWF Point,W ; Check pointer
0018 1D03 00064 BTFSS STATUS,Z ; Last character done?
0019 2812 00065 GOTO next ; No - next
001A 0008 00066 RETURN ; All done
00067
00068
00069 ; Read input numbers from terminal...............................
00070
001B 1618 00071 read BSF RCSTA,CREN ; Enable reception
001C 1E8C 00072 waitin BTFSS PIR1,RCIF ; Character received?
001D 281C 00073 GOTO waitin ; no - wait
00074
001E 081A 00075 MOVF RCREG,W ; get input character
001F 00A1 00076 MOVWF Inchar ; store input character
0020 3030 00077 MOVLW 030 ; ASCII number offset
0021 0221 00078 SUBWF Inchar,W ; Calculate number
0022 0088 00079 MOVWF PORTD ; display it
0023 0008 00080 RETURN ; done
00081
00082
00083 ; Transmit a character ..........................................
00084
0024 0099 00085 sencom MOVWF TXREG ; load transmit register
0025 1E0C 00086 waitot BTFSS PIR1,TXIF ; sent?
0026 2825 00087 GOTO waitot ; no
0027 0008 00088 RETURN ; yes
00089
00090
00091 ; Table of message characters....................................
00092
MPASM 03.70.01 Released SERCOM.ASM 2-16-2006 19:56:01 PAGE 3
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
Message[305]: Using default destination of 1 (file).
0028 0782 00093 mestab ADDWF PCL ; Modify program counter
0029 3445 00094 RETLW 'E' ; Point = 0
002A 344E 00095 RETLW 'N' ; Point = 1
002B 3454 00096 RETLW 'T' ; Point = 2
002C 3445 00097 RETLW 'E' ; Point = 3
002D 3452 00098 RETLW 'R' ; Point = 4
002E 3420 00099 RETLW ' ' ; Point = 5
002F 344E 00100 RETLW 'N' ; Point = 6
0030 3455 00101 RETLW 'U' ; Point = 7
0031 344D 00102 RETLW 'M'; ; Point = 8
0032 3442 00103 RETLW 'B' ; Point = 9
0033 3445 00104 RETLW 'E' ; Point = 10
0034 3452 00105 RETLW 'R' ; Point = 11
0035 343A 00106 RETLW ':' ; Point = 12
0036 3420 00107 RETLW ' ' ; Point = 13
00108
00109
00110 END ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
MPASM 03.70.01 Released SERCOM.ASM 2-16-2006 19:56:01 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.70.01 Released SERCOM.ASM 2-16-2006 19:56:01 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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -