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

📄 main.s

📁 单片机控制122x32液晶。液晶内部芯片包含RAM(类似于显存)
💻 S
📖 第 1 页 / 共 2 页
字号:
	.module main.c
	.area lit(rom, con, rel)
_psoc_bmp::
	.byte 14,0
	.byte 0,56
	.byte 31,0
	.byte 0,124
	.byte 31,0
	.byte 0,124
	.byte 31,0
	.byte 0,124
	.byte 31,0
	.byte 0,124
	.byte 255,255
	.byte 255,127
	.byte 255,255
	.byte 255,127
	.byte 255,255
	.byte 255,127
	.byte 255,255
	.byte 255,127
	.byte 255,255
	.byte 255,127
	.byte 31,128
	.byte 15,124
	.byte 31,128
	.byte 15,124
	.byte 31,128
	.byte 15,124
	.byte 31,128
	.byte 15,124
	.byte 31,128
	.byte 15,124
	.byte 31,128
	.byte 15,124
	.byte 31,128
	.byte 15,124
	.byte 31,128
	.byte 15,124
	.byte 31,128
	.byte 15,56
	.byte 31,192
	.byte 15,0
	.byte 62,192
	.byte 7,0
	.byte 126,224
	.byte 7,0
	.byte 254,240
	.byte 3,0
	.byte 252,255
	.byte 3,0
	.byte 248,255
	.byte 1,0
	.byte 248,255
	.byte 0,0
	.byte 224,127
	.byte 0,0
	.byte 128,31
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 224,63
	.byte 192,15
	.byte 240,127
	.byte 224,63
	.byte 240,127
	.byte 248,127
	.byte 240,127
	.byte 252,255
	.byte 224,63
	.byte 252,255
	.byte 129,63
	.byte 254,248
	.byte 1,126
	.byte 62,240
	.byte 1,126
	.byte 63,240
	.byte 3,124
	.byte 31,224
	.byte 3,252
	.byte 31,224
	.byte 3,248
	.byte 31,224
	.byte 7,248
	.byte 31,224
	.byte 7,248
	.byte 31,224
	.byte 7,248
	.byte 31,192
	.byte 7,248
	.byte 63,192
	.byte 7,248
	.byte 62,192
	.byte 15,252
	.byte 126,192
	.byte 15,124
	.byte 252,128
	.byte 15,126
	.byte 254,131
	.byte 31,127
	.byte 255,135
	.byte 255,63
	.byte 255,7
	.byte 255,63
	.byte 255,7
	.byte 254,31
	.byte 254,3
	.byte 252,15
	.byte 0,0
	.byte 240,3
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 127,0
	.byte 0,192
	.byte 255,1
	.byte 0,224
	.byte 255,7
	.byte 0,248
	.byte 255,15
	.byte 0,252
	.byte 255,31
	.byte 0,252
	.byte 193,63
	.byte 0,254
	.byte 0,63
	.byte 0,63
	.byte 0,126
	.byte 0,63
	.byte 0,126
	.byte 0,31
	.byte 0,124
	.byte 128,31
	.byte 0,252
	.byte 128,15
	.byte 0,248
	.byte 128,15
	.byte 0,248
	.byte 128,15
	.byte 0,248
	.byte 128,15
	.byte 0,248
	.byte 128,15
	.byte 0,248
	.byte 128,15
	.byte 0,248
	.byte 128,31
	.byte 0,252
	.byte 0,31
	.byte 0,124
	.byte 0,63
	.byte 0,126
	.byte 0,63
	.byte 0,126
	.byte 0,254
	.byte 0,63
	.byte 0,252
	.byte 193,63
	.byte 0,252
	.byte 255,31
	.byte 0,248
	.byte 255,15
	.byte 0,240
	.byte 255,7
	.byte 0,192
	.byte 255,1
	.byte 0,0
	.byte 127,0
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 0,248
	.byte 63,0
	.byte 0,255
	.byte 255,0
	.byte 192,255
	.byte 255,3
	.byte 224,255
	.byte 255,7
	.byte 240,255
	.byte 255,15
	.byte 248,7
	.byte 224,31
	.byte 252,1
	.byte 128,63
	.byte 252,0
	.byte 0,63
	.byte 126,0
	.byte 0,126
	.byte 62,0
	.byte 0,124
	.byte 63,0
	.byte 0,124
	.byte 31,0
	.byte 0,252
	.byte 31,0
	.byte 0,248
	.byte 31,0
	.byte 0,248
	.byte 31,0
	.byte 0,248
	.byte 31,0
	.byte 0,248
	.byte 31,0
	.byte 0,248
	.byte 31,0
	.byte 0,248
	.byte 62,0
	.byte 0,248
	.byte 62,0
	.byte 0,248
	.byte 126,0
	.byte 0,124
	.byte 124,0
	.byte 0,124
	.byte 254,3
	.byte 0,126
	.byte 255,7
	.byte 0,63
	.byte 255,7
	.byte 128,63
	.byte 255,7
	.byte 128,31
	.byte 254,3
	.byte 128,15
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.dbfile ./logo.h
	.dbsym e psoc_bmp _psoc_bmp A[488:488]c
_l_mask_array::
	.byte 1,2
	.byte 4,8
	.byte 16,32
	.byte 64,128
	.dbfile ./main.c
	.dbsym e l_mask_array _l_mask_array A[8:8]c
	.area text(rom, con, rel)
	.dbfile ./main.c
	.dbfunc e main _main fV
_main::
	.dbline -1
	.dbline 78
; //----------------------------------------------------------------------------
; // C main line
; //----------------------------------------------------------------------------
; 
; #include <m8c.h>        // part specific constants and macros
; #include "PSoCAPI.h"    // PSoC API definitions for all User Modules
; 
; #include "logo.h"
; 
; 
; BYTE rl;
; 
; BYTE x,y,bitnum,bitmask,yByte;
; 
; unsigned int  str;
; 
; const unsigned char l_mask_array[8] =
; 	{0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80}; 
; 
; 
; 
; INT  i,j;
; 
; 
; #define bit0 0x01
; #define bit1 0x02
; #define bit2 0x04
; #define bit3 0x08
; #define bit4 0x10
; #define bit5 0x20
; #define bit6 0x40
; #define bit7 0x80
; 
; 
; //    sed1520
; //                            76543210        
; #define Display_ON          0b10101111 
; #define Display_OFF         0b10101110 
; 
; #define DisplayStartLine    0b11000000 
; #define PageAddressSet      0b10111000 
; #define ColumnAdressSet     0b00000000
; 
; #define StatusBUSY          0b10000000
; #define StatusADC_R         0b01000000
; #define StatusOFF           0b00100000
; #define StatusRESET         0b00010000
;  
; #define ADC_Select_R        0b10100000
; #define ADC_Select_L        0b10100001
; #define StaticDriveOFF      0b10100100
; #define StaticDriveON       0b10100101 
; 
; #define DutySelect16        0b10101000
; #define DutySelect32        0b10101001
; #define ReadModifyWrite     0b11100000
; #define OffReadModifyWrite  0b11101110
; #define DisplayEnd          0b11101110
; #define DisplayReset        0b11100010
; 
; 
; //
; #define    Ctrl     PRT1DR
; #define    Data     PRT2DR
; #define    A0       bit2
; #define    CS1      bit3 
; #define    CS2      bit4
; //CL  bit5
; 
; #define    E       bit6
; #define    WR      bit7
; 
; #define LCDDisable  Ctrl |=  E
; #define LCDEnable   Ctrl &= ~E
; 
; 
; void main()
; {
	.dbline 79
; ports_init ();
	xcall _ports_init
	.dbline 81
;                 
; PWM8_1_Start();
	push X
	xcall _PWM8_1_Start
	.dbline 82
; PWM8_2_Start();
	xcall _PWM8_2_Start
	pop X
	.dbline 84
; 
; ResetDisplay ();  //reset LCD
	xcall _ResetDisplay
	.dbline 85
; InitDisplay ();   //Initialize LCD
	xcall _InitDisplay
	.dbline 87
; 
; test_PSoC();      // save logo in LCD
	xcall _test_PSoC
	.dbline 88
; display();        // LCD show                                                             
	xcall _display
	.dbline -2
	.dbline 91
; 
; 
; }
L1:
	.dbline 0 ; func end
	jmp .
	.dbend
	.dbfunc e ResetDisplay _ResetDisplay fV
_ResetDisplay::
	.dbline -1
	.dbline 94
; 
; void ResetDisplay ()
; {
	.dbline 95
; PRT0DR |= bit0;
	or REG[ 0],1
	.dbline 96
; delay(239);  //1ms cpu 24MHz
	mov A,0
	push A
	mov A,-17
	push A
	xcall _delay
	add SP,-2
	.dbline 97
; PRT0DR &= ~bit0;
	and REG[ 0],-2
	.dbline -2
	.dbline 98
; }
L2:
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e InitDisplay _InitDisplay fV
_InitDisplay::
	.dbline -1
	.dbline 103
