//{{SONIX_CODE_OPTION
.Code_Option WDT_CLK Flosc/4
.Code_Option Reset_Pin P04
.Code_Option LVD LVD_Max ; 3.3V Reset
.Code_Option Watch_Dog Disable ;Turn off the
watchdog.Code_Option Low_Fcpu Flosc/1
.Code_Option High_Clk IHRC_16M ; Internal 16M RC Oscillator
.Code_Option High_Fcpu Fhosc/1
.Code_Option Security Enable
.Code_Option Noise_Filter Enable
//}}SONIX_CODE_OPTION
DATA EQU P4 ;Data port
DATAM EQU P4M
RS EQU P0.0 ;Data/command
RSM EQU P0M.0
RW EQU P0.1 ;Read/write
RWM EQU P0M.1
EEQU P0.2 ; Control enable
EM EQU P0M.2
ORG 0000H
JMP A1
ORG 0015H
A1: MOV A,#30H;Display content
MOV 41H,A
MOV A,#31H
MOV 42H,A
MOV A,#32H
MOV 43H,A
MOV A,#33H
MOV 44H,A
MOV A,#01H;Clear screen
MOV 30H,A
CALL ZL01
MOV A,#250
MOV 31H,A
A2:
MOV A,#38H;Set display mode 5*7 dots
MOV 30H,A
CALL ZL01
DECMS 31H
JMP A2
MOV A,#0CH;Turn on display and turn off cursor
MOV 30H,A
CALL ZL01
CALL XS01;Display subroutine
JMP $
;****************************************************
;Display subroutine
;*************************************************
XS01: MOV A,#38H;Set display mode
MOV 30H,A
CALL ZL01
MOV A,#0CH;Turn on display
MOV 30H,A
CALL ZL01
MOV A,#0C8H;Display starting position
MOV 30H,A
CALL ZL01
B0MOV H,#0 ; Clear "H" to address RAM bank 0.
B0MOV L,#41H ; Set register address.
XS02: MOV A,@HL;Display content processing
MOV 30H,A
CALL SJ01
INCMS L;Display next data
MOV A,L
CMPRS A,#45H;Is the display completed?
JMP XS02
RET
;********************************************
;Write command subroutine
;********************************************
ZL01: MOV A,#0FFH;Set the data port to output state
MOV DATAM,A
MOV DATA,A;Output high level
B0BSET RSM;Set to data mode
B0BCLR RS
B0BSET RWM;Set to read mode
B0BSET RW
B0BSET EM;Allow operation
B0BSET E
ZL02:
B0BCLR P4M.7;Busy check
B0BTS0 P4.7;P4.7=1 busy, P4.7=0 idle
JMP ZL02
B0BSET EM;Turn off enable
B0BCLR E
B0BSET RSM; Set to command mode
B0BCLR RS
B0BSET RWM; Set to write mode
B0BCLR RW
MOV A,#0FFH; Output the content to be written to the data port
MOV DATAM,A
MOV A,30H
MOV DATA,A
B0BSET EM; Allow the enable operation
B0BSET E
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
B0BSET EM; Turn off enable
B0BCLR E
RET
;********************************************
; Write data subroutine
;****************************************
SJ01: MOV A,#0FFH
MOV DATAM,A
MOV DATA,A
B0BSET RSM
B0BCLR RS
B0BSET RWM
B0BSET RW
B0BSET EM
B0BSET E
SJ02:
B0BCLR P4M.7
B0BTS0 P4.7
JMP SJ02
B0BSET EM
B0BCLR E
B0BSET RSM; Set to data mode
B0BSET RS
B0BSET RWM
B0BCLR RW
MOV A,#0FFH
MOV DATAM,A
MOV A,30H
MOV DATA,A
B0BSET EM
B0BSET E
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
B0BSET EM
B0BCLR E
RET
ENDP
Previous article:Songhan MCU independent button
Next article:Learning experience of AVR and PIC microcontrollers
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Keysight Technologies Helps Samsung Electronics Successfully Validate FiRa® 2.0 Safe Distance Measurement Test Case
- Innovation is not limited to Meizhi, Welling will appear at the 2024 China Home Appliance Technology Conference
- Innovation is not limited to Meizhi, Welling will appear at the 2024 China Home Appliance Technology Conference
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Download from the Internet--ARM Getting Started Notes
- Learn ARM development(22)
- Learn ARM development(21)
- Learn ARM development(20)
- Learn ARM development(19)
- Learn ARM development(14)
- I, I, I have a question about relays and analog switches...
- Smart TFT with LUA script, making Tetris is so easy
- Last day! Apply for GD32VF series development board and new ATMEGA4809 for free, grab the last train and get on it!
- "Thank you for being here, thank you for the gift" - Thanksgiving Day Grab the Building & Give Thank You Gift Event
- Electronic component failure analysis and typical cases
- Hongmeng Development Board Neptune (VI) - Source Code Compilation 3
- When TEA1062 is on a call, the receiver is very quiet and no sound comes out of the MIC
- For CLC and CRC filtering, it is best to have high-frequency capacitors at both ends of the resistor and inductor. Could you please tell me how to configure the high-frequency capacitors?
- 【BG22-EK4108A Bluetooth Development Kit】 1. Test Bluetooth signal strength + data upload and download
- The Bluetooth signal problem has finally come to an end.