??? 05/31/05 01:19 Read: times |
#94125 - to be precise.. Responding to: ???'s previous message |
Hi everyone,
Thanks for your patience and replies. Mike, that was a wonderful explanation. Let me briefly explain the situation. My project is called as Vehicle Information System, which gets many parameters as inputs, does a lot of calculations and displays in LCD. Me and my friend started module-wise, but when it came to merge our individual parts, problems started. Backing up of registers itself turned out to be so daunting. Thats why we migrated to C. (Neil, Well, the piece of code shown there was a part and many more are inside, thats why C. And Andy, C gives me better comprehension than assembly !) My doubts are these: for checking and waiting on a port pin, say P0.7(P0^7 in Keil!), which method is suitable? while(P0^7==1); {...} (or) while( (P0^7 & 0xF0) == 1); {...} (or) anything else? Sometimes, the former method is working and sometimes latter is working. For testing this, I wrote a small program, which will calculate the time for which P0.7 button is pressed: while(1) { while(P0^7==1); TR1=1; while(P0^7==0); TR1=0; //Timer0 is properly configured as 50ms timer //there is also a variable counter which gets //incremented upon timer0 overflow display_lcd(...); //for resetting screen while(P0^7==1); while(P0^7==0); clear_lcd(); init_counter(); } The program is: when the key is first pressed, it will internally count the time elapsed in terms of 50ms, then will display. It requires another press of same key to initialise. Inside while loop, I used both the ways: while(P0^7==x) and, as Leo suggested, while((P0 &0xF0)==x). But not getting the required action. Am I missing something? Thanks and Regards, Vignesh. |
Topic | Author | Date |
Keil: getting input | 01/01/70 00:00 | |
If it works in ASM it Works in C | 01/01/70 00:00 | |
Why C?! | 01/01/70 00:00 | |
Irrelevant | 01/01/70 00:00 | |
Of Course | 01/01/70 00:00 | |
key scan | 01/01/70 00:00 | |
Delay.. | 01/01/70 00:00 | |
Delay | 01/01/70 00:00 | |
Software Delay Loops | 01/01/70 00:00 | |
Software Delay Loops | 01/01/70 00:00 | |
Learning 'C' | 01/01/70 00:00 | |
to be precise.. | 01/01/70 00:00 | |
Debounce | 01/01/70 00:00 | |
completely missed it.. | 01/01/70 00:00 | |
to be precise... | 01/01/70 00:00 | |
Sorry Leo ! | 01/01/70 00:00 | |
Inferences | 01/01/70 00:00 | |
Right answer, wrong reason | 01/01/70 00:00 | |
and therefore | 01/01/70 00:00 | |
Congratulations | 01/01/70 00:00 | |
to: Raghu Sir![]() | 01/01/70 00:00 | |
BIts! | 01/01/70 00:00 |