⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 spi.lst

📁 AVR系列单片机ATMEGA64开发的LED显示屏程序 内容包括ATMEGA64大部分资源的初始化程序
💻 LST
字号:
__start:
__text_start:
    0046 E800      LDI	R16,0x80
    0047 E011      LDI	R17,1
    0048 FF10      SBRS	R17,0
    0049 6400      ORI	R16,0x40
    004A BF05      OUT	0x35,R16
    004B EFCF      LDI	R28,0xFF
    004C E1D0      LDI	R29,0x10
    004D BFCD      OUT	0x3D,R28
    004E BFDE      OUT	0x3E,R29
    004F 51C0      SUBI	R28,0x10
    0050 40D0      SBCI	R29,0
    0051 EA0A      LDI	R16,0xAA
    0052 8308      STD	Y+0,R16
    0053 2400      CLR	R0
    0054 E0E0      LDI	R30,0
    0055 E1F1      LDI	R31,0x11
    0056 E111      LDI	R17,0x11
    0057 30E0      CPI	R30,0
    0058 07F1      CPC	R31,R17
    0059 F011      BEQ	0x005C
    005A 9201      ST	R0,Z+
    005B CFFB      RJMP	0x0057
    005C 8300      STD	Z+0,R16
    005D E8EC      LDI	R30,0x8C
    005E E0F0      LDI	R31,0
    005F E0A0      LDI	R26,0
    0060 E1B1      LDI	R27,0x11
    0061 E010      LDI	R17,0
    0062 38EC      CPI	R30,0x8C
    0063 07F1      CPC	R31,R17
    0064 F021      BEQ	0x0069
    0065 95C8      LPM
    0066 9631      ADIW	R30,1
    0067 920D      ST	R0,X+
    0068 CFF9      RJMP	0x0062
    0069 D00F      RCALL	_main
    006A 0000      NOP
_exit:
    006B CFFF      RJMP	_exit
FILE: F:\dujiang\费显动态LED屏\下位机程序\spi.c
(0001) #include <iom64v.h>	// change to the appropriate header file
(0002) #include "spi.h"
(0003) 
(0004) 
(0005) 
(0006) /* spi_init function should be generated using the AppBuilder
(0007)  */
(0008) 
(0009) /*
(0010) **  SpiWriteByte() writes a byte to the SPI and waits until
(0011) **  it has been transmitted. This function doesn't
(0012) **  return any value back.
(0013) */
(0014) void SpiWriteByte(unsigned char byte)
(0015) {
(0016)     SPDR = byte;
_SpiWriteByte:
  byte                 --> R16
    006C B90F      OUT	0x0F,R16
(0017)     while (!(SPSR & 0x80));
    006D 9B77      SBIS	0x0E,7
    006E CFFE      RJMP	0x006D
(0018)     byte = SPDR;
    006F B10F      IN	R16,0x0F
    0070 9508      RET
(0019) }
(0020) 
(0021) /*
(0022) **  SpiReadByte() first writes a byte (a dummy, since
(0023) **  that byte is to generate clock signals to "poll" home
(0024) **  the byte from the slave. The function returns the
(0025) **  received byte.
(0026) */
(0027) unsigned char SpiReadByte(void)
(0028) {
(0029)     SPDR = 0x00;
_SpiReadByte:
    0071 2422      CLR	R2
    0072 B82F      OUT	0x0F,R2
(0030)     while (!(SPSR & 0x80));
    0073 9B77      SBIS	0x0E,7
    0074 CFFE      RJMP	0x0073
(0031)     return SPDR;
    0075 B10F      IN	R16,0x0F
    0076 9508      RET
(0032) }
(0033) 
(0034) /*
(0035) **  SpiReadDataReg() reads the last byte in the SPI register
(0036) **  without any clock signals generated. Could be used
(0037) **  as reading the last byte received.
(0038) */
(0039) unsigned char SpiReadDataReg(void)
(0040) {
(0041)     return SPDR;
_SpiReadDataReg:
    0077 B10F      IN	R16,0x0F
    0078 9508      RET
(0042) }
(0043) main()
(0044) {
(0045) while(1);
FILE: <library>
_main:
    0079 CFFF      RJMP	_main
    007A 9508      RET

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -