Compiling environment: Keil C51 v3
Simulation Software: Proteus 7.4
Single-Chip Microcomputer type:
Resistance Type: res
Speaker type: Speaker
Audio Amplifier: lm386
Capacitor type: avx1206np010p
Single-Chip MicrocomputerProgram:
<Textarea Cols = "50" rows = "15" name = "code" class = "CPP"> # include <reg52.h> </P> <p> char code table [] = {0x3f, 0x06, 0x5b, 0x4f, 0x66, <br/> 0x6d, 0x7d, 0x07, 0x7f, 0x6f }; </P> <p> bit flag; <br/> unsigned char tcount; <br/> sbit sound_ OK = p1 ^ 0; </P> <p> void main () <br/>{< br/> tmod = 0x02; // Timer/Counter working mode: 16-bit Timer/Counter </P> <p> // load the predefined initial value to the Timer/Counter t0 <br/> th0 = (65535-60000) /256; <br/> tl0 = (65535-60000)/256; </P> <p> tr0 = 1; // set the timer/Counter t0 to the timer Status <br/> et0 = 1; // enable the et0 interrupt timer to allow flag <br/> Ea = 1; // enable CPU interruption flag </P> <p> tcount = 0; </P> <p> while (1) <br/>{}</P> <p >}</P> <p> void t0_interrupt_function (void) interrupt 1 <br/>{< br/> tcount = tcount + 1; </P> <p> If (tcount> = 8) <br/> {<br/> tcount = 0; <br/> flag = ~ Flag; <br/>}</P> <p> If (flag = 0) <br/> {<br/> sound_ OK = ~ Sound_ OK; <br/>}</P> <p >}</textarea>
Core Circuit diagram: