Hi, i am interested in knowing if the C51 compiler is able to define initrisic functions... I mean if there is a way I can define a function that is expanded inline in the assembly language and there are no CALLs or RETs generated for it. I know there are some built in intrisic funtions in C51 like _iror_ _irol_ and the like, but i wonder if it is possible to define new ones. Any informations on this?
Ok, this for example: file1.c
UCHAR T1RLH = 0; UCHAR T1RLL = 0; void timer1_interrupt (void) interrupt 3 { TL1 = T1RLL; TH1 = T1RLH; //Do whatever else you need... Time++; }
#define init_timer1(reload) TMOD = ((TMOD & 0x0F)| 0x10);\ T1RLH = ((reload) / 0x100);\ T1RLL = ((reload) % 0x100);\ TH1 = T1RLH;\ TL1 = T1RLL
#include "file1.h" void main(void) { init_timer1(20000); }
#define init_timer1(reload) TMOD = ((TMOD & 0x0F)| 0x10);\ T1RLH = ((reload) / 0x100);\ T1RLL = ((reload) % 0x100);\ TH1 = T1RLH;\ TL1 = T1RLL extern UCHAR T1RLH; extern UCHAR T1RLL;