Program
Program
mov sp,#40h
mov r3,#00h
mov r4,#00h
mov a,#'I'
lcall display
lcall DELAY
mov a,#'N'
lcall display
lcall DELAY
mov a,#'E'
lcall display
lcall DELAY
mov a,#'W'
lcall display
lcall DELAY
mov a,#'A'
lcall display
lcall DELAY
mov a,#'V'
lcall display
lcall DELAY
mov a,#'E'
lcall display
lcall DELAY
mov a,#0C0h ; shift cursor to second line
lcall command
lcall DELAY
mov a,#'0'
lcall display
lcall DELAY
mov a,#'H'
lcall display
lcall DELAY
mov a,#'z'
lcall display
lcall DELAY
mov a,#0C0h
lcall command
lcall DELAY
M0:mov a,#' ' ;to blank first line
lcall display
lcall DELAY
djnz b,M0
L19:mov a,#0C0h
lcall command
lcall DELAY
mov a,#'5'
lcall display
lcall DELAY
mov a,#'0'
lcall display
lcall DELAY
mov a,#'H'
lcall display
lcall DELAY
mov a,#'z'
lcall display
lcall DELAY
lcall DELAY_01S
lcall CHECK1
dec r7
cjne r7,#00h,L21
ljmp GENERATE
L21:mov a,#0C0h
lcall command
lcall DELAY
mov b,#06h
mov a,#'1'
lcall display
lcall DELAY
mov a,#'0'
lcall display
lcall DELAY
mov a,#'0'
lcall display
lcall DELAY
mov a,#'H'
lcall display
lcall DELAY
mov a,#'z'
lcall display
lcall DELAY
lcall DELAY_01S
lcall CHECK1
dec r7
cjne r7,#00h,L25
ljmp GENERATE
L25:mov a,#0C0h
lcall command
lcall DELAY
mov b,#06h
L26:mov a,#' '
lcall display
lcall DELAY
djnz b,L26
lcall DELAY_01S
ljmp L23
mov a,#'2'
lcall display
lcall DELAY
mov a,#'5'
lcall display
lcall DELAY
mov a,#'0'
lcall display
lcall DELAY
mov a,#'H'
lcall display
lcall DELAY
mov a,#'z'
lcall display
lcall DELAY
lcall DELAY_01S
lcall CHECK1
dec r7
cjne r7,#00h,L29
ljmp GENERATE
L29:mov a,#0C0h
lcall command
lcall DELAY
mov b,#06h
mov a,#'5'
lcall display
lcall DELAY
mov a,#'0'
lcall display
lcall DELAY
mov a,#'0'
lcall display
lcall DELAY
mov a,#'H'
lcall display
lcall DELAY
mov a,#'z'
lcall display
lcall DELAY
lcall DELAY_01S
lcall CHECK1
dec r7
cjne r7,#00h,L33
ljmp GENERATE
L33:mov a,#0C0h
lcall command
lcall DELAY
mov b,#06h
mov a,#80h
lcall command
lcall DELAY
L35:mov a,#80h
lcall command
lcall DELAY
mov a,#'S'
lcall display
lcall DELAY
mov a,#'I'
lcall display
lcall DELAY
mov a,#'N'
lcall display
lcall DELAY
mov a,#'E'
lcall display
lcall DELAY
mov a,#'W'
lcall display
lcall DELAY
mov a,#'A'
lcall display
lcall DELAY
mov a,#'V'
lcall display
lcall DELAY
mov a,#'E'
lcall display
lcall DELAY
lcall CHECK2
dec r7
cjne r7,#00h,L37
ljmp GENERATE
L37:mov a,#80h
lcall command
lcall DELAY
mov b,#09h
mov a,#80h
lcall command
lcall DELAY
L39:mov a,#80h
lcall command
lcall DELAY
mov a,#'S'
lcall display
lcall DELAY
mov a,#'A'
lcall display
lcall DELAY
mov a,#'W'
lcall display
lcall DELAY
mov a,#'T'
lcall display
lcall DELAY
mov a,#'O'
lcall display
lcall DELAY
mov a,#'O'
lcall display
lcall DELAY
mov a,#'T'
lcall display
lcall DELAY
mov a,#'H'
lcall display
lcall DELAY
mov a,#'W'
lcall display
lcall DELAY
mov a,#'A'
lcall display
lcall DELAY
mov a,#'V'
lcall display
lcall DELAY
mov a,#'E'
lcall display
lcall DELAY
lcall CHECK2
dec r7
cjne r7,#00h,L41
ljmp GENERATE
L41:mov a,#80h
lcall command
lcall DELAY
mov b,#14
L43:mov a,#80h
lcall command
lcall DELAY
mov a,#'T'
lcall display
lcall DELAY
mov a,#'R'
lcall display
lcall DELAY
mov a,#'I'
lcall display
lcall DELAY
mov a,#'A'
lcall display
lcall DELAY
mov a,#'N'
lcall display
lcall DELAY
mov a,#'G'
lcall display
lcall DELAY
mov a,#'U'
lcall display
lcall DELAY
mov a,#'L'
lcall display
lcall DELAY
mov a,#'A'
lcall display
lcall DELAY
mov a,#'R'
lcall display
lcall DELAY
mov a,#'W'
lcall display
lcall DELAY
mov a,#'A'
lcall display
lcall DELAY
mov a,#'V'
lcall display
lcall DELAY
mov a,#'E'
lcall display
lcall DELAY
lcall CHECK2
dec r7
cjne r7,#00h,L45
ljmp GENERATE
L45:mov a,#80h
lcall command
lcall DELAY
mov b,#15
mov a,#80h
lcall command
lcall DELAY
L47:mov a,#80h
lcall command
lcall DELAY
mov a,#'S'
lcall display
lcall DELAY
mov a,#'Q'
lcall display
lcall DELAY
mov a,#'U'
lcall display
lcall DELAY
mov a,#'R'
lcall display
lcall DELAY
mov a,#'E'
lcall display
lcall DELAY
mov a,#'W'
lcall display
lcall DELAY
mov a,#'A'
lcall display
lcall DELAY
mov a,#'V'
lcall display
lcall DELAY
mov a,#'E'
lcall display
lcall DELAY
lcall CHECK2
dec r7
cjne r7,#00h,L49
ljmp GENERATE
L49:mov a,#80h
lcall command
lcall DELAY
mov b,#10
L51:cjne r4,#00h,NEXT26
ljmp SINE_50
NEXT26:cjne r4,#01h,NEXT27
ljmp SINE_100
NEXT27:cjne r4,#02h,NEXT28
ljmp SINE_250
NEXT28:ljmp SINE_500
L52:cjne r4,#00h,NEXT29
ljmp SAWTOOTH_50
NEXT29:cjne r4,#01h,NEXT30
ljmp SAWTOOTH_100
NEXT30:cjne r4,#02h,NEXT31
ljmp SAWTOOTH_250
NEXT31:ljmp SAWTOOTH_500
L53:cjne r4,#00h,NEXT32
ljmp TRIANGULAR_50
NEXT32:cjne r4,#01h,NEXT33
ljmp TRIANGULAR_100
NEXT33:cjne r4,#02h,NEXT34
ljmp TRIANGULAR_250
NEXT34:ljmp TRIANGULAR_500
L54:cjne r4,#00h,NEXT35
ljmp SQURE_50
NEXT35:cjne r4,#01h,NEXT36
ljmp SQURE_100
NEXT36:cjne r4,#02h,NEXT37
ljmp SQURE_250
NEXT37:ljmp SQURE_500
WAVE_CHECK:cjne r3,#00h,NEXT1
ljmp WAVE_SINEB
NEXT1:cjne r3,#01h,NEXT2
ljmp WAVE_SAWTOOTHB
NEXT2:cjne r3,#02h,NEXT3
ljmp WAVE_TRIANGULARB
NEXT3:ljmp WAVE_SQUREB
FREQ_CHECK:cjne r4,#00h,NEXT4
ljmp FREQ_50B
NEXT4:cjne r4,#01h,NEXT5
ljmp FREQ_100B
NEXT5:cjne r4,#02h,NEXT6
ljmp FREQ_250B
NEXT6:ljmp FREQ_500B
CHECK_GLOBLE:mov p0,#0ffh
mov a,p0
cjne a,#0f7h,NEXT7 ; first key pressed freq check
ljmp FREQ_CHECK
NEXT7:cjne a,#0fbh,NEXT8 ; second key pressed w/f check
ljmp WAVE_CHECK
NEXT8:ret
command:
lcall ready ; Write when display not busy
mov p1,a ; Command character in P1
clr p3.5 ; Command resister chosen
clr p3.3 ; Write enabled
setb p3.4 ; Strobe character to display
clr p3.4
ret
ready:
clr p3.4 ; Display disabled
mov p1,#0ffh ; Configure P1 for input
clr p3.5 ; Select command register
setb p3.3 ; Read enabled
wait:
clr p3.4 ; Strobe display
setb p3.4 ; Read busy status of display
jb p1.7,wait ; Wait for not busy (BF = 0)
clr p3.4 ; End display strobe
ret
display:
lcall ready ; Write when display ready
mov P1,a ; Data character in P1
setb p3.5 ; Data resister chosen
clr p3.3 ; write enabled
setb p3.4 ; Strobe character to display
clr P3.4
ret
DELAY_20MS:mov r1,#40
A1:mov r0,#250
djnz r0,$
djnz r1,A1
ret
SINE_TABLE:db
127,131,135,139,143,147,151,154,159,163,167,170,174,178,181,185,189,192,196,199,202
,205,209,212,215,218,220,223,226,228,231,233,235,237,239,241,243,244,246,247,249,25
0,251,252,253,253,254,254,255,255,255
db
255,255,254,254,253,253,252,251,250,249,247,246,244,243,241,239,237,235,233,231,228
,226,223,220,218,215,212,209,205,202,199,196,192,189,185,181,178,174,170,167,163,15
9,154,151,147,143,139,135,131,127
db
123,119,115,111,107,103,100,95,91,87,84,80,76,73,69,65,62,58,55,52,49,45,42,39,36,3
4,31,28,26,23,21,19,17,15,13,11,10,8,7,5,4,3,2,1,1,1,0,0,0,0
db
0,0,0,0,1,1,1,2,3,4,5,7,8,10,11,13,15,17,19,21,23,26,28,31,34,36,39,42,45,49,52,55,
58,62,65,69,73,76,80,84,87,91,95,100,103,107,111,115,119,123
end