??? 12/02/04 06:17 Read: times |
#82348 - loop Problem Responding to: ???'s previous message |
As I understnad you are the variables P2_6, P2_5, P2_7 are all bit variables of port 2 and you are assigning byte values to these variables. So in the simulation the code is working some how. That may be a bug in the Keil simulator. But when the code executes on the micro the value assignments are causing an unexpected behaviour.
Try doing this and I hope it will work. #include <stdio.h> #include <at89x52.h> void nothing(); void main() { int i = 0; P0 = 0x00; P1 = 0x00; P2 = 0x00; P3 = 0x00; for(i = 0; i < 200; i++){ P2_6 = 1; nothing(); P2_6 = 0; nothing(); } for(i = 0; i < 200; i++){ P2_5 = 1; nothing(); P2_5 = 0; nothing(); } while(1){ P2_7 = 1; nothing(); P2_7 = 0; nothing(); } } void nothing() { int i; for(i = 0; i < 0x5000; i++); } |
Topic | Author | Date |
Loop Problem | 01/01/70 00:00 | |
Change | 01/01/70 00:00 | |
loop Problem | 01/01/70 00:00 | |
Sorry!!! It is P2_6 = 1 and P2_6 = 0 | 01/01/70 00:00 | |
How to post code | 01/01/70 00:00 | |
please post the actual code | 01/01/70 00:00 | |
" | 01/01/70 00:00 | |
Missing Subject..... | 01/01/70 00:00 | |
Brief, not missing? | 01/01/70 00:00 | |
missing subject | 01/01/70 00:00 | |
Lost Posting? | 01/01/70 00:00 | |
Text in the post | 01/01/70 00:00 | |
yes | 01/01/70 00:00 | |
Message replies in subject![]() | 01/01/70 00:00 | |
ditto | 01/01/70 00:00 |