CT107D-按键的使用(中断法)
#include <reg52.h> int main() { IE|=0x85; TCON|=0x05; while(1); return 0; } void key_32(void) interrupt 0 { P2=(P2&0x1f)|0x80; P0=0x00; P2&=0x1f; } void key_33(void) interrupt 2 { P2=(P2&0x1f)|0x80; P0=0xff; P2&=0x1f; }
#include <reg52.h> int main() { IE|=0x85; TCON|=0x05; while(1); return 0; } void key_32(void) interrupt 0 { P2=(P2&0x1f)|0x80; P0=0x00; P2&=0x1f; } void key_33(void) interrupt 2 { P2=(P2&0x1f)|0x80; P0=0xff; P2&=0x1f; }
#include <reg52.h> sbit S4=P3^3; sbit S5=P3^2; sbit S6=P3^1; sbit S7=P3^0; sbit buzzer=P0^6; //蜂鸣器...
#include <reg52.h> #include <absacc.h> void main() { XBYTE[0x8000]=0x00; }这是最简单的一个案例,我们使用MM编程方法需要使用的是XBYTE这个关键词,值得注意的...
先贴上核心代码unsigned char get_temp(void) { unsigned char TH,TL; init_ds18b20(); Write_DS18B20(0xCC); Write_DS18B20(0x44); De...
#include<reg52.h> #include<intrins.h> void hdw_init(); void smg_refresh(); void Delay1ms(); unsigned char nu...
#include<iic.h> #include "reg52.h" #include "intrins.h" typedef unsigned char BYTE; typedef&nbs...