embedded - generate sound in assembly for IC 2051 -



embedded - generate sound in assembly for IC 2051 -

1) iphone developer need little work on assembly, have code in assembly language generate sound (suppose beep sound)

2) have convert .asm file .hex file , write programming ic 2051 after have connect hardware (i have) generate sound

i stuck first part, help highly appreciated stuck in since weeks

following sample code

section .text global _start ;must declared using gcc _start: ;tell linker entry point mov edx, len ;message length mov ecx, msg ;message write mov ebx, 1 ;file descriptor (stdout) mov eax, 4 ;system phone call number (sys_write) int 0x80 ;call kernel mov eax, 1 ;system phone call number (sys_exit) int 0x80 ;call kernel section .data mov dx,2000 ; number of times repeat whole routine. mov bx,1 ; frequency value. mov al, 10110110b ; magic number (use binary number only) out 43h, al ; send initializing port 43h timer 2. next_frequency: ; jump 2000 times. mov ax, bx ; move our frequency value ax. out 42h, al ; send lsb port 42h. mov al, ah ; move msb al out 42h, al ; send msb port 42h. in al, 61h ; current value of port 61h. or al, 00000011b ; or al value, forcing first 2 bits high. out 61h, al ; re-create port 61h of ppi chip ; turn on speaker. mov cx, 100 ; repeat loop 100 times delay_loop: ; here loop too. loop delay_loop ; jump repeatedly delay_loop until cx = 0 inc bx ; incrementing value of bx lowers ; frequency each time repeat ; whole routine dec dx ; decrement repeat routine count cmp dx, 0 ; dx (repeat count) = 0 jnz next_frequency ; if not jump next_frequency ; , whole routine again. ; else dx = 0 time turn speaker off in al,61h ; current value of port 61h. , al,11111100b ; , al value, forcing first 2 bits low. out 61h,al ; re-create port 61h of ppi chip ; turn off speaker.

read more: http://www.intel-assembler.it/portale/5/make-sound-from-the-speaker-in-assembly/8255-8255-8284-asm-program-example.asp#ixzz3fnk0e1u2

the link posted x86 hardware , 8255 ppi - neither of of involvement given hardware. "sample code" of little utilize illustration of how on hardware, different instruction set, , different hardware. rough , in cpu terns expensive method of generating sound in case.

your chip has 2 16 bit timer/counters can each drive pin straight - don't need assembler; utilize high-level language (c beingness platform). either way, can programme 1 timer output signal @ desired frequency 0 software overhead while running, stop timer after desired period (for might utilize sec timer/counter).

if have utilize assembler, first need larn 8051 instruction set, there minor syntax , directive differences depending on assembler/linker tool-chain using. secondly need familiarity hardware specification part , board , know how speaker connected , driven.

essentially have chosen start wrong place using irrelevant info starting point.

[edit]

i not familiar at89c2051 , long time since used mcs-51 of kind, using hardware pwm may not possible, in case can toggle gpio pin in timer interrupt described in assembler , c examples here. either way, these examples far closer need trying use!

assembly embedded 8051

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -