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

📄 main.lis

📁 一个关于AVR单片机的例程
💻 LIS
📖 第 1 页 / 共 3 页
字号:
 01B2 1C                .byte 28
 01B3 3C40              .byte 60,64
 01B5 3040              .byte 48,64
 01B7 3C                .byte 60
 01B8 4428              .byte 'D,40
 01BA 1028              .byte 16,40
 01BC 44                .byte 'D
 01BD 0C50              .byte 12,'P
 01BF 5050              .byte 'P,'P
 01C1 3C                .byte 60
 01C2 4464              .byte 'D,'d
 01C4 544C              .byte 'T,'L
 01C6 44                .byte 'D
 01C7                   .dbfile E:\avr\5110\lcd2\main.c
 01C7                   .dbsym s FontLookup _FontLookup A[455:91:5]kc
                        .area text(rom, con, rel)
 0000                   .dbfile E:\avr\5110\lcd2\main.c
 0000                   .dbfunc e LcdInit _LcdInit fV
                        .even
 0000           _LcdInit::
 0000                   .dbline -1
 0000                   .dbline 133
 0000           ; //ICC-AVR application builder : 2007-5-3 4:45:38
 0000           ; // Target : M16
 0000           ; // Crystal: 7.3728Mhz
 0000           ; 
 0000           ; #include <iom16v.h>
 0000           ; #include <macros.h>
 0000           ; 
 0000           ; #define  LCD_RST_PIN                0x01  //  PB0
 0000           ; #define  LCD_CE_PIN                 0x02  //  PB1
 0000           ; #define  LCD_DC_PIN                 0x04  //  PB2
 0000           ; #define  SPI_MOSI_PIN               0x20  //  PB5
 0000           ; #define  SPI_CLK_PIN                0x80  //  PB7
 0000           ; 
 0000           ; #define  X_Length  45
 0000           ; #define  X_Init    0
 0000           ; #define  Y_Init    0
 0000           ; 
 0000           ; 
 0000           ; static const char FontLookup [][5] =
 0000           ; {
 0000           ;   { 0x00, 0x00, 0x00, 0x00, 0x00 }, // sp
 0000           ;   { 0x00, 0x00, 0x2f, 0x00, 0x00 },   // !
 0000           ;   { 0x00, 0x07, 0x00, 0x07, 0x00 },   // "
 0000           ;   { 0x14, 0x7f, 0x14, 0x7f, 0x14 },   // #
 0000           ;   { 0x24, 0x2a, 0x7f, 0x2a, 0x12 },   // $
 0000           ;   { 0xc4, 0xc8, 0x10, 0x26, 0x46 },   // %
 0000           ;   { 0x36, 0x49, 0x55, 0x22, 0x50 },   // &
 0000           ;   { 0x00, 0x05, 0x03, 0x00, 0x00 },   // '
 0000           ;   { 0x00, 0x1c, 0x22, 0x41, 0x00 },   // (
 0000           ;   { 0x00, 0x41, 0x22, 0x1c, 0x00 },   // )
 0000           ;   { 0x14, 0x08, 0x3E, 0x08, 0x14 },   // *
 0000           ;   { 0x08, 0x08, 0x3E, 0x08, 0x08 },   // +
 0000           ;   { 0x00, 0x00, 0x50, 0x30, 0x00 },   // ,
 0000           ;   { 0x10, 0x10, 0x10, 0x10, 0x10 },   // -
 0000           ;   { 0x00, 0x60, 0x60, 0x00, 0x00 },   // .
 0000           ;   { 0x20, 0x10, 0x08, 0x04, 0x02 },   // /
 0000           ;   { 0x3E, 0x51, 0x49, 0x45, 0x3E },   // 0
 0000           ;   { 0x00, 0x42, 0x7F, 0x40, 0x00 },   // 1
 0000           ;   { 0x42, 0x61, 0x51, 0x49, 0x46 },   // 2
 0000           ;   { 0x21, 0x41, 0x45, 0x4B, 0x31 },   // 3
 0000           ;   { 0x18, 0x14, 0x12, 0x7F, 0x10 },   // 4
 0000           ;   { 0x27, 0x45, 0x45, 0x45, 0x39 },   // 5
 0000           ;   { 0x3C, 0x4A, 0x49, 0x49, 0x30 },   // 6
 0000           ;   { 0x01, 0x71, 0x09, 0x05, 0x03 },   // 7
 0000           ;   { 0x36, 0x49, 0x49, 0x49, 0x36 },   // 8
 0000           ;   { 0x06, 0x49, 0x49, 0x29, 0x1E },   // 9
 0000           ;   { 0x00, 0x36, 0x36, 0x00, 0x00 },   // :
 0000           ;   { 0x00, 0x56, 0x36, 0x00, 0x00 },   // ;
 0000           ;   { 0x08, 0x14, 0x22, 0x41, 0x00 },   // <
 0000           ;   { 0x14, 0x14, 0x14, 0x14, 0x14 },   // =
 0000           ;   { 0x00, 0x41, 0x22, 0x14, 0x08 },   // >
 0000           ;   { 0x02, 0x01, 0x51, 0x09, 0x06 },   // ?
 0000           ;   { 0x32, 0x49, 0x59, 0x51, 0x3E },   // @
 0000           ;   { 0x7E, 0x11, 0x11, 0x11, 0x7E },   // A
 0000           ;   { 0x7F, 0x49, 0x49, 0x49, 0x36 },   // B
 0000           ;   { 0x3E, 0x41, 0x41, 0x41, 0x22 },   // C
 0000           ;   { 0x7F, 0x41, 0x41, 0x22, 0x1C },   // D
 0000           ;   { 0x7F, 0x49, 0x49, 0x49, 0x41 },   // E
 0000           ;   { 0x7F, 0x09, 0x09, 0x09, 0x01 },   // F
 0000           ;   { 0x3E, 0x41, 0x49, 0x49, 0x7A },   // G
 0000           ;   { 0x7F, 0x08, 0x08, 0x08, 0x7F },   // H
 0000           ;   { 0x00, 0x41, 0x7F, 0x41, 0x00 },   // I
 0000           ;   { 0x20, 0x40, 0x41, 0x3F, 0x01 },   // J
 0000           ;   { 0x7F, 0x08, 0x14, 0x22, 0x41 },   // K
 0000           ;   { 0x7F, 0x40, 0x40, 0x40, 0x40 },   // L
 0000           ;   { 0x7F, 0x02, 0x0C, 0x02, 0x7F },   // M
 0000           ;   { 0x7F, 0x04, 0x08, 0x10, 0x7F },   // N
 0000           ;   { 0x3E, 0x41, 0x41, 0x41, 0x3E },   // O
 0000           ;   { 0x7F, 0x09, 0x09, 0x09, 0x06 },   // P
 0000           ;   { 0x3E, 0x41, 0x51, 0x21, 0x5E },   // Q
 0000           ;   { 0x7F, 0x09, 0x19, 0x29, 0x46 },   // R
 0000           ;   { 0x46, 0x49, 0x49, 0x49, 0x31 },   // S
 0000           ;   { 0x01, 0x01, 0x7F, 0x01, 0x01 },   // T
 0000           ;   { 0x3F, 0x40, 0x40, 0x40, 0x3F },   // U
 0000           ;   { 0x1F, 0x20, 0x40, 0x20, 0x1F },   // V
 0000           ;   { 0x3F, 0x40, 0x38, 0x40, 0x3F },   // W
 0000           ;   { 0x63, 0x14, 0x08, 0x14, 0x63 },   // X
 0000           ;   { 0x07, 0x08, 0x70, 0x08, 0x07 },   // Y
 0000           ;   { 0x61, 0x51, 0x49, 0x45, 0x43 },   // Z
 0000           ;   { 0x00, 0x7F, 0x41, 0x41, 0x00 },   // [
 0000           ;   { 0x55, 0x2A, 0x55, 0x2A, 0x55 },   // 55
 0000           ;   { 0x00, 0x41, 0x41, 0x7F, 0x00 },   // ]
 0000           ;   { 0x04, 0x02, 0x01, 0x02, 0x04 },   // ^
 0000           ;   { 0x40, 0x40, 0x40, 0x40, 0x40 },   // _
 0000           ;   { 0x00, 0x01, 0x02, 0x04, 0x00 },   // '
 0000           ;   { 0x20, 0x54, 0x54, 0x54, 0x78 },   // a
 0000           ;   { 0x7F, 0x48, 0x44, 0x44, 0x38 },   // b
 0000           ;   { 0x38, 0x44, 0x44, 0x44, 0x20 },   // c
 0000           ;   { 0x38, 0x44, 0x44, 0x48, 0x7F },   // d
 0000           ;   { 0x38, 0x54, 0x54, 0x54, 0x18 },   // e
 0000           ;   { 0x08, 0x7E, 0x09, 0x01, 0x02 },   // f
 0000           ;   { 0x0C, 0x52, 0x52, 0x52, 0x3E },   // g
 0000           ;   { 0x7F, 0x08, 0x04, 0x04, 0x78 },   // h
 0000           ;   { 0x00, 0x44, 0x7D, 0x40, 0x00 },   // i
 0000           ;   { 0x20, 0x40, 0x44, 0x3D, 0x00 },   // j
 0000           ;   { 0x7F, 0x10, 0x28, 0x44, 0x00 },   // k
 0000           ;   { 0x00, 0x41, 0x7F, 0x40, 0x00 },   // l
 0000           ;   { 0x7C, 0x04, 0x18, 0x04, 0x78 },   // m
 0000           ;   { 0x7C, 0x08, 0x04, 0x04, 0x78 },   // n
 0000           ;   { 0x38, 0x44, 0x44, 0x44, 0x38 },   // o
 0000           ;   { 0x7C, 0x14, 0x14, 0x14, 0x08 },   // p
 0000           ;   { 0x08, 0x14, 0x14, 0x18, 0x7C },   // q
 0000           ;   { 0x7C, 0x08, 0x04, 0x04, 0x08 },   // r
 0000           ;   { 0x48, 0x54, 0x54, 0x54, 0x20 },   // s
 0000           ;   { 0x04, 0x3F, 0x44, 0x40, 0x20 },   // t
 0000           ;   { 0x3C, 0x40, 0x40, 0x20, 0x7C },   // u
 0000           ;   { 0x1C, 0x20, 0x40, 0x20, 0x1C },   // v
 0000           ;   { 0x3C, 0x40, 0x30, 0x40, 0x3C },   // w
 0000           ;   { 0x44, 0x28, 0x10, 0x28, 0x44 },   // x
 0000           ;   { 0x0C, 0x50, 0x50, 0x50, 0x3C },   // y
 0000           ;   { 0x44, 0x64, 0x54, 0x4C, 0x44 }   // z
 0000           ; };
 0000           ; 
 0000           ; 
 0000           ; /*--------------------------------------------------------------------------------------------------
 0000           ;                                  Public function prototypes
 0000           ; --------------------------------------------------------------------------------------------------*/
 0000           ; void LcdInit       ( void );
 0000           ; void LcdClear      ( void );
 0000           ; 
 0000           ; static void LcdSend    ( unsigned char, unsigned char);
 0000           ; static void Delay      ( void );
 0000           ; void LcdGotoXY         ( unsigned char, unsigned char );
 0000           ; 
 0000           ; 
 0000           ; /*--------------------------------------------------------------------------------------------------
 0000           ;   Name         :  LcdInit
 0000           ;   Description  :  Performs MCU SPI & LCD controller initialization.
 0000           ;   Argument(s)  :  None.
 0000           ;   Return value :  None.
 0000           ; --------------------------------------------------------------------------------------------------*/
 0000           ; void LcdInit( void )
 0000           ; {    
 0000                   .dbline 136
 0000           ;     //unsigned char Clear;
 0000           ;     //  Pull-up on reset pin,上电复位端口,此时为高,不复位;
 0000           ;     PORTB |= LCD_RST_PIN;
 0000 C09A              sbi 0x18,0
 0002                   .dbline 139
 0002           ; 
 0002           ;     //  Set output bits on port B,设置输出口;
 0002           ;     DDRB |= LCD_RST_PIN | LCD_DC_PIN | LCD_CE_PIN | SPI_MOSI_PIN | SPI_CLK_PIN;
 0002 87B3              in R24,0x17
 0004 876A              ori R24,167
 0006 87BB              out 0x17,R24
 0008                   .dbline 141
 0008           ; 
 0008           ;     Delay();
 0008 4BD0              xcall _Delay
 000A                   .dbline 144
 000A           ; 
 000A           ;     //  Toggle display reset pin.
 000A           ;     PORTB &= ~LCD_RST_PIN; //上电复位;
 000A C098              cbi 0x18,0
 000C                   .dbline 145
 000C           ;     Delay();
 000C 49D0              xcall _Delay
 000E                   .dbline 146
 000E           ;     PORTB |= LCD_RST_PIN;  //复位完;
 000E C09A              sbi 0x18,0
 0010                   .dbline 149
 0010           ; 
 0010           ;     //  SPI初始化;Enable SPI port: No interrupt, MSBit first, Master mode, CPOL->0, CPHA->0, Clk/4
 0010           ;     SPCR = BIT(SPE)|BIT(MSTR); //使能SPI,主机模式;
 0010 80E5              ldi R24,80
 0012 8DB9              out 0xd,R24
 0014                   .dbline 154
 0014           ;     //SPSR = 0x00;  //似乎不用这几句也能正常运行;
 0014           ;     //Clear= SPSR;
 0014           ;     //Clear= SPDR;
 0014           ;     //  Disable LCD controller
 0014           ;     PORTB |= LCD_CE_PIN;       
 0014 C19A              sbi 0x18,1
 0016                   .dbline 156
 0016           ; 
 0016           ;     LcdSend( 0x21, 0 );  // LCD Extended Commands.
 0016 2227              clr R18
 0018 01E2              ldi R16,33
 001A 37D0              xcall _LcdSend
 001C                   .dbline 157
 001C           ;     LcdSend( 0xC8, 0 );  // Set LCD Vop (Contrast).
 001C 2227              clr R18
 001E 08EC              ldi R16,200
 0020 34D0              xcall _LcdSend
 0022                   .dbline 158
 0022           ;     LcdSend( 0x06, 0 );  // Set Temp coefficent.
 0022 2227              clr R18
 0024 06E0              ldi R16,6
 0026 31D0              xcall _LcdSend
 0028                   .dbline 159
 0028           ;     LcdSend( 0x13, 0 );  // LCD bias mode 1:48.
 0028 2227              clr R18
 002A 03E1              ldi R16,19
 002C 2ED0              xcall _LcdSend
 002E                   .dbline 160
 002E           ;     LcdSend( 0x20, 0 );  // LCD Standard Commands, Horizontal addressing mode.
 002E 2227              clr R18
 0030 00E2              ldi R16,32
 0032 2BD0              xcall _LcdSend
 0034                   .dbline 161
 0034           ;     LcdSend( 0x0C, 0 );  // LCD in normal mode.
 0034 2227              clr R18
 0036 0CE0              ldi R16,12
 0038 28D0              xcall _LcdSend
 003A                   .dbline 163
 003A           ; 
 003A           ;     LcdClear();
 003A 01D0              xcall _LcdClear
 003C                   .dbline -2
 003C           L1:
 003C                   .dbline 0 ; func end
 003C 0895              ret
 003E                   .dbend
 003E                   .dbfunc e LcdClear _LcdClear fV
 003E           ;              i -> R20,R21
                        .even
 003E           _LcdClear::
 003E 0E940000          xcall push_gset1
 0042                   .dbline -1
 0042                   .dbline 174
 0042           ;    
 0042           ; }
 0042           ; 
 0042           ; /*--------------------------------------------------------------------------------------------------
 0042           ;   Name         :  LcdClear
 0042           ;   Description  :  Clears the display.
 0042           ;   Argument(s)  :  None.
 0042           ;   Return value :  None.
 0042           ; --------------------------------------------------------------------------------------------------*/
 0042           ; void LcdClear(void)
 0042           ; {
 0042                   .dbline 177
 0042           ; unsigned int i;
 0042           ; 
 0042           ; LcdSend(0x0c, 0); 
 0042 2227              clr R18
 0044 0CE0              ldi R16,12
 0046 21D0              xcall _LcdSend
 0048                   .dbline 178
 0048           ; LcdSend(0x80, 0); //此时默认操作为清屏
 0048 2227              clr R18

⌨️ 快捷键说明

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