Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

-urgent- Program MT8888 as tone generator

Status
Not open for further replies.

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,761
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
;----------
 
Last edited:

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,761
Re: -urgent- Program MT8888 as tone detector

why no one answered ....
please help me to activate the IRQ (pin 13 MT8888) as in Std (pin15 MT8870 ).... I am confused how to set up registers, because I've tried it only once active low ...
continues to be high next can not be low again

LED BIT P2.7 ;ACTIVE LOW
IRQ BIT P2.6
IN_HOOK BIT P2.3
RELAY BIT P2.2
RD_ BIT P2.5
RW_ BIT P2.0
RS0_ BIT P2.4
CS BIT P2.1
; B3 B2 B1 B0
MODE_BIASA EQU 01H ; TONE ENABLE
MODE_RIBET EQU 0DH ; RSEL IRQ ENABLE CP/DTMF TONE ENABLE ----ALL ACTIV
MODE_IRQ EQU 04H ; IRQ ENABLE TONE DISABLE
MODE_DIS EQU 0H ; IRQ DISABLE TONE DISABLE----
flagt bit 20h.1
org 0h
start:
acall delay50
acall delay50
mov p0,#0ffh
mov p3,#0h
mov p1,#0h
acall init8888
acall delay60
tone_as_input:
cek1: clr led
mov a,#mode_irq
acall write

