Dear sirs and madams
I present the following program to which i am simulating on a 8051 MCU
#include <reg51.h>
#include <stdio.h> #define output P0
void main () { unsigned int x;
while(1) { output = 1;
for(x=0; x<65000; x++) {
}
output = 0; for(x=0; x<65000; x++) {
My problem is that i am attempting to learn timing delays. For this program the P0 goes from 0 to 1 with a delay between. When i debug the program and run it with peripheral P0 open, it switches the value from 0 to 1 BUT the problem is its going to fast no matter how much delay i am putting in.
Please help me
Have you considered googling about the issues with busy-loops that doesn't do anything. And the large number of recommendations to use timers to implement delays.
An observant developer might see it as a delay integrated in the processor silicon and not affected my the software limitations.