资源描述:
《用c51写的单片机音乐彩灯程序》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、用C51写的单片机音乐彩灯程序^include#defineTLEDS20//每个花样状态持续时间,以50mS为单位^defineNUM_0F_LED_S4//每种模式LED花样数砸?typedefunsignedcharuchar;typedefunsignedintuint;datauchar1ed_array_num;//当前模式下,LED花样状态序号dataucharniusic_3rr3y_nuni;//音符的序号datauchari;〃模式号datauchartcountled;//用于LED状态持续时间计时datauintt_countm
2、usic;//datauintt_yinfu;//咅符持续时间ucharcodeled_array_pO[4][NUM_OF_LED_S]={{OxcO,OxcO,OxcO,OxcO},{0x38,0x38,0x38,0x38},{0x05,0x07,0x02,0x07?,{Oxff,0x81,Oxff,Oxff}};ucharcodeled_array_p2[4][NUM_OF_LED_S]={{0x07,OxOb,OxOd,0x0e},{0x07,0x09,OxOe,0x00},{0x06,0x09,0x06,0x00},{0x07,0x09,0x0c,0x00}};u
3、charcodemusic_array_h[4][128]={{Oxfc,Oxfc,Oxfc,Oxfd,Oxfd,Oxfd,Oxfd,Oxfd,Oxfd,Oxfd,Oxfd,Oxfe,Oxfd,Oxfd,Oxfd,Oxfd,Oxfd,Oxfd,Oxfd,Oxfd,Oxfd,Oxfc,Oxfc,Oxfc,Oxfc,Oxfc,Oxfd,Oxfd,Oxfc,Oxfc,Oxfc,Oxfd,Oxfd,Oxfd,Oxfd,Oxfd,Oxfd,Oxfd,Oxfd,Oxfe,Oxfd,Oxfd,Oxfd,Oxfd,Oxfd,Oxfd,Oxfd,Oxfd,Oxfd,Oxfd,Oxfd,Oxf
4、c,Oxfc,Oxfc,Oxfc,Oxfd,Oxfc},{Oxfc,Oxfc,Oxfd,Oxfc,Oxfc,Oxfc,Oxfd,Oxfc,Oxfd,Oxfd,Oxfd,Oxfd,Oxfd,Oxfd,Oxfd,Oxfd,Oxfd,Oxfd,Oxfd,Oxfc,Oxfd,Oxfd,Oxfd,Oxfd,Oxfd,Oxfc,Oxfc,Oxfd,Oxfc,O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