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

📄 dotled.s90

📁 16 16点阵显示汉字原理及显示程序
💻 S90
字号:
//////////////////////////////////////////////////////////////////////////////
//                                                                           /
//                                                     31/Jul/2008  14:36:59 /
// IAR Atmel AVR C/C++ Compiler V4.20A/W32, Evaluation Version               /
// Copyright 1996-2006 IAR Systems. All rights reserved.                     /
//                                                                           /
//    Source file  =  E:\HanLin\My_Design\DotLed\IAR\DotLed.c                /
//    Command line =  E:\HanLin\My_Design\DotLed\IAR\DotLed.c --cpu=m8 -ms   /
//                    -o E:\HanLin\My_Design\DotLed\IAR\Release\Obj\ -D      /
//                    NDEBUG -lC E:\HanLin\My_Design\DotLed\IAR\Release\List /
//                    \ -lA E:\HanLin\My_Design\DotLed\IAR\Release\List\     /
//                    --initializers_in_flash -z6 --no_inline                /
//                    --no_cross_call --no_tbaa -DENABLE_BIT_DEFINITIONS -e  /
//                    -I "D:\Software\Embedded Workbench 4.0                 /
//                    Evaluation\avr\INC\" -I "D:\Software\Embedded          /
//                    Workbench 4.0 Evaluation\avr\INC\DLIB\" --eeprom_size  /
//                    512 --dlib_config "D:\Software\Embedded Workbench 4.0  /
//                    Evaluation\avr\LIB\DLIB\dlAVR-1s-ec_mul-n.h"           /
//    List file    =  E:\HanLin\My_Design\DotLed\IAR\Release\List\DotLed.s90 /
//                                                                           /
//                                                                           /
//////////////////////////////////////////////////////////////////////////////

        NAME DotLed

        RTMODEL "__64bit_doubles", "disabled"
        RTMODEL "__cpu", "1"
        RTMODEL "__cpu_name", "ATmega8"
        RTMODEL "__enhanced_core", "enabled"
        RTMODEL "__has_elpm", "false"
        RTMODEL "__memory_model", "2"
        RTMODEL "__rt_version", "3"

        RSEG CSTACK:DATA:NOROOT(0)
        RSEG RSTACK:DATA:NOROOT(0)

        EXTERN ?EPILOGUE_B4_L09
        EXTERN ?PROLOGUE4_L09
        EXTERN ?S_SHL_L02
        EXTERN ?need_segment_init

        PUBWEAK `?<Segment init: NEAR_I>`
        PUBLIC EnableRow
        FUNCTION EnableRow,0203H
        LOCFRAME RSTACK, 2, STACK
        FUNCTION FlipLatchLine,0203H
        LOCFRAME RSTACK, 2, STACK
        PUBLIC InitDotLedPort
        FUNCTION InitDotLedPort,0203H
        LOCFRAME RSTACK, 2, STACK
        PUBLIC PrintDotLed
        FUNCTION PrintDotLed,021203H
        LOCFRAME CSTACK, 4, STACK
        LOCFRAME RSTACK, 2, STACK
        FUNCTION SelectRow,0203H
        LOCFRAME RSTACK, 2, STACK
        FUNCTION TransmitByte,0203H
        LOCFRAME RSTACK, 4, STACK
        PUBWEAK _A_DDRB
        PUBWEAK _A_DDRC
        PUBWEAK _A_PINC
        PUBWEAK _A_PORTB
        PUBWEAK _A_PORTC
        PUBWEAK __?EEARH
        PUBWEAK __?EEARL
        PUBWEAK __?EECR
        PUBWEAK __?EEDR
        PUBLIC font
        PUBLIC main
        FUNCTION main,021a03H
        LOCFRAME RSTACK, 2, STACK
        
        CFI Names cfiNames0
        CFI StackFrame CFA_Y Y DATA
        CFI StackFrame CFA_SP SP DATA
        CFI VirtualResource ?RetPad:1, ?RetHigh:8, ?RetLow:8, ?Ret:17
        CFI Resource R0:8, R1:8, R2:8, R3:8, R4:8, R5:8, R6:8, R7:8, R8:8, R9:8
        CFI Resource R10:8, R11:8, R12:8, R13:8, R14:8, R15:8, R16:8, R17:8
        CFI Resource R18:8, R19:8, R20:8, R21:8, R22:8, R23:8, R24:8, R25:8
        CFI Resource R26:8, R27:8, R28:8, R29:8, R30:8, R31:8
        CFI Resource ?RetHighByteMask:8, SP:16, SPH:8, SPL:8, Y:16
        CFI ResourceParts ?Ret ?RetHigh, ?RetLow, ?RetPad
        CFI ResourceParts SP SPH, SPL
        CFI ResourceParts Y R29, R28
        CFI EndNames cfiNames0
        
        CFI Common cfiCommon0 Using cfiNames0
        CFI CodeAlign 1
        CFI DataAlign 1
        CFI ReturnAddress ?Ret CODE
        CFI CFA_Y Y+0
        CFI CFA_SP SP+2
        CFI ?RetPad 0
        CFI ?RetHigh and(load(1, DATA, sub(CFA_SP, 1)), ?RetHighByteMask)
        CFI ?RetLow Frame(CFA_SP, 0)
        CFI ?Ret Concat
        CFI R0 Undefined
        CFI R1 Undefined
        CFI R2 Undefined
        CFI R3 Undefined
        CFI R4 SameValue
        CFI R5 SameValue
        CFI R6 SameValue
        CFI R7 SameValue
        CFI R8 SameValue
        CFI R9 SameValue
        CFI R10 SameValue
        CFI R11 SameValue
        CFI R12 SameValue
        CFI R13 SameValue
        CFI R14 SameValue
        CFI R15 SameValue
        CFI R16 Undefined
        CFI R17 Undefined
        CFI R18 Undefined
        CFI R19 Undefined
        CFI R20 Undefined
        CFI R21 Undefined
        CFI R22 Undefined
        CFI R23 Undefined
        CFI R24 SameValue
        CFI R25 SameValue
        CFI R26 SameValue
        CFI R27 SameValue
        CFI R28 Undefined
        CFI R29 Undefined
        CFI R30 Undefined
        CFI R31 Undefined
        CFI ?RetHighByteMask SameValue
        CFI SPH Undefined
        CFI SPL Undefined
        CFI EndCommon cfiCommon0
        
// E:\HanLin\My_Design\DotLed\IAR\DotLed.c
//    1 #include "config.h"

        ASEGN ABSOLUTE:DATA:NOROOT,033H
// union <unnamed> volatile __io _A_PINC
_A_PINC:
        DS 1

        ASEGN ABSOLUTE:DATA:NOROOT,034H
// union <unnamed> volatile __io _A_DDRC
_A_DDRC:
        DS 1

        ASEGN ABSOLUTE:DATA:NOROOT,035H
// union <unnamed> volatile __io _A_PORTC
_A_PORTC:
        DS 1

        ASEGN ABSOLUTE:DATA:NOROOT,037H
// union <unnamed> volatile __io _A_DDRB
_A_DDRB:
        DS 1

        ASEGN ABSOLUTE:DATA:NOROOT,038H
// union <unnamed> volatile __io _A_PORTB
_A_PORTB:
        DS 1
//    2 
//    3 #define		DOTLED_LINE_PORT	PORTB
//    4 #define		DOTLED_LINE_DDR		DDRB
//    5 #define		DOTLED_LINE_PIN		PINB
//    6 
//    7 #define		DOTLED_LINE_SCKT	PB1
//    8 #define		DOTLED_LINE_SCKH	PB5
//    9 #define		DOTLED_LINE_SDA		PB3
//   10 
//   11 #define		DOTLED_ROW_PORT		PORTC
//   12 #define		DOTLED_ROW_DDR		DDRC
//   13 #define		DOTLED_ROW_PIN		PINC
//   14 
//   15 #define		DOTLED_ROW_A0		PC0
//   16 #define		DOTLED_ROW_A1		PC1
//   17 #define		DOTLED_ROW_A2		PC2
//   18 #define		DOTLED_ROW_A3		PC3
//   19 #define		DOTLED_ROW_E		PC4
//   20 
//   21 
//   22 

        RSEG NEAR_I:DATA:NOROOT(0)
        REQUIRE `?<Segment init: NEAR_I>`
//   23 uint8 font[] = {
font:
        DS 32
        REQUIRE `?<Initializer for font>`
//   24 /*--  调入了一幅图像:这是您新建的图像  --*/
//   25 /*--  宽度x高度=16x16  --*/
//   26 0x00,0x00,0x00,0x00,0x08,0x38,0x18,0x44,0x08,0x44,0x08,0x04,0x08,0x08,0x08,0x10,
//   27 0x08,0x20,0x08,0x40,0x08,0x40,0x08,0x40,0x3E,0x7C,0x00,0x00,0x00,0x00,0x00,0x00
//   28 };
//   29 
//   30 
//   31 
//   32 static void TransmitByte(uint8 byte);
//   33 static void SelectRow(uint8 row);
//   34 static void FlipLatchLine(void);
//   35 
//   36 

        RSEG CODE:CODE:NOROOT(1)
//   37 static void TransmitByte(uint8 byte)
TransmitByte:
        CFI Block cfiBlock0 Using cfiCommon0
        CFI Function TransmitByte
//   38 {
        MOV     R19, R16
//   39 	uint8 i;
//   40 	
//   41 	for(i = 0 ; i < 8 ; i ++)
        LDI     R18, 0
        RJMP    ??TransmitByte_0
//   42 	{
//   43 		if(byte & (1 << i))
//   44 		{
//   45 			DOTLED_LINE_PORT |= _BV(DOTLED_LINE_SDA);
//   46 		}
//   47 		else
//   48 		{
//   49 			DOTLED_LINE_PORT &= ~_BV(DOTLED_LINE_SDA);
??TransmitByte_1:
        CBI     0x18, 0x03
//   50 		}
//   51 		//__delay_cycles(100);
//   52 		DOTLED_LINE_PORT |= _BV(DOTLED_LINE_SCKH);
??TransmitByte_2:
        SBI     0x18, 0x05
//   53 		//__delay_cycles(100);
//   54 		DOTLED_LINE_PORT &= ~_BV(DOTLED_LINE_SCKH);
        CBI     0x18, 0x05
        INC     R18
??TransmitByte_0:
        CPI     R18, 8
        BRCC    ??TransmitByte_3
        LDI     R16, 1
        LDI     R17, 0
        MOV     R20, R18
        RCALL   ?S_SHL_L02
        AND     R16, R19
        BREQ    ??TransmitByte_1
        SBI     0x18, 0x03
        RJMP    ??TransmitByte_2
//   55 		//__delay_cycles(100);
//   56 	}
//   57 }
??TransmitByte_3:
        RET
        CFI EndBlock cfiBlock0
//   58 

        RSEG CODE:CODE:NOROOT(1)
//   59 static void SelectRow(uint8 row)
SelectRow:
        CFI Block cfiBlock1 Using cfiCommon0
        CFI Function SelectRow
//   60 {
//   61   	//row -= 1;
//   62 	row |= DOTLED_ROW_PIN & 0xe0;
        IN      R17, 0x13
        ANDI    R17, 0xE0
        OR      R16, R17
//   63 	DOTLED_ROW_PORT = row;
        OUT     0x15, R16
//   64 }
        RET
        CFI EndBlock cfiBlock1
//   65 

        RSEG CODE:CODE:NOROOT(1)
