To create a square wave generation using Delay. let us say we want to construct a 1khz square waveform the processor instruction cycle of 8051 is 1.085microseconds so for 1khz (1milli seconds =1/1khz), is 1ms/1.085microseconds = 921.6 (this value is set to the for loop) #include <reg51.h> void delay() { for(i=0;i<922;i++) } void main() { P0=0xff; delay(); P0=0x00; delay(); }
Its all about Network Simulations (NS2, NS3), Internet of Things, Sensor Networks, Programming, Embedded Systems, Cyber Physical Systems, etc