| ??? 05/28/05 20:44 Read: times |
#94061 - If it works in ASM it Works in C Responding to: ???'s previous message |
1. Use sbit UP = P^0; // it is more read able
2. there are no Port latch to read back from on 8052's 3. Why are you doing code in C you would not do in ASM? in ASM scan:JNB P0.7,scanup JNB P0.6,scandown ... SJMP scan scanup:JNB P0.7,$ (...some codes...) RET scandown:JNB P0.6,$ (...some codes...) RET in C
void scan (void)
{
if(P0^7)
{
(...some code...)
}
if(P0^6)
{
(...some code...)
}
}
sbit is not the same a bit read the Manual. |
| 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 |



