??? 01/01/05 12:24 Read: times |
#84190 - Keil C Code not working |
Hi
I am trying to run this code for 2 days without success and i have no idea what's wrong. I am trying to get the output of the function int IsLeapYear( int y ) by running the code on At89C52. This function is working absolutely fine in Deskop Turbo C++. but its not working when i burn it on 52. infact it seems that the program is HANGed just like a desktop program hangs. when i remove the above function and also remove the calls from main(), every thing starts working fine. i have done this testing 2-4 times and i am totally confused. It seems that i am using some Math function in int IsLeapYear( int y ). Do i have to do some thing else to compile and generate the final HEX file. Note the program also works fine in Keil Debugger. Shahzad i have omited the remainig portion of the program after int IsLeapYear( int y ). #include <AT89x52.h> #include <intrins.h> #include <math.h> void Simple_Delay_N_Fifty(int); void Simple_Delay_Fifty_Milliseconds(void); void WriteCommandLCD(unsigned char, int); void speakerRoutine(int dur, int tune); int IsLeapYear( int y ); sbit RS=P2^4; sbit EN=P2^5; sbit speaker = P3^5; int temp, temp2; int z; void main(void) { TMOD |= 0x01; ET0 = 0; Simple_Delay_N_Fifty(10); z = IsLeapYear(2004); if(z == 1) { WriteCommandLCD(0x20, 1); //execute command WriteCommandLCD(0x0F, 1); //execute command } while(1) { speakerRoutine(10,5); } } int IsLeapYear( int y ) { if( ((y % 4) == 0) && ((y % 100) != 0) || ((y % 400) == 0) ) return( 1 ); else return( 0 ); } |
Topic | Author | Date |
Keil C Code not working | 01/01/70 00:00 | |
Desktop turbo c++ ? | 01/01/70 00:00 | |
Slightly??!! | 01/01/70 00:00 | |
agreed | 01/01/70 00:00 | |
i got the math to do div / multiply | 01/01/70 00:00 | |
Debugger? Simulator? Maths? | 01/01/70 00:00 | |
Question... | 01/01/70 00:00 | |
Please use Correct Terms | 01/01/70 00:00 | |
Re Andy Debugger, Simulator? Math | 01/01/70 00:00 | |
*unnecessarily* complex! | 01/01/70 00:00 | |
Re andy | 01/01/70 00:00 | |
Divide and Conquer! | 01/01/70 00:00 | |
Bad Burner? | 01/01/70 00:00 | |
Re Andy Bad Burner | 01/01/70 00:00 | |
Project Configuration? | 01/01/70 00:00 | |
debugging? | 01/01/70 00:00 | |
thanks for the link | 01/01/70 00:00 | |
Data Sizes - Lesson not yet learned? | 01/01/70 00:00 | |
Re Andy | 01/01/70 00:00 | |
brackets ? | 01/01/70 00:00 | |
(no) brackets | 01/01/70 00:00 | |
WriteCommandLCD ? | 01/01/70 00:00 | |
Re Andy | 01/01/70 00:00 | |
Problem not fixed yet? | 01/01/70 00:00 | |
Problem not fixed yet?![]() | 01/01/70 00:00 |