test_lcd.lss
来自「在WinAVR下的ST7565圖形點陣的驅動程序」· LSS 代码 · 共 1,839 行 · 第 1/5 页
LSS
1,839 行
bee: ff 90 pop r15
bf0: ef 90 pop r14
bf2: df 90 pop r13
bf4: bf 90 pop r11
bf6: af 90 pop r10
bf8: 08 95 ret
00000bfa <LCD_CLR>:
//-----------------------------------------------------------------------------
// LCD:Clear picture.
//-----------------------------------------------------------------------------
void LCD_CLR(uint8 Data)
{
bfa: 0f 93 push r16
bfc: 1f 93 push r17
bfe: cf 93 push r28
c00: df 93 push r29
c02: 08 2f mov r16, r24
c04: 10 e0 ldi r17, 0x00 ; 0
uint8 adrPage, adrLaw;
for(adrPage = 0; adrPage < MAX_PAGE; adrPage++)
{
LCD_SetPageAddress(adrPage);
c06: 81 2f mov r24, r17
c08: 0e 94 52 04 call 0x8a4 ; 0x8a4 <LCD_SetPageAddress>
LCD_SetColumnAddress(0);
c0c: 80 e0 ldi r24, 0x00 ; 0
c0e: 0e 94 45 04 call 0x88a ; 0x88a <LCD_SetColumnAddress>
c12: c1 e8 ldi r28, 0x81 ; 129
c14: d0 e0 ldi r29, 0x00 ; 0
c16: 03 c0 rjmp .+6 ; 0xc1e <LCD_CLR+0x24>
for(adrLaw = 0; adrLaw < MAX_COLUMN; adrLaw++)
{
LCD_WriteData(Data);
c18: 80 2f mov r24, r16
c1a: 0e 94 b2 04 call 0x964 ; 0x964 <LCD_WriteData>
c1e: 21 97 sbiw r28, 0x01 ; 1
for(adrPage = 0; adrPage < MAX_PAGE; adrPage++)
{
LCD_SetPageAddress(adrPage);
LCD_SetColumnAddress(0);
for(adrLaw = 0; adrLaw < MAX_COLUMN; adrLaw++)
c20: d9 f7 brne .-10 ; 0xc18 <LCD_CLR+0x1e>
//-----------------------------------------------------------------------------
void LCD_CLR(uint8 Data)
{
uint8 adrPage, adrLaw;
for(adrPage = 0; adrPage < MAX_PAGE; adrPage++)
c22: 1f 5f subi r17, 0xFF ; 255
c24: 18 30 cpi r17, 0x08 ; 8
c26: 79 f7 brne .-34 ; 0xc06 <LCD_CLR+0xc>
for(adrLaw = 0; adrLaw < MAX_COLUMN; adrLaw++)
{
LCD_WriteData(Data);
}
}
}
c28: df 91 pop r29
c2a: cf 91 pop r28
c2c: 1f 91 pop r17
c2e: 0f 91 pop r16
c30: 08 95 ret
00000c32 <main>:
char Hz[] = " !\"#$%&'()*+,-./0123456789";
int main(void)
{
c32: 0e 94 d5 08 call 0x11aa ; 0x11aa <init_devices>
init_devices();
Delay_10ms(10);
c36: 8a e0 ldi r24, 0x0A ; 10
c38: 90 e0 ldi r25, 0x00 ; 0
c3a: 0e 94 15 09 call 0x122a ; 0x122a <Delay_10ms>
LCD_Init();
c3e: 0e 94 66 04 call 0x8cc ; 0x8cc <LCD_Init>
LCD_CLR(0x00);
c42: 80 e0 ldi r24, 0x00 ; 0
c44: 0e 94 fd 05 call 0xbfa ; 0xbfa <LCD_CLR>
LCD_DisplayString(Hz, 0, 0);
c48: 40 e0 ldi r20, 0x00 ; 0
c4a: 60 e0 ldi r22, 0x00 ; 0
c4c: 80 e0 ldi r24, 0x00 ; 0
c4e: 91 e0 ldi r25, 0x01 ; 1
c50: 0e 94 b4 05 call 0xb68 ; 0xb68 <LCD_DisplayString>
while(1)
{
//Handle_Connect_MainLoop();
PushButton_Proc();
c54: 0e 94 77 06 call 0xcee ; 0xcee <PushButton_Proc>
c58: fd cf rjmp .-6 ; 0xc54 <main+0x22>
00000c5a <ScanKeyBoard>:
//包含所需头文件
#include "config.h"
uint8 ScanKeyBoard(void)
{
c5a: 85 b3 in r24, 0x15 ; 21
c5c: 8f 71 andi r24, 0x1F ; 31
c5e: 85 bb out 0x15, r24 ; 21
uint8 Scan_Out=0x20, Scan_In, i;
PB_SCAN_PORT &= ~PB_SCAN_MASK;
NOP();
c60: 00 00 nop
Scan_In = PB_READ_PORT & PB_READ_MASK;
c62: 83 b3 in r24, 0x13 ; 19
if(Scan_In == PB_READ_MASK) // 没有按键按下
c64: 8e 71 andi r24, 0x1E ; 30
c66: 8e 31 cpi r24, 0x1E ; 30
c68: c1 f0 breq .+48 ; 0xc9a <ScanKeyBoard+0x40>
c6a: 30 e2 ldi r19, 0x20 ; 32
c6c: 20 e0 ldi r18, 0x00 ; 0
return NO_VALUE;
for(i=0; i<3; i++)
{
PB_SCAN_PORT |= PB_SCAN_MASK;
c6e: 85 b3 in r24, 0x15 ; 21
c70: 80 6e ori r24, 0xE0 ; 224
c72: 85 bb out 0x15, r24 ; 21
PB_SCAN_PORT &= ~Scan_Out;
c74: 95 b3 in r25, 0x15 ; 21
c76: 83 2f mov r24, r19
c78: 80 95 com r24
c7a: 89 23 and r24, r25
c7c: 85 bb out 0x15, r24 ; 21
NOP();
c7e: 00 00 nop
Scan_In = PB_READ_PORT & PB_READ_MASK;
c80: 83 b3 in r24, 0x13 ; 19
if(Scan_In != PB_READ_MASK)
c82: 8e 71 andi r24, 0x1E ; 30
c84: 8e 31 cpi r24, 0x1E ; 30
c86: 21 f0 breq .+8 ; 0xc90 <ScanKeyBoard+0x36>
{
return (~PB_READ_PORT & (PB_SCAN_MASK|PB_READ_MASK));
c88: 83 b3 in r24, 0x13 ; 19
c8a: 80 95 com r24
c8c: 8e 7f andi r24, 0xFE ; 254
c8e: 08 95 ret
NOP();
Scan_In = PB_READ_PORT & PB_READ_MASK;
if(Scan_In == PB_READ_MASK) // 没有按键按下
return NO_VALUE;
for(i=0; i<3; i++)
c90: 2f 5f subi r18, 0xFF ; 255
c92: 23 30 cpi r18, 0x03 ; 3
c94: 11 f0 breq .+4 ; 0xc9a <ScanKeyBoard+0x40>
Scan_In = PB_READ_PORT & PB_READ_MASK;
if(Scan_In != PB_READ_MASK)
{
return (~PB_READ_PORT & (PB_SCAN_MASK|PB_READ_MASK));
}
Scan_Out <<= 1;
c96: 33 0f add r19, r19
c98: ea cf rjmp .-44 ; 0xc6e <ScanKeyBoard+0x14>
c9a: 80 e0 ldi r24, 0x00 ; 0
}
return NO_VALUE;
}
c9c: 08 95 ret
00000c9e <GetPushButtonValue>:
void GetPushButtonValue(void)
{
c9e: 0e 94 2d 06 call 0xc5a ; 0xc5a <ScanKeyBoard>
ca2: 28 2f mov r18, r24
ca4: 80 93 1f 01 sts 0x011F, r24
static uint8 KeyTemp, PreKeyValue;
static uint16 KeyTimer;
KeyTemp = ScanKeyBoard();
if(KeyTemp == NO_VALUE)
ca8: 88 23 and r24, r24
caa: 19 f4 brne .+6 ; 0xcb2 <GetPushButtonValue+0x14>
{
PreKeyValue = NO_VALUE;
cac: 10 92 1e 01 sts 0x011E, r1
cb0: 08 95 ret
}
else
{
if(KeyTemp == PreKeyValue)
cb2: 80 91 1e 01 lds r24, 0x011E
cb6: 28 17 cp r18, r24
cb8: 99 f4 brne .+38 ; 0xce0 <GetPushButtonValue+0x42>
{
KeyTimer ++;
cba: 80 91 1c 01 lds r24, 0x011C
cbe: 90 91 1d 01 lds r25, 0x011D
cc2: 01 96 adiw r24, 0x01 ; 1
cc4: 90 93 1d 01 sts 0x011D, r25
cc8: 80 93 1c 01 sts 0x011C, r24
if(KeyTimer == 0x02)
ccc: 02 97 sbiw r24, 0x02 ; 2
cce: 71 f4 brne .+28 ; 0xcec <GetPushButtonValue+0x4e>
{
KeyValue = KeyTemp;
cd0: 20 93 20 01 sts 0x0120, r18
SysFlag.KeyValid = 1;
cd4: 80 91 21 01 lds r24, 0x0121
cd8: 84 60 ori r24, 0x04 ; 4
cda: 80 93 21 01 sts 0x0121, r24
cde: 08 95 ret
}
}
else
{
KeyTimer = 0;
ce0: 10 92 1d 01 sts 0x011D, r1
ce4: 10 92 1c 01 sts 0x011C, r1
PreKeyValue = KeyTemp;
ce8: 20 93 1e 01 sts 0x011E, r18
cec: 08 95 ret
00000cee <PushButton_Proc>:
}
}
void PushButton_Proc(void)
{
cee: 80 91 21 01 lds r24, 0x0121
cf2: 82 ff sbrs r24, 2
cf4: 08 c0 rjmp .+16 ; 0xd06 <PushButton_Proc+0x18>
if(SysFlag.KeyValid)
{
SysFlag.KeyValid = 0;
cf6: 8b 7f andi r24, 0xFB ; 251
cf8: 80 93 21 01 sts 0x0121, r24
switch(KeyValue)
cfc: 80 91 20 01 lds r24, 0x0120
d00: 82 32 cpi r24, 0x22 ; 34
d02: 09 f4 brne .+2 ; 0xd06 <PushButton_Proc+0x18>
{
case S1_VALUE:
NOP();
d04: 00 00 nop
d06: 08 95 ret
00000d08 <port_init>:
** 系统初始化功能函数
********************************************************************/
//端口初始化
void port_init(void)
{
d08: 80 b5 in r24, 0x20 ; 32
d0a: 8b 7f andi r24, 0xFB ; 251
d0c: 80 bd out 0x20, r24 ; 32
SFIOR &= ~BIT(PUD);
PORTA = 0x00;
d0e: 1b ba out 0x1b, r1 ; 27
DDRA = 0xE0;
d10: 90 ee ldi r25, 0xE0 ; 224
d12: 9a bb out 0x1a, r25 ; 26
PORTB = 0x00;
d14: 18 ba out 0x18, r1 ; 24
DDRB = 0xF6;
d16: 86 ef ldi r24, 0xF6 ; 246
d18: 87 bb out 0x17, r24 ; 23
PORTC = 0x1E;
d1a: 8e e1 ldi r24, 0x1E ; 30
d1c: 85 bb out 0x15, r24 ; 21
DDRC = 0xE1;
d1e: 81 ee ldi r24, 0xE1 ; 225
d20: 84 bb out 0x14, r24 ; 20
PORTD = 0x00;
d22: 12 ba out 0x12, r1 ; 18
DDRD = 0xE0;
d24: 91 bb out 0x11, r25 ; 17
}
d26: 08 95 ret
00000d28 <timer0_init>:
//定时器T0初始化
void timer0_init(void)
{
d28: 13 be out 0x33, r1 ; 51
TCCR0 = 0x00; // 停止定时器
TCNT0 = 0x00; // 初始值
d2a: 12 be out 0x32, r1 ; 50
OCR0 = TIMER0_DATA; // 比较匹配值
d2c: 88 e4 ldi r24, 0x48 ; 72
d2e: 81 bf out 0x31, r24 ; 49
//OCR0 = 0x25; // 比较匹配值
TIMSK |= BIT(OCIE0); // 比较匹配中断允许
d30: 87 b7 in r24, 0x37 ; 55
d32: 82 60 ori r24, 0x02 ; 2
d34: 87 bf out 0x37, r24 ; 55
TCCR0 = 0x0F; // 启动定时器 Fosc/1024
d36: 8f e0 ldi r24, 0x0F ; 15
d38: 83 bf out 0x33, r24 ; 51
}
d3a: 08 95 ret
00000d3c <timer1_init>:
//定时T1初始化
void timer1_init(void)
{
d3c: 1e bc out 0x2e, r1 ; 46
TCCR1B = 0x00; //停止定时器
TIMSK |= 0x20; //中断允许
d3e: 87 b7 in r24, 0x37 ; 55
d40: 80 62 ori r24, 0x20 ; 32
d42: 87 bf out 0x37, r24 ; 55
TCNT1H = 0xFF;
d44: 8f ef ldi r24, 0xFF ; 255
d46: 8d bd out 0x2d, r24 ; 45
TCNT1L = 0xFF; //初始值
d48: 8c bd out 0x2c, r24 ; 44
OCR1AH = 0xFE;
d4a: 9e ef ldi r25, 0xFE ; 254
d4c: 9b bd out 0x2b, r25 ; 43
OCR1AL = 0xFF; //匹配A值
d4e: 8a bd out 0x2a, r24 ; 42
OCR1BH = 0xFE;
d50: 99 bd out 0x29, r25 ; 41
OCR1BL = 0xFF; //匹配B值
d52: 88 bd out 0x28, r24 ; 40
ICR1H = 0xFF;
d54: 87 bd out 0x27, r24 ; 39
ICR1L = 0xFF; //输入捕捉匹配值
d56: 86 bd out 0x26, r24 ; 38
TCCR1A = 0x00;
d58: 1f bc out 0x2f, r1 ; 47
TCCR1B = 0x83; //启动定时器
d5a: 83 e8 ldi r24, 0x83 ; 131
d5c: 8e bd out 0x2e, r24 ; 46
}
d5e: 08 95 ret
00000d60 <spi_init>:
** SPI 底层功能函数
********************************************************************/
// SPI baud rate = 921.6KHz
void spi_init(void)
{
d60: 87 b3 in r24, 0x17 ; 23
d62: 86 60 ori r24, 0x06 ; 6
d64: 87 bb out 0x17, r24 ; 23
DDRB |= BIT(PORT1) | BIT(PORT2);
PORTB |= ~ BIT(PORT1) | BIT(PORT2);
d66: 88 b3 in r24, 0x18 ; 24
d68: 8d 6f ori r24, 0xFD ; 253
d6a: 88 bb out 0x18, r24 ; 24
//spi初始化
SPCR = BIT(SPE) | BIT(MSTR) | BIT(SPR0) | BIT(CPHA);
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?