Li_ereunpisan
Full Member level 5
- Joined
- Jul 14, 2009
- Messages
- 260
- Helped
- 32
- Reputation
- 64
- Reaction score
- 28
- Trophy points
- 1,308
- Location
- Bandung, Indonesia
- Activity points
- 2,768
Help me please ..............
I want to try the MT8888 as a tone generator, but I'm still confused registers control setting ....
under the program is intended to issue a regular tone tone numbers 1,2,3 ... 0 but in fact the release is not the case, even a random number (9,1,3,5,7,9, etc.) .. every single issue rate tone together many times ....
how to stop the tone and how to fix a program that I make this
;-----------------------------------------------------------------
RD_ BIT P3.2
RW_ BIT P3.0
RS0_ BIT P3.1
IRQ BIT P3.3 ;INT0
org 0h
start:
acall delay60
acall delay60
mov p3,#0h
mov p1,#0h
acall init8888
acall delay60
tone_as_output:
acall write_tone_on
acall tone_gen
Mov P0,#00000001B ; 1
Acall Delay60 ;
Mov P0,#00000010B ; 2
Acall Delay60 ;
Mov P0,#00000011B ;3
Acall Delay60
Mov P0,#00000100B ;4
Acall Delay60
Mov P0,#00000101B ;5
Acall Delay60
Mov P0,#00000110B ;6
Acall Delay60
Mov P0,#00000111B ; 7
Acall Delay60 ;
Mov P0,#00001000B ;8
Acall Delay60 ;
Mov P0,#00001001B ; 9
Acall Delay60
Mov P0,#00001010B ;0
Acall Delay60
acall write_tone_off
sjmp tone_as_output
;-----------
;Delay 60 ms
;-----------
Delay60: MOV R3,#06DH
Del60: MOV R2,#0FFH
DJNZ R2,$
DJNZ R3,Del60
RET
tone_det: ;tone as input
clr rs0_
clr rd_
setb rw_
ret
tone_gen: ;tone as output
clr rs0_
clr rw_
setb rd_
ret
read:
setb rs0_
setb rw_
clr rd_
ret
write:
setb rs0_
clr rw_
setb rd_
ret
write_tone_off:
setb rs0_
clr rw_
setb rd_
mov p0,#05h
ret
write_tone_on:
setb rs0_
clr rw_
setb rd_
mov p0,#0dh
ret
init8888:
acall read
mov p0,#0h
acall write
mov p0,#0h
acall write
mov p0,#08h
acall write
mov p0,#0h
acall write
acall read
ret
END
;----------
I want to try the MT8888 as a tone generator, but I'm still confused registers control setting ....
under the program is intended to issue a regular tone tone numbers 1,2,3 ... 0 but in fact the release is not the case, even a random number (9,1,3,5,7,9, etc.) .. every single issue rate tone together many times ....
how to stop the tone and how to fix a program that I make this
;-----------------------------------------------------------------
RD_ BIT P3.2
RW_ BIT P3.0
RS0_ BIT P3.1
IRQ BIT P3.3 ;INT0
org 0h
start:
acall delay60
acall delay60
mov p3,#0h
mov p1,#0h
acall init8888
acall delay60
tone_as_output:
acall write_tone_on
acall tone_gen
Mov P0,#00000001B ; 1
Acall Delay60 ;
Mov P0,#00000010B ; 2
Acall Delay60 ;
Mov P0,#00000011B ;3
Acall Delay60
Mov P0,#00000100B ;4
Acall Delay60
Mov P0,#00000101B ;5
Acall Delay60
Mov P0,#00000110B ;6
Acall Delay60
Mov P0,#00000111B ; 7
Acall Delay60 ;
Mov P0,#00001000B ;8
Acall Delay60 ;
Mov P0,#00001001B ; 9
Acall Delay60
Mov P0,#00001010B ;0
Acall Delay60
acall write_tone_off
sjmp tone_as_output
;-----------
;Delay 60 ms
;-----------
Delay60: MOV R3,#06DH
Del60: MOV R2,#0FFH
DJNZ R2,$
DJNZ R3,Del60
RET
tone_det: ;tone as input
clr rs0_
clr rd_
setb rw_
ret
tone_gen: ;tone as output
clr rs0_
clr rw_
setb rd_
ret
read:
setb rs0_
setb rw_
clr rd_
ret
write:
setb rs0_
clr rw_
setb rd_
ret
write_tone_off:
setb rs0_
clr rw_
setb rd_
mov p0,#05h
ret
write_tone_on:
setb rs0_
clr rw_
setb rd_
mov p0,#0dh
ret
init8888:
acall read
mov p0,#0h
acall write
mov p0,#0h
acall write
mov p0,#08h
acall write
mov p0,#0h
acall write
acall read
ret
END
;----------
Last edited: