📄 spi.lst
字号:
MPASM 5.1 SPI.ASM 5-5-2007 20:23:30 PAGE 1
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
00001 ;单片机与外围器件之间串行通信
00002 ;单片机运用片上的SPI模块进行移位输出,实现单片机和外围器件串行通信的方法。
00003 ;本实验中选择了两个移位寄存器作为外围器件分别进行输入
00004 ;即74LS164(8位的串行输入/并串行输出移位寄存器)
00005 ; 74LS166(8位串(并)行输入/串行输出移位寄存器)
00006 ;
00007 ;SPI的基本原理:
00008 ;SPI由4个信号构成:MISO(主设备输入,从设备输出),MOSI(主设备输出,从设备输入)
00009 ;SCK(串行数据流输入/输出的移位时钟),SS:从设备使能信号。
00010 ;SPI常用的模式是:主控模式和从动模式。
00011 ;SPI方式允许8位数据同时同步发送和接收,为完成通信功能,在PIC单片机中需要3条信号线。
00012 ;典型的3个引脚是:SDO(串行数据输出),SDI(串行数据输入),SCK(串行时钟)
00013 ;掌握SPI工作方式的初始化。
00014 ;(该模块的主要寄存器:SSPCON(同步串口控制寄存器),SSPSTAT(同步串行接口状态寄存器))
00015
00016
00000003 00017 STATUS EQU 03H
00000006 00018 PORTB EQU 06H
00000007 00019 PORTC EQU 07H
00020
00000013 00021 SSPBUF EQU 13H
00000014 00022 SSPCON EQU 14H
00000086 00023 TRISB EQU 86H
00000087 00024 TRISC EQU 87H
00025
00000094 00026 SSPSTAT EQU 94H
0000000C 00027 PIR1 EQU 0CH
00000006 00028 RP1 EQU 06H
00000005 00029 RP0 EQU 05H
00000020 00030 DATA1 EQU 20H
00000021 00031 DATA2 EQU 21H
00000023 00032 TEMP1 EQU 23H
00000024 00033 TEMP2 EQU 24H
00000082 00034 COUNT1 EQU 82H
000000FF 00035 COUNT2 EQU 0FFH
00036
Warning[205]: Found directive in column 1. (ORG)
0000 00037 ORG 00H
Warning[203]: Found opcode in column 1. (NOP)
0000 0000 00038 NOP
Warning[203]: Found opcode in column 1. (GOTO)
0001 2802 00039 GOTO MAIN
00040
0002 00041 MAIN
Warning[203]: Found opcode in column 1. (CALL)
0002 2019 00042 CALL INITIAL
0003 00043 LOOP
Warning[203]: Found opcode in column 1. (CALL)
0003 2040 00044 CALL OUT166
Warning[203]: Found opcode in column 1. (CALL)
0004 2053 00045 CALL DELAY
Warning[203]: Found opcode in column 1. (CALL)
0005 2053 00046 CALL DELAY
MPASM 5.1 SPI.ASM 5-5-2007 20:23:30 PAGE 2
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
Warning[203]: Found opcode in column 1. (CALL)
0006 2040 00047 CALL OUT166
Warning[203]: Found opcode in column 1. (CALL)
0007 2053 00048 CALL DELAY
Warning[203]: Found opcode in column 1. (CALL)
0008 2053 00049 CALL DELAY
Warning[203]: Found opcode in column 1. (CALL)
0009 2053 00050 CALL DELAY
Warning[203]: Found opcode in column 1. (CALL)
000A 2053 00051 CALL DELAY
Warning[203]: Found opcode in column 1. (CALL)
000B 2053 00052 CALL DELAY
Warning[203]: Found opcode in column 1. (CALL)
000C 2053 00053 CALL DELAY
Warning[203]: Found opcode in column 1. (CALL)
000D 2053 00054 CALL DELAY
Warning[203]: Found opcode in column 1. (CALL)
000E 2053 00055 CALL DELAY
Warning[203]: Found opcode in column 1. (CALL)
000F 202E 00056 CALL OUT164
Warning[203]: Found opcode in column 1. (CALL)
0010 2053 00057 CALL DELAY
Warning[203]: Found opcode in column 1. (CALL)
0011 2053 00058 CALL DELAY
Warning[203]: Found opcode in column 1. (CALL)
0012 2053 00059 CALL DELAY
Warning[203]: Found opcode in column 1. (CALL)
0013 2053 00060 CALL DELAY
Warning[203]: Found opcode in column 1. (CALL)
0014 2053 00061 CALL DELAY
Warning[203]: Found opcode in column 1. (CALL)
0015 2053 00062 CALL DELAY
Warning[203]: Found opcode in column 1. (CALL)
0016 2053 00063 CALL DELAY
Warning[203]: Found opcode in column 1. (CALL)
0017 2053 00064 CALL DELAY
Warning[203]: Found opcode in column 1. (GOTO)
0018 2803 00065 GOTO LOOP
00066
0019 00067 INITIAL
Warning[203]: Found opcode in column 1. (BSF)
0019 1683 00068 BSF STATUS,RP0
Warning[203]: Found opcode in column 1. (BCF)
001A 1303 00069 BCF STATUS,RP1
Warning[203]: Found opcode in column 1. (MOVLW)
001B 3000 00070 MOVLW 00H
Warning[203]: Found opcode in column 1. (MOVWF)
Message[302]: Register in operand not in bank 0. Ensure that bank bits are correct.
001C 0086 00071 MOVWF TRISB ;设置PB端口为输出。
Warning[203]: Found opcode in column 1. (MOVLW)
001D 3000 00072 MOVLW 00H
Warning[203]: Found opcode in column 1. (MOVWF)
Message[302]: Register in operand not in bank 0. Ensure that bank bits are correct.
MPASM 5.1 SPI.ASM 5-5-2007 20:23:30 PAGE 3
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
001E 0087 00073 MOVWF TRISC ;设置PC端口为输出。
00074
Warning[203]: Found opcode in column 1. (MOVLW)
001F 3080 00075 MOVLW 80H
Warning[203]: Found opcode in column 1. (MOVWF)
Message[302]: Register in operand not in bank 0. Ensure that bank bits are correct.
0020 0094 00076 MOVWF SSPSTAT ;在每位数据输出结束时刻进行输入数据采样。
00077 ;SCK上跳沿数据传送。
00078
Warning[203]: Found opcode in column 1. (BCF)
0021 1283 00079 BCF STATUS,RP0
Warning[203]: Found opcode in column 1. (BCF)
0022 1303 00080 BCF STATUS,RP1
Warning[203]: Found opcode in column 1. (MOVLW)
0023 3000 00081 MOVLW 00H
Warning[203]: Found opcode in column 1. (MOVWF)
0024 0087 00082 MOVWF PORTC
Warning[203]: Found opcode in column 1. (MOVLW)
0025 3000 00083 MOVLW 00H
Warning[203]: Found opcode in column 1. (MOVWF)
0026 0086 00084 MOVWF PORTB ;将输出控制的RB7,RB6,都置为低电平。
00085
Warning[203]: Found opcode in column 1. (MOVLW)
0027 3030 00086 MOVLW 30H
Warning[203]: Found opcode in column 1. (MOVWF)
0028 0094 00087 MOVWF SSPCON ;主控方式,使用串行口。
00088 ;时钟为f/4,空闲时时钟为高电平。
00089
00090 ;CLRF SSPBUF ;清数据BUFFER为0
00091
Warning[203]: Found opcode in column 1. (MOVLW)
0029 3001 00092 MOVLW 01H
Warning[203]: Found opcode in column 1. (MOVWF)
002A 00A3 00093 MOVWF TEMP1
Warning[203]: Found opcode in column 1. (MOVLW)
002B 30FF 00094 MOVLW 0FFH
Warning[203]: Found opcode in column 1. (MOVWF)
002C 00A4 00095 MOVWF TEMP2 ;赋值
Warning[203]: Found opcode in column 1. (RETURN)
002D 0008 00096 RETURN
00097
00098
002E 00099 OUT164
Warning[203]: Found opcode in column 1. (BSF)
002E 1683 00100 BSF STATUS,RP0
Warning[203]: Found opcode in column 1. (BCF)
002F 1303 00101 BCF STATUS,RP1
Warning[203]: Found opcode in column 1. (BCF)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -