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.
#include <reg52.h> unsigned char chrState; unsigned char chrDate[6];//year, month, date, hour, minute, second unsigned char idata chrPlace; void main() { unsigned char chrTemp; do { do { }while(1); switch (chrState) { case 1: { if (chrTemp<11) { switch (chrPlace) { case 8: { chrDate[0]%=10; } break; case 7: { chrDate[0]/=10; } break; case 6: { chrDate[1]%=10; } break; case 5: { chrDate[1]/=10; } break; case 4: { chrDate[2]%=10; } break; case 3: { chrDate[2]/=10; } break; case 2: { chrDate[3]%=10; } break; case 1: { chrDate[3]/=10; } break; case 16: { chrDate[4]%=10; } break; case 15: { chrDate[4]/=10; } break; case 14: { chrDate[5]%=10; } break; case 13: { chrDate[5]/=10; } break; default: break; } } } break; case 2: { } break; } }while(1); }
Please read the Notes at the top of the form where you typed your post - it tells you how to post code so that the layout is preserved. Please re-post the code, following the instructions - then it might be a bit more legible! Please also post the full text of the error message. The Manuals contain lists with descriptions of the error messages - have you looked at them?
You're missing some code:
do { do { }while(1); ...
typedef enum {Mod, Div } Operators; Operators op = SomeFunctionOfState (chrState); U8 i = SomeOtherFunctionOfState (chrState); if (op == Mod) { chrDate[i] %= 10; } else { chrDate[i] /= 10; }