Hi, Please, any one can help me to explain the following function: Q1) Function X_Init Q2) Function X Q3) Function sEOS_ISR() Q4) Function sEOS_Go_To_Sleep Code: #include <reg52.h> #define OSC_FREQ (12000000UL) #define OSC_PER_INST (12) void sEOS_Init_Timer2(const unsigned char); void sEOS_Go_To_Sleep(void); void X_Init(void); void X(void); void X_Init(void); #define INTERRUPT_TIMER_2_Overflow 5 void main(void) { X_Init(); // prepare for dummy task sEOS_Init_Timer2(60); // set up simple EOS (60ms tick interval) while(1) { sEOS_Go_To_Sleep(); } } void X_Init(void) { // Dummy task init function // Dummy task init... } void X(void) { // Dummy task called from sEOS ISR // Dummy task.... } void sEOS_ISR() interrupt INTERRUPT_TIMER_2_Overflow { TR2 = 0; X(); } void sEOS_Init_Timer2(const unsigned char TICK_MS) { unsigned long Inc; unsigned int Reload_16; unsigned char Reload_08H, Reload_08L; T2CON = 0x04; Inc = (TICK_MS * (OSC_FREQ/1000)) / OSC_PER_INST; // Inc = 60,000 = 0xEA60 Reload_16 = (65536UL - Inc); // Reload_16 = 5536 =0x15A0 Reload_08H = (Reload_16 / 256); Reload_08L = (Reload_16 % 256); TH2 = Reload_08H; // 0x15 RCAP2H = Reload_08H; TL2 = Reload_08L; // 0xA0 RCAP2L = Reload_08L; ET2 = 1; TR2 = 1; EA = 1; } void sEOS_Go_To_Sleep(void) { PCON |= 0x01; // enter idle mode (generic 8051 version) } Thank You
"Please, any one can help me to explain the following function: Q1) Function X_Init Q2) Function X Q3) Function sEOS_ISR() Q4) Function sEOS_Go_To_Sleep" You're joking, right?
Hi, Please, can you all answer my question?? It is the code have anything wrong?? Thanks...
"Please, can you all answer my question?? It is the code have anything wrong??" Oh sorry, here we go: Q1) Function X_Init This function does nothing at all. Q2) Function X This function does nothing at all. Q3) Function sEOS_ISR() This function sets TR2 to 0, then calls function X(). Q4) Function sEOS_Go_To_Sleep This function sets PCON bit zero to 1. The code in these functions looks fine syntactically.
Now we know why Longhorn won't be available until the end of next year (at least).
View all questions in Keil forum