Skip to content

Count Up Led C

Pogram sederhana untuk membuat counter up 0(0x00) sampai 255(0xff) pada port P1 secara biner.

The Code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
#include <8052.h>
#include <stdint.h>

void delay(void)
{
    __asm
    nop
    __endasm;
}

void main(void)
{
    while(1){
    uint8_t i;
        for(i=0 ; i<0xff ; i++)
        {
            P1=i;
            delay();
        }
    }                
}

Last update: February 11, 2021

Comments