#include <reg52.h> #define uint unsigned int #define uchar undingned char sbit relay=P2^7; void delayn50ms(uint n) { uint i,j; for(i=0;i<n;i++) for(j=0;j<=10000;j++); } main() { while(1) { relay=0; delayn50ms(5); relay=1; delayn50ms(5); } }
#include <reg52.h> #define uint unsigned int #define uchar undingned char sbit relay=P2^7; void delayn50ms(uint n) { uint i,j; for(i=0;i<n;i++) for(j=0;j<=10000;j++); } main() { while(1) { relay=0; delayn50ms(5); relay=1; delayn50ms(5); } }