Skip to content

Count Down Led C

Intro

Pogram ini akan mengeluarkan nilai 255(0xFF) - 0(0x00) pada port P1.

The Code

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

inline
void delay(void)
{
    __asm
    nop
    __endasm;
}

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

Last update: February 11, 2021

Comments