Continue to Site

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.

[SOLVED] how to produce beep using assembly in 8086??

Status
Not open for further replies.

ramii

Newbie level 3
Joined
Jun 17, 2010
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
khi
Activity points
1,305
can anyone plz help!!!
i m working on a project..n i want to generate a beep sound using assembly language in 8086 prtocessor. i have tried to do so by using ASCII code for bell but volume of sound generated was v low so please is there any other way to produce sound


ramii
 

if the assembly program uses system speaker , which is a buzzer in current PCs ,
the sound will be apparently low ,

if you use a short duration .

increase your duration of tone to 2 or3 secs .

srizbf
8/7
 

Hi,

If you generate the sound by printing a BEL character (using DOS or BIOS), the sound duration and pitch will usually depend on the code in the BIOS INT 10h handler (which also gets invoked by DOS INT 21h, I think) unless you write your own INT 10h routine.

It's possible to directly write to I/O ports to turn the speaker on and off (port 61h) and to control the frequency of the sound (ports 42h and 43h of the programmable interval timer).
http://www.cs.binghamton.edu/~reckert/220/8254_timer.html
**broken link removed**

I'll post some source code as soon as possible.
Code:
	STARTSOUND:	;CX=FREQUENCY IN HERTZ. DESTROYS AX & DX
CMP CX, 014H
JB STARTSOUND_DONE
;CALL STOPSOUND
IN AL, 061H
;AND AL, 0FEH
;OR AL, 002H
OR AL, 003H
DEC AX
OUT 061H, AL	;TURN AND GATE ON; TURN TIMER OFF
MOV DX, 00012H	;HIGH WORD OF 1193180
MOV AX, 034DCH	;LOW WORD OF 1193180
DIV CX
MOV DX, AX
MOV AL, 0B6H
PUSHF
CLI	;!!!
OUT 043H, AL
MOV AL, DL
OUT 042H, AL
MOV AL, DH
OUT 042H, AL
POPF
IN AL, 061H
OR AL, 003H
OUT 061H, AL
	STARTSOUND_DONE:
RET

	STOPSOUND:	;DESTROYS AL
IN AL, 061H
AND AL, 0FCH
OUT 061H, AL
RET
For timing you can use BIOS INT 15h routines AH=86h and AH=83h.
**broken link removed**
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top