Příklady s časovým zpožděním v C pro 8051
zdroj informací: http://what-when-how.com/8051-microcontroller/data-types-and-time-delay-in-8051-c/
Unsigned char
example 7-1
#include <reg51.h>
void main (void)
{
unsigned char z;
for (z=0;z<=255;z++)
P1=z;
}
example 7-2
#include <reg51.h>
void main (void)
{
unsigned char mynum [] = "012345ABCD";
unsigned char z;
for (z=0;z<=10;z++)
P1 = mynum[z];
}
example 7-3
#include <reg51.h>
void main (void)
{
for (;;) //opakovani cyklu
P1=0x55;
P1=0xAA;
}
Unsigned char
example 7-4
- include <reg51.h>
void main (void)
{
char mynum [] = {+1,-1,+2,-2,+3,-3,+4,-4}; unsigned char z;
for (z=0;z<=8;z++) P1 = mynum[z];
}