;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; This is a program that was written by Todd Fitzsimmons
; to communicate with the SED1560 small graphic 64x100.
; Version 1.0 written on 1/22/98.
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.ORG 00H ;SETS UP THE ORIGIN
MOV 08AH,#07FH ;SETS INTERNAL TIMER
MOV 08CH,#0C1H ;TO 16000 CLOCK
MOV 0A8H,#082H ;FOR WDT
AJMP MAIN ;JUMP TO SKIP INTERUPT ROUTINE
MOV 0A6H,#1EH ;VECTOR FOR INTERUPT ROUTINE
MOV 0A6H,#0E1H ;RESETS WDT
MOV 08AH,#07FH ;RESETS TIMER FOR FUTURE INTERUPTS
MOV 08CH,#0C1H ;
RETI ;RETURN FROM INTERUPT
MAIN: MOV 089H,#01H ;SETS UP 16 BIT TIMER "0"
MOV 088H,#10H ;TURNS TIMER "0" ON
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; This above code takes care of the watch dog timer so that the
; program may continue to run
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
MOV 0C0H,#70H ;NULL DATA
MOV 0F8H,#00H ;NULL DATA
MOV 0B0H,#00H ;NULL DATA
MOV 090H,#00H ;NULL DATA
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; The program listed below is the initialization for the SED1330
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
MOV B,#02H ;PAUSE FOR DEMO RESET FUNCTION
LCALL WAIT
MOV B,#0E2H ;RESET DISPLAY
LCALL WRCMD
MOV B,#0C4H ;SETS OUTPUT STATE
LCAll WRCMD ;
MOV B,#0A9H ;SETS DUTY TO 1/64
LCALL WRCMD ;
MOV B,#025H ;SETS POWER MODE
LCALL WRCMD ;
MOV B,#01H ;PAUSE FOR THE TIMING CONSTRAINTS
LCALL WAIT ;
MOV B,#0EDH ;SETS POWER MODE
LCALL WRCMD ;
MOV B,#0AFH ;TURNS DISPLAY ON
LCALL WRCMD ;
MOV B,#040H ;SET LINE ONE TO TOP LINE OF DISPLAY
LCALL WRCMD ;
MOV B,#088H ;SET THE CONTRAST
LCALL WRCMD ;
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; This is where the program ends and the added on bitmaps
; begin.
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
BEGIN: MOV 34H,#0B7H ;SETS LOWER STACK DATA
MOV 35H,#002H ;SETS HIGHER STACK DATA
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; This is the main program that calls the other subroutines
; that clock in all the signals.
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
MOV B,#0EH ;STORES FOR 14 PICTURE TO BE VIEWED
LOOP: PUSH B
LCALL CLEAR ;CLEAR THE DISPLAY
LCALL PAINT ;GO OUT AND PAINT THE SCREEN WITH THE BITMAP
MOV B,#45H ;PAUSE FOR VIEWING
LCALL WAIT ;
POP B
DJNZ B,LOOP
LCALL CLEAR
MOV B,#10H
LCALL WAIT
LJMP BEGIN
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; The program below is for clocking in the bitmap stored in memory
; at the end of this code
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
PAINT: MOV B,#03EH
PAINT1: PUSH B
LCALL DATA_ARM ;GO GET DATA
POP B
DJNZ B,PAINT1 ;CONTINUE TO STRIP OFF 62 BITS OF NULL DATA
LCALL BODY
RET
BODY: MOV B,#64H ;STORE 100 COLUMNS
AJMP SKIP ;SKIP OVER INCREMENT
BODY1: INC 37H ;INCREMENT THE LOWER DATA STACK
LCALL NEWCLMN ;SEE IF THE LOWER 4 BITS ARE FULL
SKIP: PUSH B
MOV 36H,#0B0H ;SETS PAGE TO 1
LCALL POSITION ;GO STORE POSITION
LCALL DATA_ARM ;GO GET DATA
LCALL WRDATA ;CLOCK IN
MOV 36H,#0B1H ;SETS PAGE TO 2
LCALL POSITION ;GO STORE POSITION
LCALL DATA_ARM ;GO GET DATA
LCALL WRDATA ;CLOCK IN
MOV 36H,#0B2H ;SETS PAGE TO 3
LCALL POSITION ;GO STORE POSITION
LCALL DATA_ARM ;GO GET DATA
LCALL WRDATA ;CLOCK IN
MOV 36H,#0B3H ;SETS PAGE TO 4
LCALL POSITION ;GO STORE POSITION
LCALL DATA_ARM ;GO GET DATA
LCALL WRDATA ;CLOCK IN
MOV 36H,#0B4H ;SETS PAGE TO 5
LCALL POSITION ;GO STORE POSITION
LCALL DATA_ARM ;GO GET DATA
LCALL WRDATA ;CLOCK IN
MOV 36H,#0B5H ;SETS PAGE TO 6
LCALL POSITION ;GO STORE POSITION
LCALL DATA_ARM ;GO GET DATA
LCALL WRDATA ;CLOCK IN
MOV 36H,#0B6H ;SETS PAGE TO 7
LCALL POSITION ;GO STORE POSITION
LCALL DATA_ARM ;GO GET DATA
LCALL WRDATA ;CLOCK IN
MOV 36H,#0B7H ;SETS PAGE TO 8
LCALL POSITION ;GO STORE POSITION
LCALL DATA_ARM ;GO GET DATA
LCALL WRDATA ;CLOCK IN
POP B
DJNZ B,BODY1
RET
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; Sets the cursor to the display for what line is being
; scanned in.
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
POSITION: MOV B,36H ;RECALL PAGE #
LCALL WRCMD ;CLOCK IN
MOV B,37H ;RECALL LOWER COLUMN DATA
LCALL WRCMD ;CLOCK IN
MOV B,38H ;RECALL HIGHER COLUMN DATA
LCALL WRCMD ;CLOCK IN
RET ;
NEWCLMN: MOV A,37H ;SEE LOWER 4 BITS
CJNE A,#10H,CLMNOUT ;IF OVER 4 BITS
MOV 37H,#00H ;THEN RESET LOWER 4 BITS
INC 38H ;AND BUMP UP THE UPPER 4
CLMNOUT: RET
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; This program looks to upper program memory where bitmaps are
; stored and recalls them for higher subroutines
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
DATA_ARM: MOV 82H,34H ;MOV LOWER DATA POINTER ON THE STACK
MOV 83H,35H ;MOV HIGHER DATA POINTER ON THE STACK
MOV A,#00H ;CLEAR OUT REGISTER FOR TRUE DATA POINTER
MOVC A,@A+DPTR ;GET THE DATA POINTED TO BY THE DATA POINTER
MOV B,A ;SWAP
INC DPTR ;INCREMENT THE DATA POINTER
MOV 34H,82H ;RESTORE LOWER DATA
MOV 35H,83H ;RESTORE HIGHER DATA
XRL B,#0FFH ;SWAP THE HIGHS WITH THE LOWS
LCALL RESTACK ;SWAP D0 TO D7, D1 TO D6, D2 TO D5, ETC
RET ;
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; The rest of these programs are simple routines that are
; used by the main program to clear the display, send
; commands, etc.
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
DELAY: PUSH B ;STORE OUTER LOOP
DELAY2: MOV A,#01FH ;SETUP FOR INNER LOOP
DELAY1: DEC A
JNZ DELAY1 ;INNER LOOP UNTIL ZERO
POP B
DEC B
PUSH B
MOV A,B
JNZ DELAY2 ;OUTER LOOP UNTIL ZERO
POP B
RET
WAIT: PUSH B ;STORE OUTER LOOP
WAIT1: MOV B,#0FFH ;SETUP FOR INNER LOOP
LCALL DELAY ;"DELAY" DOES INNER LOOP
POP B
DEC B
PUSH B
MOV A,B
JNZ WAIT1 ;OUTER LOOP UNTIL ZERO
POP B
LCALL PAUSE ;SEE IF PAUSE SWITCH IS SELECTED
RET
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; This is a subroutine that is needed for the graphics
; write command only in Densitron software. All Densitron
; graphical pictures for LCDs are originally written for
; the Hitachi HD61830 Chip set. So this subroutine is
; just a conversion from the Hitachi chip to the Toshiba. The
; differences is that in bit mapping to the Hitachi HD61830,
; you write it like D0,D1,D2,D3,D4,D5,D6,D7 and the Toshiba
; T6963 you write it like D7,D6,D5,D4,D3,D2,D1,D0. So it
; is merely swaping the MSB with the LSB.
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
RESTACK: MOV A,B
RL A
MOV B,A
PUSH B ;STORE THE DATA
ANL A,#11H ;STRIP OFF D3 AND D7
MOV 40H,A ;STORE D3 AND D7
POP B ;
MOV A,B
RL A ;ROTATE LEFT
RL A ;ROTATE LEFT
MOV B,A
PUSH B ;
ANL A,#22H ;STRIP OFF D2 AND D6
MOV 41H,A ;STORE D2 AND D6
POP B ;
MOV A,B
RL A ;ROTATE LEFT
RL A ;ROTATE LEFT
MOV B,A
PUSH B ;
ANL A,#44H ;STRIP OFF D1 AND D5
MOV 42H,A ;STORE D1 AND D5
POP B ;
MOV A,B
RL A ;ROTATE LEFT
RL A ;ROTATE LEFT
ANL A,#88H ;STRIP OFF D0 AND D4
ORL A,42H ;MIX IN D1 AND D5
ORL A,41H ;MIX IN D2 AND D6
ORL A,40H ;MIX IN D3 AND D7
MOV B,A
RET
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; The programs listed below are what clocks in the signals,
; both for data and commands
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
WRDATA: MOV 090H,B ;PUTS DATA ON PORT ONE
MOV 0C0H,#071H ;SETS RD/WR LOW AND A0 LOW
MOV 0C0H,#075H ;STROBE ENABLE HIGH
MOV 0C0H,#071H ;STROBE ENABLE LOW
RET ;RETURN
WRCMD: MOV 090H,B ;PUTS COMMAND ON PORT ONE
MOV 0C0H,#070H ;SETS RD/WR LOW AND A0 HIGH
MOV 0C0H,#074H ;STROBE ENABLE HIGH
MOV 0C0H,#070H ;STROBE ENABLE LOW
RET ;RETURN
RDSTATUS: MOV 090H,#0FFH
MOV 0C0H,#072H
MOV 0C0H,#076H
MOV B,090H
MOV 0C0H,#072H
RET
PAUSE: MOV 0F8H,#0FFH ;SET PORT 4 AS AN INPUT
PAUSE1: MOV B,0F8H
ANL B,#80H ;STRIP OFF THE HIGHEST BIT
MOV A,B
CJNE A,#80H,PAUSE1 ;IF THE PAUSE SWITCH IS SET THEN LOOP
RET
CLEAR: MOV 36H,#0B0H ;STORE THE PAGE #
MOV 37H,#001H ;STORE THE LOWER 4 BITS OF THE COLUMN
MOV 38H,#012H ;STORE THE HIGHER 4 BITS OF THE COLUMN
LCALL POSITION ;SET UP THE POSITION
MOV B,#064H ;SET UP OUTER LOOP
CLEAR1: PUSH B ;
MOV B,#000H ;SEND NULL DATA
LCALL WRDATA ;CLOCK IN
POP B
DJNZ B,CLEAR1 ;LOOP UNTIL ALL ARE ZERO
MOV 36H,#0B1H ;MOVE TO PAGE 2
LCALL POSITION ;SET UP THE POSITION
MOV B,#64H ;SET UP OUTER LOOP
CLEAR2: PUSH B
MOV B,#000H ;SEND NULL DATA
LCALL WRDATA ;CLOCK IN
POP B
DJNZ B,CLEAR2 ;LOOP UNTIL ALL ARE ZERO
MOV 36H,#0B2H ;MOVE TO PAGE 3
LCALL POSITION ;SET UP THE POSITION
MOV B,#64H ;SET UP OUTER LOOP
CLEAR3: PUSH B
MOV B,#000H ;SEND NULL DATA
LCALL WRDATA ;CLOCK IN
POP B
DJNZ B,CLEAR3 ;LOOP UNTIL ALL ARE ZERO
MOV 36H,#0B3H ;MOVE TO PAGE 4
LCALL POSITION ;SET UP THE POSITION
MOV B,#64H ;SET UP OUTER LOOP
CLEAR4: PUSH B
MOV B,#000H ;SEND NULL DATA
LCALL WRDATA ;CLOCK IN
POP B
DJNZ B,CLEAR4 ;LOOP UNTIL ALL ARE ZERO
MOV 36H,#0B4H ;MOVE TO PAGE 8
LCALL POSITION ;SET UP THE POSITION
MOV B,#64H ;SET UP OUTER LOOP
CLEAR5: PUSH B
MOV B,#000H ;SEND NULL DATA
LCALL WRDATA ;CLOCK IN
POP B
DJNZ B,CLEAR5 ;LOOP UNTIL ALL ARE ZERO
MOV 36H,#0B5H ;MOVE TO PAGE 8
LCALL POSITION ;SET UP THE POSITION
MOV B,#64H ;SET UP OUTER LOOP
CLEAR6: PUSH B
MOV B,#000H ;SEND NULL DATA
LCALL WRDATA ;CLOCK IN
POP B
DJNZ B,CLEAR6 ;LOOP UNTIL ALL ARE ZERO
MOV 36H,#0B6H ;MOVE TO PAGE 8
LCALL POSITION ;SET UP THE POSITION
MOV B,#64H ;SET UP OUTER LOOP
CLEAR7: PUSH B
MOV B,#000H ;SEND NULL DATA
LCALL WRDATA ;CLOCK IN
POP B
DJNZ B,CLEAR7 ;LOOP UNTIL ALL ARE ZERO
MOV 36H,#0B7H ;MOVE TO PAGE 8
LCALL POSITION ;SET UP THE POSITION
MOV B,#64H ;SET UP OUTER LOOP
CLEAR8: PUSH B
MOV B,#000H ;SEND NULL DATA
LCALL WRDATA ;CLOCK IN
POP B
DJNZ B,CLEAR8 ;LOOP UNTIL ALL ARE ZERO
RET
CONTRAST: MOV A,#080H
MOV B,A
CONT: PUSH B
LCALL WRCMD
MOV B,#03H
LCALL WAIT
POP B
MOV A,B
INC A
MOV B,A
CJNE A,#0A0H,CONT
RET
.END