//   66 static void FlipLatchLine(void)
FlipLatchLine:
        CFI Block cfiBlock2 Using cfiCommon0
        CFI Function FlipLatchLine
//   67 {
//   68 	DOTLED_LINE_PORT |= _BV(DOTLED_LINE_SCKT);
        SBI     0x18, 0x01
//   69 	DOTLED_LINE_PORT &= ~_BV(DOTLED_LINE_SCKT);
        CBI     0x18, 0x01
//   70 }
        RET
        CFI EndBlock cfiBlock2
//   71 

        RSEG CODE:CODE:NOROOT(1)
//   72 void InitDotLedPort(void)
InitDotLedPort:
        CFI Block cfiBlock3 Using cfiCommon0
        CFI Function InitDotLedPort
//   73 {
//   74 	DOTLED_LINE_PORT &= ~(_BV(DOTLED_LINE_SCKT) | _BV(DOTLED_LINE_SCKH));
        IN      R16, 0x18
        ANDI    R16, 0xDD
        OUT     0x18, R16
//   75 	DOTLED_LINE_PORT |= _BV(DOTLED_LINE_SDA);
        SBI     0x18, 0x03
//   76 	DOTLED_LINE_DDR |= _BV(DOTLED_LINE_SCKT) | _BV(DOTLED_LINE_SCKH) | _BV(DOTLED_LINE_SDA);
        IN      R16, 0x17
        ORI     R16, 0x2A
        OUT     0x17, R16
//   77 	
//   78 	DOTLED_ROW_PORT |= 0x1f;
        IN      R16, 0x15
        ORI     R16, 0x1F
        OUT     0x15, R16
//   79 	DOTLED_ROW_PORT &= 0xf0;
        IN      R16, 0x15
        ANDI    R16, 0xF0
        OUT     0x15, R16
//   80 	DOTLED_ROW_DDR |= 0x1f;
        IN      R16, 0x14
        ORI     R16, 0x1F
        OUT     0x14, R16
//   81 }
        RET
        CFI EndBlock cfiBlock3

        RSEG CODE:CODE:NOROOT(1)
//   82 void EnableRow(boolean IsEnable)
EnableRow:
        CFI Block cfiBlock4 Using cfiCommon0
        CFI Function EnableRow
//   83 {
//   84 	if(IsEnable)
        TST     R16
        BREQ    ??EnableRow_0
//   85 	{
//   86 		DOTLED_ROW_PORT &= ~_BV(DOTLED_ROW_E);
        CBI     0x15, 0x04
        RET
//   87 	}
//   88 	else
//   89 	{
//   90 		DOTLED_ROW_PORT |= _BV(DOTLED_ROW_E);
??EnableRow_0:
        SBI     0x15, 0x04
//   91 	}
//   92 }
        RET
        CFI EndBlock cfiBlock4

        RSEG CODE:CODE:NOROOT(1)
//   93 void PrintDotLed(uint8 * buffer)
PrintDotLed:
        CFI Block cfiBlock5 Using cfiCommon0
        CFI Function PrintDotLed
//   94 {
        FUNCALL PrintDotLed, TransmitByte
        LOCFRAME CSTACK, 4, STACK
        LOCFRAME RSTACK, 2, STACK
        FUNCALL PrintDotLed, TransmitByte
        LOCFRAME CSTACK, 4, STACK
        LOCFRAME RSTACK, 2, STACK
        FUNCALL PrintDotLed, SelectRow
        LOCFRAME CSTACK, 4, STACK
        LOCFRAME RSTACK, 2, STACK
        FUNCALL PrintDotLed, FlipLatchLine
        LOCFRAME CSTACK, 4, STACK
        LOCFRAME RSTACK, 2, STACK
        RCALL   ?PROLOGUE4_L09
        CFI R27 Frame(CFA_Y, -1)
        CFI R26 Frame(CFA_Y, -2)
        CFI R25 Frame(CFA_Y, -3)
        CFI R24 Frame(CFA_Y, -4)
        CFI CFA_Y Y+4
        MOVW    R27:R26, R17:R16
//   95 	uint8 i , tmp;
//   96 	
//   97 	for(i = 0 ; i < 16 ; i ++)
        LDI     R24, 0
        RJMP    ??PrintDotLed_0
//   98 	{
//   99 		tmp = *buffer ++;
??PrintDotLed_1:
        LD      R16, X+
//  100 		TransmitByte(~tmp);
        COM     R16
        RCALL   TransmitByte
//  101 		tmp = *buffer ++;
        LD      R16, X+
//  102 		TransmitByte(~tmp);
        COM     R16
        RCALL   TransmitByte
//  103 		SelectRow(i);
        MOV     R16, R24
        RCALL   SelectRow
//  104 		FlipLatchLine();
        RCALL   FlipLatchLine
//  105 	}
        INC     R24
??PrintDotLed_0:
        CPI     R24, 16
        BRCS    ??PrintDotLed_1
//  106 }
        LDI     R30, 4
        RJMP    ?EPILOGUE_B4_L09
        CFI EndBlock cfiBlock5

        RSEG CODE:CODE:NOROOT(1)
//  107 void main(void)
main:
        CFI Block cfiBlock6 Using cfiCommon0
        CFI Function main
//  108 {
//  109 	InitDotLedPort();
        FUNCALL main, InitDotLedPort
        LOCFRAME RSTACK, 2, STACK
        FUNCALL main, EnableRow
        LOCFRAME RSTACK, 2, STACK
        FUNCALL main, PrintDotLed
        LOCFRAME RSTACK, 2, STACK
        RCALL   InitDotLedPort
//  110 	
//  111 	EnableRow(TRUE);
        LDI     R16, 1
        RCALL   EnableRow
//  112 	
//  113 	while(1)
//  114 	{
//  115 		PrintDotLed(font);
??main_0:
        LDI     R16, LOW(font)
        LDI     R17, (font) >> 8
        RCALL   PrintDotLed
//  116 		__delay_cycles(5000);
        LDI     R16, 225
        LDI     R17, 4
        SUBI    R16, 1
        SBCI    R17, 0
        BRNE    $-4
        RJMP    $+2
        NOP
        RJMP    ??main_0
        CFI EndBlock cfiBlock6
//  117 	}
//  118 	
//  119 }

        ASEGN ABSOLUTE:DATA:NOROOT,01cH
__?EECR:

        ASEGN ABSOLUTE:DATA:NOROOT,01dH
__?EEDR:

        ASEGN ABSOLUTE:DATA:NOROOT,01eH
__?EEARL:

        ASEGN ABSOLUTE:DATA:NOROOT,01fH
__?EEARH:

        RSEG NEAR_ID:CODE:NOROOT(0)
`?<Initializer for font>`:
        DB 0, 0, 0, 0, 8, 56, 24, 68, 8, 68, 8, 4, 8, 8, 8, 16, 8, 32, 8, 64, 8
        DB 64, 8, 64, 62, 124, 0, 0, 0, 0, 0, 0

        RSEG INITTAB:CODE:NOROOT(0)
`?<Segment init: NEAR_I>`:
        DW      SFE(NEAR_I) - SFB(NEAR_I)
        DW      SFB(NEAR_I)
        DW      SFB(NEAR_ID)
        REQUIRE ?need_segment_init

        END
//  120 
//  121 
//  122 
// 
//   5 bytes in segment ABSOLUTE
// 162 bytes in segment CODE
//   6 bytes in segment INITTAB
//  32 bytes in segment NEAR_I
//  32 bytes in segment NEAR_ID
// 
// 194 bytes of CODE memory (+ 6 bytes shared)
//  32 bytes of DATA memory (+ 5 bytes shared)
//
//Errors: none
//Warnings: none

⌨️ 快捷键说明

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