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
This guy's probably going to write the code for the anti-lock brakes in your next car.
"This guy's probably going to write the code for the anti-lock brakes in your next car." By the time I can afford another car it'll probably have a Windows box attached to each wheel sensor. At least there'll be time for a cup of coffee in the morning while the bloody thing boots up. 'Where do YOU want to go today?' 'Nowhere, fortunately.'
#include <stdWindowsCarJoke.h> Of course, if it bluescreens while you're driving, all you need to do is close all your open windows and start again. You have my permission to groan. Steve
This guy's probably going to write the code for the anti-lock brakes in your next car. And you think that is scary?? Some people I know of thet are "specializing in bugs" have been hired to write a robot controlled colon biopsy machine. Erik