📄 hdrv_hardinit.msa
字号:
//***************************************************************
//* ACTOS
//* driver demo
//* (c) Copyright 2002-2003, Actions Co,Ld.
//* All Right Reserved
//* File : Hdrv_HardInit.msa
//* By :
//* Version: 1> v1.00 first version date
//***************************************************************
//LCM12_NT39102
#include "display.h"
#include "Drv_S6B33B0A.h"
#include "Hdrv_S6B33B0A.h"
//***************************************************************
module Hdrv_HardInit
//***************************************************************
public Hdrv_HardInit
public Init_Clear_All
//***************************************************************
extern Write_Command
extern Write_Data
extern DelayMs
extern StoreCE
extern ReStoreCE
extern Ready_Write_Data
//***************************************************************
rseg BBD_IE
//***************************************************************
//* void sUI_HardInit(void);
//** FUNCTION: Hdrv_HardInit
//** Description: 初始化LCM的硬件设备
//***************************************************************
Hdrv_HardInit:
call StoreCE
call LCD_Init
call LCD_Set
call Init_Clear_All
DELAYMS 50
in a,(0xee)
set 1,a
out (0xee),a
call ReStoreCE
ret
//***************************************************************
LCD_Init:
push af
in a,(0xf0)
set 2,a
out (0xf0),a
in a,(0xf0)
set 0,a
out (0xf0),a
in a,(0xee)
and 0x1f
out (0xee),a
in a,(0xee)
res 1,a
out (0xee),a
DELAYMS 20 //20MS
in a,(0xf2)
res 2,a
out (0xf2),a
DELAYMS 10 //20MS
in a,(0xf2)
set 2,a
out (0xf2),a
DELAYMS 100
pop af
ret
//***************************************************************
LCD_Set:
push af
push bc
push hl
ld hl,Set_Init_command
LCM_INIT_LOOP:
ld a,(hl)
cp 0xff //结束标志
jr z,LCM_INIT_OK
cp 0xfe //延时标志
jr z,LCM_INIT_WAIT
WRITE_COMMAND (hl)
inc hl
ld a,(hl) //数值个数
or a
jr z,LCM_INIT_LOOP1
ld b,a
CON_GIVE_DATA:
inc hl
WRITE_DATA (hl)
dec b
ld a,b
or a
jr z,LCM_INIT_LOOP1
jp CON_GIVE_DATA
LCM_INIT_WAIT:
inc hl
DELAYMS (hl)
LCM_INIT_LOOP1:
inc hl
jp LCM_INIT_LOOP
LCM_INIT_OK:
pop hl
pop bc
pop af
ret
//***************************************************************
Init_Clear_All:
push bc
push de
push hl
//_________________________
WRITE_COMMAND 0x2a //
WRITE_DATA 0
WRITE_DATA 0
WRITE_DATA 0 //
WRITE_DATA 175 //
WRITE_COMMAND 0x2b //
WRITE_DATA 0
WRITE_DATA 0
WRITE_DATA 0 //
WRITE_DATA 131 //
WRITE_COMMAND 0x2c
call Ready_Write_Data
ld bc,176*132 //clear all the buffer in driver IC
ld de,0x0000
ClearFrame_loop:
ld a,d
ld (8000h),a
ld a,e
ld (8000h),a
dec bc
ld a,b
or c
jr nz,ClearFrame_loop
//_________________________
pop hl
pop de
pop bc
ret
//***************************************************************
Set_Init_command:
//NT39102
defb 0x01,0//normal display on
defb 0x11,0//Display Inversion Off
defb 0x20,0
defb 0x38,0//Display Inversion on
defb 0x13,0//Display off
//======defb djus,1, vcom===================//
defb 0x3a,1,0x05
defb 0xc0,1,0x03
defb 0xc5,1,0xc0
defb 0xc6,1,0x07
defb 0xe0,7,0x10,0x11,0x11,0x11,0x11,0x11,0x01
defb 0x36,1,0x94
defb 0x2a,4,0x00,0x00,0x00,175
defb 0x2b,4,0x00,0x00,0x00,131
defb 0x0c,2,0x00,0x55
defb 0x2c,0
defb 0x29,0
defb 0xfe,50
defb 0xff
//***************************************************************
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -