//*******************************************************************
// 定音器子程序 mcu: 49r70
// 入口参数: 0~11;对应 A3,A3#,B,C,C#,D,D#,E,F,F#,G,G#
// 出口参数: 无
// 作用:使喇叭发声。PFD
// 用到定时器1。 Fsys = 1mhz;
// 为蜂鸣器输出电路。
// F T T/2
//A3 220 4545 2273 f71e
//A3#(B3b) 233.08186 4290 2145 f79e
//B3 246.9416066 4050 2025 f816
//C4 261.625775 3822 1911 f888
//C4#(D4b) 277.1828285 3608 1804 f8f3
//D4 293.664951 3405 1703 f958
//D4#(E4b) 311.12715 3214 1607 f9b8
//E4 329.6277037 3034 1517 fa12
//F4 349.2283558 2863 1432 fa67
//F4#(G4b) 369.9945216 2703 1351 fab8
//G4 391.9955058 2551 1276 fb03
//G4#(A4b) 415.3047346 2408 1204 fb4b
// Fsystem ---> timer1 溢出 --》PFD
//********************************************************************
const unsigned char Set_tmr1h[12]={0xf7,0xf7,0xf8,0xf8,0xf8,0xf9,0xf9,0xfa,0xfa,0xfa,0xfb,0xfb};
const unsigned char Set_tmr1l[12]={0x1f,0x9f,0x17,0x88,0xf3,0x58,0xb8,0x12,0x68,0xb9,0x04,0x4c};
void note (unsigned char i)
{
_tmr1h = Set_tmr1h;
_tmr1l = Set_tmr1l;
_tmr1c = 0x90;
_pa3 = 0;
}
//-------------------------------------------------------------------------------
文章评论(0条评论)
登录后参与讨论