; 
; 
; 
; void InitDisplay ()
; {
	.dbline 104
; Data = Display_OFF;
	mov REG[0x8],-82
	.dbline 105
; write_instruction ();
	xcall _write_instruction
	.dbline 106
; Data = DisplayStartLine;
	mov REG[0x8],-64
	.dbline 107
; write_instruction ();
	xcall _write_instruction
	.dbline 108
; Data = StaticDriveOFF;
	mov REG[0x8],-92
	.dbline 109
; write_instruction ();
	xcall _write_instruction
	.dbline 110
; Data = ColumnAdressSet;
	mov REG[0x8],0
	.dbline 111
; write_instruction ();
	xcall _write_instruction
	.dbline 112
; Data = DutySelect32;
	mov REG[0x8],-87
	.dbline 113
; write_instruction ();
	xcall _write_instruction
	.dbline 114
; Data = ADC_Select_R; 
	mov REG[0x8],-96
	.dbline 115
; write_instruction ();
	xcall _write_instruction
	.dbline 116
; Data = OffReadModifyWrite; //Off
	mov REG[0x8],-18
	.dbline 117
; write_instruction ();
	xcall _write_instruction
	.dbline -2
	.dbline 118
; }
L3:
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e read_data _read_data fc
;            dat -> X+0
_read_data::
	.dbline -1
	push X
	mov X,SP
	add SP,1
	.dbline 124
; 
; 
; 
; // Read data from a driver
; BYTE read_data ()
; {
	.dbline 126
; BYTE dat;
; Data=5;
	mov REG[0x8],5
	.dbline 128
; 
; Ctrl |= A0;
	or REG[0x4],4
	.dbline 130
; 
; LCDEnable;
	and REG[0x4],-65
	.dbline 132
; 
; Ctrl &= ~WR;
	and REG[0x4],127
	.dbline 133
; Ctrl |=  WR;
	or REG[0x4],-128
	.dbline 135
; 
;  PRT2_HZ ();
	xcall _PRT2_HZ
	.dbline 136
;   dat=Data;
	mov A,REG[0x8]
	mov [X+0],A
	.dbline 137
;  PRT2_PD (); 
	xcall _PRT2_PD
	.dbline 139
;   
; LCDDisable;
	or REG[0x4],64
	.dbline 141
; 
; return dat;
	mov A,[X+0]
	.dbline -2
L4:
	add SP,-1
	pop X
	.dbline 0 ; func end
	ret
	.dbsym l dat 0 c
	.dbend
	.dbfunc e write_data _write_data fV
_write_data::
	.dbline -1
	.dbline 148
; 
; }
; 
; 
; // Write data to a driver
; void write_data ()
; {
	.dbline 149
; LCD_Ready ();
	xcall _LCD_Ready
	.dbline 150
; Ctrl &= ~A0;
	and REG[0x4],-5
	.dbline 151
; Ctrl |= A0;
	or REG[0x4],4
	.dbline 152
; Ctrl |=  WR;
	or REG[0x4],-128
	.dbline 153
; Ctrl &= ~WR;
	and REG[0x4],127
	.dbline 154
; LCDEnable;
	and REG[0x4],-65
	.dbline 155
; LCDDisable;
	or REG[0x4],64
	.dbline -2
	.dbline 157
; 
; }
L5:
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e write_instruction _write_instruction fV
_write_instruction::
	.dbline -1
	.dbline 161
; 
; // Write an instruction to a driver
; void write_instruction ()
; {
	.dbline 162
; LCD_Ready ();
	xcall _LCD_Ready
	.dbline 163
; Ctrl |=  A0;
	or REG[0x4],4
	.dbline 164
; Ctrl &= ~A0;
	and REG[0x4],-5
	.dbline 165
; Ctrl |=  WR;
	or REG[0x4],-128
	.dbline 166
; Ctrl &= ~WR;
	and REG[0x4],127
	.dbline 167
; LCDEnable;
	and REG[0x4],-65
	.dbline 168
; LCDDisable;
	or REG[0x4],64
	.dbline -2
	.dbline 169
; }
L6:
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e LCD_Ready _LCD_Ready fV
_LCD_Ready::
	.dbline -1
	.dbline 174
; 
; 
; // Read the current status of a driver
; void LCD_Ready ()
; {
L8:
	.dbline 175
; do {
	.dbline 177
; 
; Ctrl &= ~A0;
	and REG[0x4],-5
	.dbline 179
; 
; LCDEnable;
	and REG[0x4],-65
	.dbline 180
;        Ctrl |=  WR;    
	or REG[0x4],-128
	.dbline 181
;    PRT2_HZ (); 
	xcall _PRT2_HZ
	.dbline 182
;     rl=Data;
	mov A,REG[0x8]
	mov [_rl],A
	.dbline 183
;    PRT2_PD (); 
	xcall _PRT2_PD
	.dbline 184
;        Ctrl &= ~WR;
	and REG[0x4],127
	.dbline 185
; LCDDisable;
	or REG[0x4],64
	.dbline 186
L9:

⌨️ 快捷键说明

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