cek:
clr rs0_
setb irq
jb irq,$
setb led
mov p0,#0fh
acall delay30
cjne a,#0fh,sok
sjmp cek1
sok: acall tone_det ;maca tone
hiji:
Cjne A,#01h,dua ;
acall read
mov p1,#01h
mov p0,#0fh
ajmp cek
dua: ;acall tone_det ;maca tone
Cjne A,#02h,tilu
;setb rd_
mov p1,#02h
mov p0,#0fh
ajmp cek
tilu: ;acall tone_det ;maca tone
Cjne A,#03h,opat
;setb rd_
mov p1,#03h
mov p0,#0fh
ajmp cek
opat: ;acall tone_det ;maca tone
Cjne A,#04h,lima
;setb rd_
mov p1,#04h
mov p0,#0fh
ajmp cek
lima: ; acall tone_det ;maca tone
Cjne A,#05h,geuneup
;setb rd_
mov p1,#05h
mov p0,#0fh
ajmp cek
geuneup: ;acall tone_det ;maca tone
Cjne A,#06h,tujuh
;setb rd_
mov p1,#06h
mov p0,#0fh
ajmp cek
tujuh: ;acall tone_det ;maca tone
Cjne A,#07h,dalapan
;setb rd_
;setb rd_
mov p1,#07h
mov p0,#0fh
ajmp cek
dalapan: ;acall tone_det ;maca tone
Cjne A,#08h,salapan
; setb rd_
mov p1,#08h
mov p0,#0fh
ajmp cek
salapan: ;acall tone_det ;maca tone
Cjne A,#09h,enol
;setb rd_
mov p1,#09h
mov p0,#0fh
ajmp cek
enol: ;acall tone_det ;maca tone
Cjne A,#0ah,bintang
;setb rd_
mov p1,#0ah
mov p0,#0fh
ajmp cek
bintang:; acall tone_det ;maca tone
Cjne A,#0bh,pageur
;setb rd_
mov p1,#0bh
mov p0,#0fh
ajmp cek
pageur: ;acall tone_det ;maca tone
Cjne A,#0ch,hurufa
;setb rd_
mov p1,#0ch
mov p0,#0fh
ajmp cek
hurufa: ;Cjne A,#0dh,hurufb
;setb rd_
mov p1,#0dh
mov p0,#0fh
ajmp cek
hurufb: ;acall tone_det ;maca tone
Cjne A,#0eh,huruf
;setb rd_
mov p1,#0eh
mov p0,#0fh
huruf: ajmp cek
;hurufc: Cjne A,#0fh,hurufd
; mov p1,#0fh
; ajmp cek
;hurufd: Cjne A,#0h,huruf
; mov p1,#0h
;huruf: ajmp cek
;-----------------DELAY--------------------------
;Long Delay
;----------
Delay: PUSH 06H
PUSH 07H
MOV R6,#0FFH
Del: MOV R7,#0FFH
DJNZ R7,$
DJNZ R6,Del
POP 07H
POP 06H
RET
;-----------
;Delay 60 ms
;-----------
;2
Delay60: MOV R3,#06DH ;1 (6DH=109)
Del60: MOV R2,#0FFH ;1 (FFH=255)
DJNZ R2,$ ;R3 x R2 x 2 = 55590
DJNZ R3,Del60 ;R3 x 2 = 218
RET ;2
;--------------------
;55814 x 1.0851e-6 = 60,56 ms
;----------
;Delay 40ms
;----------
;2
Delay40: MOV R3,#048H ;1 (48H= 72)
Del40: MOV R2,#0FFH ;1 (FFH=255)
DJNZ R2,$ ;R3 x R2 x 2 = 36720
DJNZ R3,Del40 ;R3 x 2 = 144
RET ;2
;--------------------
;36870 x 1.0851e-6 = 40,01 ms
;-----------
;Delay 1.4ms
;-----------
;2
Delay14: MOV R3,#6 ;1
Del14: MOV R2,#110 ;1
DJNZ R2,$ ;R3 x R2 x 2 = 1320
DJNZ R3,Del14 ;R3 x 2 = 12
RET ;2
;--------------------
;1338 x 1.0851e-6 = 1.452 ms
;----------------------
;2 second delay routine
;----------------------
;2
Delay2S: PUSH 05H ;2
PUSH 06H ;2
PUSH 07H ;2
MOV R5,#20 ;1
LDel2S_2: MOV R6,#200 ;1 x 20
LDel2S_1: MOV R7,#250 ;1 x 200
DJNZ R7,$ ;2 x 250 x 200 x 20
DJNZ R6,LDel2S_1 ;2 x 200 x 20
DJNZ R5,LDel2S_2 ;2 x 20
POP 07H ;2
POP 06H ;2
POP 05H ;2
RET ;2
;--------------------
;2008277uS = 2.001min
;------------------
;Delay 30ms routine
;------------------
Delay30: ;2
PUSH 06H ;2
PUSH 07H ;2
MOV R6,#148 ;1
Del30: MOV R7,#100 ;1 x 148
DJNZ R7,$ ;2 x 100 x 148
DJNZ R6,Del30 ;2 x 148
POP 07H ;2
POP 06H ;2
RET ;2
;--------------------
;30057us = 30,01ms
;------------------
;Delay 50ms
;------------------
Delay50: ;2
PUSH 06H ;2
PUSH 07H ;2
MOV R6,#150 ;1
Del50: MOV R7,#165 ;1 x 150
DJNZ R7,$ ;2 x 165 x 150
DJNZ R6,Del50 ;2 x 150
POP 07H ;2
POP 06H ;2
RET ;2
;--------------------
;49963 = 49,9ms
;-------------------------------------------------------------------
tone_det: ;tone as input
clr rs0_
clr rd_
setb rw_
mov a,p0
anl A,#0FH
ret
tone_gen: ;tone as output
clr rs0_
setb rd_
clr rw_
mov p0,a
ret
;

read:
setb rs0_
setb rw_
clr rd_
mov a,p0
;clr rs0_
ret
write:
setb rs0_
clr rw_
setb rd_
mov p0,a
;clr rs0_
ret

init8888: ;RS0 WR RD b3 b2 b1 b0
acall read ; 1 1 0 X X X X
mov a,#0h ; 1 0 1 0 0 0 0
acall write ;
mov a,#0h ; 1 0 1 0 0 0 0
acall write ;
mov a,#08h ; 1 0 1 1 0 0 0
acall write ;
mov a,#0h ; 1 0 1 0 0 0 0
acall write ;
acall read ; 1 1 0 X X X X
ret
END

where lies the error of my program???
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top