Geshi-Highlight
(Rozdíly mezi verzemi)
Řádka 17: | Řádka 17: | ||
} | } | ||
?> | ?> | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | <syntaxhighlight lang="C"> | ||
+ | #include <reg51.h> | ||
+ | #include<stdio.h> | ||
+ | |||
+ | void MSdelay (unsigned int); | ||
+ | |||
+ | sbit P10 = 0x90; | ||
+ | |||
+ | /* now the functions may be written to use this location */ | ||
+ | void main (void) | ||
+ | |||
+ | { | ||
+ | /* forever loop, toggling pin 0 of port 1 */ | ||
+ | while (1==1) | ||
+ | { | ||
+ | P10 = !P10; | ||
+ | P3=0xAA; | ||
+ | MSdelay (500); /* wait 500 microseconds */ | ||
+ | P3=0x55; | ||
+ | MSdelay (500); /* wait 500 microseconds */ | ||
+ | } | ||
+ | } | ||
+ | |||
+ | |||
+ | void MSdelay (unsigned int itime) | ||
+ | |||
+ | { | ||
+ | unsigned int i,j; | ||
+ | for (i=0;i<itime;i++); | ||
+ | for (j=0;j<1275;j++); | ||
+ | |||
+ | } | ||
</syntaxhighlight> | </syntaxhighlight> |
Verze z 27. 4. 2011, 18:55
<?php for ($i=0;$i<=10;$i++) // Příklad cyklu for v php. BY ROMAN SVOBODA { echo $i; } ?> <?php $i = 0; while ($i<=10) { // Příklad cyklu while v php. BY ROMAN SVOBODA echo $i; ++$i; } ?>
#include <reg51.h> #include<stdio.h> void MSdelay (unsigned int); sbit P10 = 0x90; /* now the functions may be written to use this location */ void main (void) { /* forever loop, toggling pin 0 of port 1 */ while (1==1) { P10 = !P10; P3=0xAA; MSdelay (500); /* wait 500 microseconds */ P3=0x55; MSdelay (500); /* wait 500 microseconds */ } } void MSdelay (unsigned int itime) { unsigned int i,j; for (i=0;i<itime;i++); for (j=0;j<1275;j++); }