We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi i've got this problem can some out there help please, i'm to write a code for alarm sitting in the project that i'm doing,basically i'm to write a code that will inform some one that its time to take medication, in the morning,afternoon and night, everyday. and the other is to inform someone hourly everyday as well.
#int TIMER1 void TIMER1 isr() { Ticker-=65536; // Decrement ticker by clocks per interrupt if(Ticker<65536) // If second has expired { Ticker+=TIMER1 FREQUENCY; // Increment ticker by clocks per second seconds++; // Increment number of seconds }
//--Optional part start---
if(Seconds==60){Minutes++;Seconds=0; if(Minutes==60){Hours++;Minutes=0; if(Hours==24){Days++;Hours=0; if((Days==29&&Month==2&& !IS LEAP(year)) ||(Days==30&&Month==2) ||(Days == 31&&(Month == 4||Month == 6||Month == 9||Month == 11 ))
||(Days==32) ){Month++;Days=0;} if(Month==13){year++;Month=0;}
}}}
// ---Optional part end--- */
}}
the following below are the Errors about the above code and i'm new
(67): error C244: 'Seconds': can't initialize, bad type or class (67): error C132: 'Seconds': not in formal parameter list (68): error C141: syntax error near 'if' (68): error C141: syntax error near '==', expected ')' (68): error C129: missing ';' before '++' Target not created
On one hand, there is (at least) one bug in the code. How many months do you have in a year?
Second - do you feel that the code is readable. How about formatting it according to the information available directly about the message input box?
Third - you can modify your timer interrupt so it doesn't require long integers. Remember that the 8051 chip can't handle 32-bit integers natively.
Fourth - did you have a question?
Pick up a generic textbook on C programming.
All code must be inside functions. And for most target platforms, your initial function is main().
Where are your variable declarations?