Site icon Ercan Koçlar

Lesson1 – MikroC in LIBRARY PREPARATION

mikroc-in-library-preparation

mikroc-in-library-preparation

This post is also available in: Türkçe Azerbaycan Türkcesi Русский


Code

extern sfr sbit LED;
extern sfr sbit LED_TRIS;
#define saniye 1000

//fonksyonlar.c Code
#include "header.h"
void LED_YAK(unsigned char sure)
{
LED_TRIS=0;
LED=0;
vdelay_ms(sure*saniye);
LED=1;
}

void LED_FLASH(unsigned char flash_sure , unsigned char yanma_suresi)
{
int i;
LED_TRIS=0;
for(i=0;i<yanma_suresi;i++)
{
LED=0;
vdelay_ms(flash_sure*saniye);
LED=1;
vdelay_ms(flash_sure*saniye);
}
}

//led_yak.c Code
#include "fonksyonlar.c"

sbit LED at RB4_bit;
sbit LED_TRIS at TRISB4_bit;

main()
{
LED_YAK(5);
delay_ms(2000);
LED_FLASH(2,10);
}

Important Notes 

  1. Libraries should be designed to provide all of the conditions
  2. Add your comments to the certainly functions
  3. Check the your continuous software, provide RAM optimization, remember that MCU (microcontroller) programs 1kb is a very large area ;)


Exit mobile version