Music Box Assembler Language Design and Implementation Based

A needs analysis

Design a music box, birthday gifts, etc. can be used in such scenes.

Capabilities include playing music, change the music. The default play the first music, song cycle. When the toggle switch songs control switch, a total of three, are respectively controlled by three switches. When invalid and only when a switch is turned off the other switch is effective, a plurality of switches turned on simultaneously.

Requires that the selected plurality of modules or chips and a weighted sum value ≧ 2, and the selected chip or module must contain 8259 or 8254 chip as function blocks wherein a portion.

Two design ideas

Sound: By 8254 (8253) module, the third mode is set, the counter selection number 0, 00110110B, as a waveform generator. Control tone the frequency of the output waveform, the time maintained by the beat frequency waveform control. (1Mhz the clock signal frequency corresponds to the following scale: 1 = 247,2 = 277,3 = 311,4 = 399,5 = 370,6 = 415,7 = 466, a '= 494).

Control: the module 8255, is set to mode 0, A input port, 10010000B, as the controller. To select the song data by reading the A port input. Do comparison to each read data stored in the registers, and read to the next, to determine whether to switch. When switching, different bit states representing different switch songs, three music corresponding to a set 001B, 010B, 100B, respectively.

 

 

 

Guess you like

Origin blog.csdn.net/asdJJkk/article/details/93377241