ZX Pilot #42
09 декабря 2005

Coding - how to use a computer to control mosquitoes (mosquito deterrent program).

<b>Coding</b> - how to use a computer to control mosquitoes (mosquito deterrent program).
               C O D I N G



(C) Ivan Roshchin



          Tell vampires "No!"



        The fan needs to suck

                   mosquitoes through the drive.


                        Folk wisdom.


   Yes, yes, it will be exactly how
use a computer to deal with these
bloodsucking creatures - though not so
cruel way, as in the epigraph. :)
I read recently an interesting note [1]
about how one music radio station
adds to its broadcast audio
signal mosquito deterrent. There
mentioned that the frequency of this signal
12.3 kHz. And I decided to try
generate such a signal by
his ZX Spectrum.

   Here is the first version of the procedure: the signal
played through the loudspeaker.

; When the CPU clock 3.5 MHz
, One period is, 3.5 * 10 ^ 6 / 12, 3 * 10 ^ 3
, ~ = 285 cycles (a precise, the value 284.55).
; Let the duration of one
; Halftime to 142 cycles,: and others -
, 143.


     DI

M1 LD B, 8, 7

     DJNZ $; 7 * 13 +8 = 99

     INC HL; 6 130 +12 = 142

     LD A, 16; 7

     OUT (254), A; 11


     LD B, 9, 7

     DJNZ $; 8 * 13 +8 = 112

     INC HL; 6143

     LD A, 0, 7

     OUT (254), A; 11


     JR M1; 12


   But the second option: to generate
signal is used musical
coprocessor.

CHAN EQU 0; Using. Channel :0-A, 1-B, 2-C.
VOL EQU 15; Volume (0-15).


     LD HL, # FFBF

     LD C, # FD

; When clocked at 1.75 Coprocessor
; MHz frequency divider value must tone
; Be equal to 1.75 * 10 ^ 6 / (12.3 * 10 ^ 3 * 16) ~ = 9
, (The exact value of 8.89). Taking it in
; Registers tone frequency:


     LD B, H

     LD A, CHAN * 2

     OUT (C), A

     LD B, L

     LD A, 9

     OUT (C), A


     LD B, H

     LD A, CHAN * 2 +1

     OUT (C), A

     LD B, L

     XOR A

     OUT (C), A

And includes the output tone frequency:


     LD B, H

     LD A, 7

     OUT (C), A

     LD B, L

     LD A, # FF

     RES CHAN, A

     OUT (C), A

; Setting the volume:


     LD B, H

     LD A, 8 + CHAN

     OUT (C), A

     LD B, L

     LD A, VOL

     OUT (C), A


     RET


   Since music coprocessor
operates independently of the main
processor, by executing this procedure,
You can continue to work with programs
do not address the coprocessor, and no sound
will be interrupted.

   Both procedures form the signal
simple rectangular shape. But the form
the original signal is much more complex: how
mentioned in [1], it takes 1 Mb
format Real Audio. Therefore, useful
the effect of using these procedures
may be lower than expected. Interesting
it would be if someone would share his
results: it helps or not?


Fido: 2:5020 / 689.53
ZXNet: 500:95 / 462.53
E-mail: asder_ffc@softhome.net
WWW: http://www.ivr.da.ru




Other articles:

Credits - the creators of the newspaper.

News - the newspaper that's news.

Our Guest - Memoirs spektrumista from Dzerzhinsk - Nuts.

about different - Nuts Thoughts on System Software for Spectrum.

about different - Arhon discusses the causes of decay geymdeva on the Spectrum.

Topic - one of the last open letters Nemo (Reply SirX'u).

Topic - NEMO deserving of respect? But who is this NEMO?

Topic - Nemo just an ordinary ham, not respecting anyone! Or he was framed?

Coding - how to use a computer to control mosquitoes (mosquito deterrent program).

Novella - Open Day.

Comics - Report from the booze Vel'a.

Post scriptum - a story about the plight of the issue of the newspaper.

Advertising - advertising and announcements.


Темы: Игры, Программное обеспечение, Пресса, Аппаратное обеспечение, Сеть, Демосцена, Люди, Программирование

Similar articles:
Advertising - advertising and announcements.
animated cartoon - Description of a new turbo-assembler from STORM X-Trade.

В этот день...   21 November