??? 04/12/04 12:49 Read: times |
#68350 - Assembly works but C... |
Hello All,
I have been writing assembly programs for the 8051 for a couple of years, now I have decided to use C. My following C code is not working... #include <AT89X52.H> #include <intrins.h> void LongDelay(); void main(void) { while(1) { P1 =0xaa; P0 =0xaa; LongDelay(); P1 =0x55; P0 =0x55; LongDelay(); } } void LongDelay() { unsigned long int a; for(a=0;a<0xffff;a++) { _nop_(); } _nop_(); } To cross check my harware, i wrote the following simple code using assembly language...its working org 0000h mov p1,#0xaa; mov p0,#0xaa; lcall l_delay mov p1,#0x55; mov p0,#0x55; lcall l_delay ljmp 0000 L_DELAY: MOV R7,#0AH ;100 MILLISECONDS * 10 LLL: LCALL DLAYms ;1 SECOND DJNZ R7,LLL RET end Now I am sure that there is no problem in the Hardware. The C code works fine in the Simulator...I am using AT89C52. Now I am working on a Graphical LCD and I do feel that using C the project can be completed much faster. Is it a must that I have to use STARTUP.A51 if I am using C. Regards Raj Shetgar |
Topic | Author | Date |
Assembly works but C... | 01/01/70 00:00 | |
RE: Assembly works but C... | 01/01/70 00:00 | |
RE: Assembly works but C... | 01/01/70 00:00 | |
RE: Assembly works but C... | 01/01/70 00:00 | |
RE: Assembly works but C... | 01/01/70 00:00 | |
RE: Assembly works but C... | 01/01/70 00:00 | |
RE: Assembly works but C... | 01/01/70 00:00 | |
RE: Assembly works but C... | 01/01/70 00:00 | |
STARTUP.A51 | 01/01/70 00:00 | |
RE: STARTUP.A51 | 01/01/70 00:00 | |
RE: STARTUP.A51 | 01/01/70 00:00 | |
Stand Still... | 01/01/70 00:00 | |
RE: Stand Still... | 01/01/70 00:00 | |
RE: STARTUP.A51 | 01/01/70 00:00 | |
RE: STARTUP.A51 | 01/01/70 00:00 | |
function for LCD in C... | 01/01/70 00:00 | |
RE: function for LCD in C...![]() | 01/01/70 00:00 | |
RE: Assembly works but C... | 01/01/70 00:00 | |
RE: Assembly works but C... | 01/01/70 00:00 | |
RE: Assembly works but C... | 01/01/70 00:00 | |
RE: Assembly works but C... | 01/01/70 00:00 | |
RE: Assembly works but C... | 01/01/70 00:00 |