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

📄 common.lis

📁 AVRmega28L的串口发送数据程序
💻 LIS
📖 第 1 页 / 共 2 页
字号:
                        .module common.c
                        .area text(rom, con, rel)
 0000                   .dbfile F:\我的BACK\淘宝\128开发板\程序\128L_USART1\common.c
 0000                   .dbfunc e port_init _port_init fV
                        .even
 0000           _port_init::
 0000                   .dbline -1
 0000                   .dbline 7
 0000           ; 
 0000           ; #include <iom128v.h>
 0000           ; #include <macros.h>
 0000           ; #include "config.h"
 0000           ; 
 0000           ; void port_init(void)
 0000           ; {
 0000                   .dbline 8
 0000           ;  PORTA = 0x00;
 0000 2224              clr R2
 0002 2BBA              out 0x1b,R2
 0004                   .dbline 9
 0004           ;  DDRA  = 0x00;
 0004 2ABA              out 0x1a,R2
 0006                   .dbline 10
 0006           ;  PORTB = 0x80;
 0006 80E8              ldi R24,128
 0008 88BB              out 0x18,R24
 000A                   .dbline 11
 000A           ;  DDRB  = 0x80;
 000A 87BB              out 0x17,R24
 000C                   .dbline 12
 000C           ;  PORTC = 0x00; //m103 output only
 000C 25BA              out 0x15,R2
 000E                   .dbline 13
 000E           ;  DDRC  = 0x00;
 000E 24BA              out 0x14,R2
 0010                   .dbline 14
 0010           ;  PORTD = 0x00;
 0010 22BA              out 0x12,R2
 0012                   .dbline 15
 0012           ;  DDRD  = 0x00;
 0012 21BA              out 0x11,R2
 0014                   .dbline 16
 0014           ;  PORTE = 0x00;
 0014 23B8              out 0x3,R2
 0016                   .dbline 17
 0016           ;  DDRE  = 0x00;
 0016 22B8              out 0x2,R2
 0018                   .dbline 18
 0018           ;  PORTF = 0x00;
 0018 20926200          sts 98,R2
 001C                   .dbline 19
 001C           ;  DDRF  = 0x00;
 001C 20926100          sts 97,R2
 0020                   .dbline 20
 0020           ;  PORTG = 0x00;
 0020 20926500          sts 101,R2
 0024                   .dbline 21
 0024           ;  DDRG  = 0x00;
 0024 20926400          sts 100,R2
 0028                   .dbline -2
 0028           L1:
 0028                   .dbline 0 ; func end
 0028 0895              ret
 002A                   .dbend
 002A                   .dbfunc e spi_init _spi_init fV
                        .even
 002A           _spi_init::
 002A                   .dbline -1
 002A                   .dbline 27
 002A           ; }
 002A           ; 
 002A           ; //SPI initialize
 002A           ; // clock rate: 1000000hz
 002A           ; void spi_init(void)
 002A           ; {
 002A                   .dbline 28
 002A           ;  SPCR = 0x50; //setup SPI
 002A 80E5              ldi R24,80
 002C 8DB9              out 0xd,R24
 002E                   .dbline 29
 002E           ;  SPSR = 0x00; //setup SPI
 002E 2224              clr R2
 0030 2EB8              out 0xe,R2
 0032                   .dbline -2
 0032           L2:
 0032                   .dbline 0 ; func end
 0032 0895              ret
 0034                   .dbend
 0034                   .dbfunc e uart0_init _uart0_init fV
                        .even
 0034           _uart0_init::
 0034                   .dbline -1
 0034                   .dbline 33
 0034           ; }
 0034           ; //1200  4M
 0034           ; void uart0_init(void)
 0034           ; {
 0034                   .dbline 34
 0034           ;  UCSR0B = 0x00; //disable while setting baud rate
 0034 2224              clr R2
 0036 2AB8              out 0xa,R2
 0038                   .dbline 35
 0038           ;  UCSR0A = 0x00;
 0038 2BB8              out 0xb,R2
 003A                   .dbline 36
 003A           ;  UCSR0C = 0x06;
 003A 86E0              ldi R24,6
 003C 80939500          sts 149,R24
 0040                   .dbline 37
 0040           ;  UBRR0L = 0xCF; //set baud rate lo
 0040 8FEC              ldi R24,207
 0042 89B9              out 0x9,R24
 0044                   .dbline 38
 0044           ;  UBRR0H = 0x00; //set baud rate hi
 0044 20929000          sts 144,R2
 0048                   .dbline 39
 0048           ;  UCSR0B = 0x18;
 0048 88E1              ldi R24,24
 004A 8AB9              out 0xa,R24
 004C                   .dbline -2
 004C           L3:
 004C                   .dbline 0 ; func end
 004C 0895              ret
 004E                   .dbend
 004E                   .dbfunc e uart1_init _uart1_init fV
                        .even
 004E           _uart1_init::
 004E                   .dbline -1
 004E                   .dbline 48
 004E           ; }
 004E           ; 
 004E           ; //UART1 initialize
 004E           ; // desired baud rate:2400
 004E           ; // actual baud rate:2404 (0.2%)
 004E           ; // char size: 8 bit
 004E           ; // parity: Disabled
 004E           ; void uart1_init(void)
 004E           ; {
 004E                   .dbline 49
 004E           ;  UCSR1B = 0x00; //disable while setting baud rate
 004E 2224              clr R2
 0050 20929A00          sts 154,R2
 0054                   .dbline 50
 0054           ;  UCSR1A = 0x00;
 0054 20929B00          sts 155,R2
 0058                   .dbline 51
 0058           ;  UCSR1C = 0x06;
 0058 86E0              ldi R24,6
 005A 80939D00          sts 157,R24
 005E                   .dbline 52
 005E           ;  UBRR1L = 0x67; //set baud rate lo
 005E 87E6              ldi R24,103
 0060 80939900          sts 153,R24
 0064                   .dbline 53
 0064           ;  UBRR1H = 0x00; //set baud rate hi
 0064 20929800          sts 152,R2
 0068                   .dbline 54
 0068           ;  UCSR1B = 0x18;
 0068 88E1              ldi R24,24
 006A 80939A00          sts 154,R24
 006E                   .dbline -2
 006E           L4:
 006E                   .dbline 0 ; func end
 006E 0895              ret
 0070                   .dbend
 0070                   .dbfunc e init_devices _init_devices fV
                        .even
 0070           _init_devices::
 0070                   .dbline -1
 0070                   .dbline 59
 0070           ; }
 0070           ; 
 0070           ; //call this routine to initialize all peripherals
 0070           ; void init_devices(void)
 0070           ; {
 0070                   .dbline 61
 0070           ;  //stop errant interrupts until set up
 0070           ;  CLI(); //disable all interrupts
 0070 F894              cli
 0072                   .dbline 62
 0072           ;  XDIV  = 0x00; //xtal divider
 0072 2224              clr R2
 0074 2CBE              out 0x3c,R2
 0076                   .dbline 63
 0076           ;  XMCRA = 0x00; //external memory
 0076 20926D00          sts 109,R2
 007A                   .dbline 64
 007A           ;  port_init();
 007A C2DF              xcall _port_init
 007C                   .dbline 65
 007C           ;  spi_init();
 007C D6DF              xcall _spi_init
 007E                   .dbline 66
 007E           ;  uart0_init();
 007E DADF              xcall _uart0_init
 0080                   .dbline 67
 0080           ;  uart1_init();
 0080 E6DF              xcall _uart1_init
 0082                   .dbline 69
 0082           ; 
 0082           ;  MCUCR = 0x00;
 0082 2224              clr R2
 0084 25BE              out 0x35,R2
 0086                   .dbline 70
 0086           ;  EICRA = 0x00; //extended ext ints
 0086 20926A00          sts 106,R2
 008A                   .dbline 71
 008A           ;  EICRB = 0x00; //extended ext ints
 008A 2ABE              out 0x3a,R2
 008C                   .dbline 72
 008C           ;  EIMSK = 0x00;
 008C 29BE              out 0x39,R2
 008E                   .dbline 73
 008E           ;  TIMSK = 0x00; //timer interrupt sources
 008E 27BE              out 0x37,R2
 0090                   .dbline 74
 0090           ;  ETIMSK = 0x00; //extended timer interrupt sources
 0090 20927D00          sts 125,R2
 0094                   .dbline 75
 0094           ;  SEI(); //re-enable interrupts
 0094 7894              sei
 0096                   .dbline -2
 0096           L5:
 0096                   .dbline 0 ; func end
 0096 0895              ret
 0098                   .dbend
 0098                   .dbfunc e delay _delay fV
 0098           ;              i -> R20,R21
 0098           ;              j -> R22,R23
 0098           ;              t -> R16,R17
                        .even
 0098           _delay::
 0098 0E940000          xcall push_gset2
 009C                   .dbline -1
 009C                   .dbline 90
 009C           ;  //all peripherals are now initialized

⌨️ 快捷键说明

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