mikroc 8.2 multible source file

Thread Starter

walid el masry

Joined Mar 31, 2009
133
hi
is it possible to separate the source code in c language into multiple source code files and include all of source code files in the same project so that i can use methods in each file without declaring all methods in the same main file to reduce the amount of code written in the main code file

as example for that i would like to blink a led so there is 4 steps for that

1- initialize the output pin
2- set bit and wait for suitable time
3- clear bit and wait for suitable time
4- put step 2 & 3 in infinite loop

Rich (BB code):
// main code
// inti & set & clr are source files to be included
void main(){
 inti();
 while(1){
  set();
  clr();
 }
}
Rich (BB code):
void inti(){
 TRISB = 0x00;
 PORTB = 0x00;
}
Rich (BB code):
void set(){
 PORTB.f0 = 1;
 delay_ms(1000);
}
Rich (BB code):
void clr(){
 PORTB.f0 = 0;
 delay_ms(1000);
}
 
Last edited:
Top