#includestc12c5a60s2.h#includeintrins.h#includeex-main.h//******************************************#defineuintunsignedint#defineucharunsignedchar#defineSET_DATA_ORDER0X40//КэѕЭГьБоЙиЦГЖХДЬДЈКЅ#defineSET_DISPLAY0X8C//ПФКѕГьБоїШЦЖВціеїн¶И11/16//******О»¶ЁТе*************************************sbitscl4=P3^7;//TM1640К±ЦУПЯsbitsda4=P3^6;//TM1640КэѕЭПЯ//*************************************************/******TM1640єЇКэГы******/voidstart();voidstop();voidwrite(uchardate);voidinit_tm1640(uchari,j);voidsend_z(ucharaddress,date);voidsend(ucharaddress,date);/******TM1640їЄКј******/voidstart(){sda4=1;scl4=1;_nop_();_nop_();sda4=0;_nop_();_nop_();scl4=0;_nop_();_nop_();}/******TM1640ЅбКш******/voidstop(){sda4=0;scl4=1;_nop_();_nop_();sda4=1;_nop_();_nop_();scl4=0;_nop_();_nop_();}/******РґЧЦЅЪ******/voidwrite(uchardate){uchari,aa;aa=date;sda4=0;scl4=0;for(i=0;i8;i++){scl4=0;if(aa&0x01){sda4=1;_nop_();_nop_();}else{sda4=0;_nop_();_nop_();}scl4=1;aa=aa1;}scl4=0;sda4=0;}/******ПтTM1640·ўЛНПФКѕКэѕЭ******//******іхКј»ЇTM1640******/voidinit_tm1640(void){sda4=1;scl4=1;start();write(SET_DATA_ORDER);//ЙиЦГКэѕЭЈ¬0x40,0x44·Ц±р¶ФУ¦µШЦ·ЧФ¶ЇјУТ»єН№М¶ЁµШЦ·ДЈКЅstop();start();write(SET_DISPLAY);//їШЦЖПФКѕЈ¬їЄПФКѕЈ¬0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f·Ц±р¶ФУ¦Вціеїн¶ИОЄ://------------------1/16,2/16,4/16,10/16,11/16,12/16,13/16,14/16//0x80№ШПФКѕstop();}voidsend_LED_Display(ucharaddress,ucharN){uchari;start();write(address);//ЙиЦГЖрКјµШЦ·for(i=0;iN;i++){write(display_buffer[i]);}write(0x00);write(0xff);write(0xff);write(0xff);write(0xff);stop();}/******ЧФ¶ЇјУТ»ДЈКЅ*****voidsend_z(ucharaddress,date){uchari;start();write(address);//ЙиЦГЖрКјµШЦ·for(i=0;i6;i++){write(date);}stop();}*//******№М¶ЁµШЦ·ДЈКЅ*****voidsend(ucharaddress,date){start();write(address);//ґ«ПФКѕКэѕЭ¶ФУ¦µДµШЦ·write(date);//ґ«1BYTEПФКѕКэѕЭstop();}*/