************************************************
RESET:
;*****************************************************
; set special register and initialize
;*****************************************************
NOP
NOP
LDI SPR,00H ;NO PULL UP
LDI PLCD,00H ;LCD 1/4DUTY 1/3BIAS AND USE AS PORTC,D
LDI PACR,1100B ;0:BUSY;1:SDA;2:RQS;3:SCK
LDI PBCR,0000B ;0:0/ON/OFF;1:MM/INCH;2:-;3:-
LDI PCCR,1000B ;3OWER CONTROL
LDI PDCR,1100B ;0pt;1VP/CLR;2:WAIT;3:WORK
LDI PECR,0000B
LDI PORTE,0011B
LDI PORTC,1111B
LDI PORTB,1111B B.3
LDI PORTA,0000B
LDI PORTD,1011B A,PC,PD disable inter pull-up
LDI TEMP1,0FH ;DELAY
SBIM TEMP1,01H ;
BNZ $-1 ;
LDI PORTD,0011B ;CLOSE
LDI TM0,02H
Clear_RAM: ;CLEAR RAM
LDI DPH,01H
LDI DPM,02H
LDI DPL,0FH
CR_LOOP:
LDI INX,00H
SBIM DPL,01H
BNZ CR_LOOP
SBIM DPM,01H
SBI DPM,07H
BNZ CR_LOOP
Clear_RAM1: ;CLEAR RAM
LDI DPH,00H
LDI DPM,07H
LDI DPL,0FH
CR_LOOP1:
LDI INX,00H
SBIM DPL,01H
BNZ CR_LOOP1
SBIM DPM,01H
SBI DPM,0010B
BC CR_LOOP1
LDI 070H,00H
Clear_segments:
LDI TEMP1,00H
STA SEG1
STA SEG2
STA SEG3
STA SEG4
STA SEG5
STA SEG6
STA SEG7
STA SEG8
STA SEG9
STA SEG10
STA SEG11
STA SEG12
STA SEG13
;**********************************************
ldi MODE,00H
;**********************************************
LDI PORTB,0FH ;
LDA PORTB,00H
STA STA_PB,00H
BA1 $+2
LDI STAT0,01H ;NO AUTO OFF
LDA STA_PB,00H
BA0 $+3
ORIM MODE,08H
ORIM STAT3,01H ;FLASH WHILE HALF SLEEPING
;**********************************************
LDI STA_PD,1011B ;ON
STA PORTD,00H
LDA PORTD,00H
BA0 $+3
ORIM MODE,08H
ORIM STAT2,02H ;OPT FOR DISPLAY
;**********************************************
ORIM STAT2,08H ;DIRECTION SELECT
;**********************************************
ORIM STAT0,04H ;zero
;**********************************************
LDI STA_CS,05H
LDI TMP0,00H
LDI TMP1,00H
BUSY_LOW:
LDI PORTA,03H
LDA PORTA,00H
BA0 BUSY_HIGH ;BUSY HIGH
ADIM TMP0,01H
BNC BUSY_LOW
ADIM TMP1,01H
BNC BUSY_LOW
ORIM ERR,04H ;NO BUSY
JMP LCD_ON
BUSY_HIGH:
LDI IRQ,00H
LDI PORTA,07H ;RQS HIGH
STA ACC_BUF,00H ;DELAY
LDI TEMP1,0FH ;
SBIM TEMP1,01H ;
BNZ $-1 ;
LDI PORTA,03H ;RQS HIGH
LDI PARM,02H ;DELAY ABOUT 200MS
CALL Delay
LCD_ON:
LDI LCDON,4 ;LCD ON
;*****************************************************
; main program
;*****************************************************
MAIN:
...
JMP MAIN
END |